From e75eb8481daebcf3ea23aa8dc8a68daf13a45c91 Mon Sep 17 00:00:00 2001 From: abgreeve Date: Mon, 6 Sep 2021 09:43:08 +0530 Subject: [PATCH] MDL-71912 mod_assign: Updating the activity to use the actionmenu. Co-authored-by: Sujith Haridasan --- mod/assign/classes/local/views/secondary.php | 21 +- mod/assign/classes/output/actionmenu.php | 65 ++++++ .../classes/output/grading_actionmenu.php | 64 ++++++ .../classes/output/override_actionmenu.php | 160 +++++++++++++++ mod/assign/classes/output/renderer.php | 123 +++++------- .../output/user_submission_actionmenu.php | 140 +++++++++++++ .../tests/behat/feedback_comments.feature | 2 +- ...erve_changes_on_validation_failure.feature | 2 +- .../editpdf/tests/behat/annotate_pdf.feature | 6 +- .../tests/behat/comment_popup_menu.feature | 2 +- .../tests/behat/group_annotations.feature | 2 +- .../behat/view_previous_annotations.feature | 2 +- mod/assign/lang/en/assign.php | 2 + mod/assign/lib.php | 18 +- mod/assign/locallib.php | 48 ++++- mod/assign/overrides.php | 14 +- .../templates/grading_actionmenu.mustache | 44 +++++ .../templates/override_actionmenu.mustache | 94 +++++++++ .../templates/submission_actionmenu.mustache | 44 +++++ .../user_submission_actionmenu.mustache | 185 ++++++++++++++++++ .../tests/behat/allow_another_attempt.feature | 8 +- .../behat/assign_activity_completion.feature | 2 +- .../tests/behat/assign_course_reset.feature | 18 +- .../tests/behat/assign_group_override.feature | 35 ++-- .../tests/behat/assign_user_override.feature | 24 +-- .../bulk_release_anon_submissions.feature | 12 +- .../behat/bulk_remove_submissions.feature | 8 +- mod/assign/tests/behat/comment_inline.feature | 4 +- .../display_error_message_onbadformat.feature | 4 +- mod/assign/tests/behat/display_grade.feature | 8 +- .../behat/edit_previous_feedback.feature | 4 +- .../behat/edit_student_submission.feature | 2 +- .../tests/behat/filter_by_marker.feature | 4 +- mod/assign/tests/behat/filter_drafts.feature | 4 +- .../tests/behat/grading_app_filters.feature | 8 +- mod/assign/tests/behat/grading_status.feature | 20 +- .../tests/behat/grant_extension.feature | 8 +- .../tests/behat/group_submission.feature | 14 +- mod/assign/tests/behat/hide_grader.feature | 4 +- .../tests/behat/outcome_grading.feature | 10 +- mod/assign/tests/behat/page_titles.feature | 2 +- .../behat/prevent_submission_changes.feature | 8 +- mod/assign/tests/behat/quickgrading.feature | 8 +- mod/assign/tests/behat/relative_dates.feature | 2 +- .../tests/behat/remove_submission.feature | 6 +- .../behat/reopen_locked_submission.feature | 4 +- mod/assign/tests/behat/rescale_grades.feature | 14 +- .../tests/behat/set_availability.feature | 6 +- .../tests/behat/steps_blind_marking.feature | 16 +- .../tests/behat/submission_comments.feature | 10 +- .../tests/behat/submit_without_group.feature | 8 +- mod/assign/tests/locallib_test.php | 58 +++--- 52 files changed, 1099 insertions(+), 282 deletions(-) create mode 100644 mod/assign/classes/output/actionmenu.php create mode 100644 mod/assign/classes/output/grading_actionmenu.php create mode 100644 mod/assign/classes/output/override_actionmenu.php create mode 100644 mod/assign/classes/output/user_submission_actionmenu.php create mode 100644 mod/assign/templates/grading_actionmenu.mustache create mode 100644 mod/assign/templates/override_actionmenu.mustache create mode 100644 mod/assign/templates/submission_actionmenu.mustache create mode 100644 mod/assign/templates/user_submission_actionmenu.mustache diff --git a/mod/assign/classes/local/views/secondary.php b/mod/assign/classes/local/views/secondary.php index d78577c9c7c..4b490964c15 100644 --- a/mod/assign/classes/local/views/secondary.php +++ b/mod/assign/classes/local/views/secondary.php @@ -30,15 +30,16 @@ use core\navigation\views\secondary as core_secondary; */ class secondary extends core_secondary { protected function get_default_module_mapping(): array { - return [ - self::TYPE_SETTING => [ - 'modedit' => 1, - "mod_{$this->page->activityname}_useroverrides" => 2, // Overrides are module specific. - "mod_{$this->page->activityname}_groupoverrides" => 3, - ], - self::TYPE_CUSTOM => [ - 'advgrading' => 4, - ], - ]; + $defaultmaping = parent::get_default_module_mapping(); + $defaultmaping[self::TYPE_SETTING] = array_merge($defaultmaping[self::TYPE_SETTING], [ + 'modedit' => 1, + "mod_{$this->page->activityname}_useroverrides" => 2, // Overrides are module specific. + "mod_{$this->page->activityname}_groupoverrides" => 3, + ]); + + $defaultmaping[self::TYPE_CUSTOM] = array_merge($defaultmaping[self::TYPE_CUSTOM], [ + 'advgrading' => 4, + ]); + return $defaultmaping; } } diff --git a/mod/assign/classes/output/actionmenu.php b/mod/assign/classes/output/actionmenu.php new file mode 100644 index 00000000000..23dca8a0957 --- /dev/null +++ b/mod/assign/classes/output/actionmenu.php @@ -0,0 +1,65 @@ +. + +/** + * Output the actionbar for this activity. + * + * @package mod_assign + * @copyright 2021 Adrian Greeve + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_assign\output; + +use templatable; +use renderable; +use moodle_url; + +/** + * Output the actionbar for this activity. + * + * @package mod_assign + * @copyright 2021 Adrian Greeve + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class actionmenu implements templatable, renderable { + + /** @var int The course module ID. */ + private $cmid; + + /** + * Constructor for this object. + * + * @param int $cmid The course module ID. + */ + public function __construct(int $cmid) { + $this->cmid = $cmid; + } + + /** + * Data to be used for a template. + * + * @param \renderer_base $output renderer base output. + * @return array Data to be used for a template. + */ + public function export_for_template(\renderer_base $output): array { + return [ + 'submissionlink' => (new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'grading']))->out(false), + 'gradelink' => (new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'grader']))->out(false) + ]; + } + +} diff --git a/mod/assign/classes/output/grading_actionmenu.php b/mod/assign/classes/output/grading_actionmenu.php new file mode 100644 index 00000000000..62f2d88af9a --- /dev/null +++ b/mod/assign/classes/output/grading_actionmenu.php @@ -0,0 +1,64 @@ +. + +/** + * Output the grading actionbar for this activity. + * + * @package mod_assign + * @copyright 2021 Adrian Greeve + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_assign\output; + +use templatable; +use renderable; +use moodle_url; + +/** + * Output the grading actionbar for this activity. + * + * @package mod_assign + * @copyright 2021 Adrian Greeve + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class grading_actionmenu implements templatable, renderable { + + /** @var int Course module ID. */ + protected $cmid; + + /** + * Constructor for this object. + * + * @param int $cmid Course module ID. + */ + public function __construct(int $cmid) { + $this->cmid = $cmid; + } + + /** + * Data to render in a template. + * + * @param \renderer_base $output renderer base output. + * @return array Data to render. + */ + public function export_for_template(\renderer_base $output): array { + return [ + 'back' => (new moodle_url('/mod/assign/view.php', ['id' => $this->cmid]))->out(false), + 'downloadall' => (new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'downloadall']))->out(false) + ]; + } +} diff --git a/mod/assign/classes/output/override_actionmenu.php b/mod/assign/classes/output/override_actionmenu.php new file mode 100644 index 00000000000..05bcae3a1cd --- /dev/null +++ b/mod/assign/classes/output/override_actionmenu.php @@ -0,0 +1,160 @@ +. + +/** + * Output the override actionbar for this activity. + * + * @package mod_assign + * @copyright 2021 Adrian Greeve + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_assign\output; + +use core_availability\info_module; +use moodle_url; +use templatable; +use renderable; +use url_select; +use single_button; + +/** + * Output the override actionbar for this activity. + * + * @package mod_assign + * @copyright 2021 Adrian Greeve + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class override_actionmenu implements templatable, renderable { + + /** @var moodle_url The current url for this page. */ + protected $currenturl; + /** @var \cm_info course module information */ + protected $cm; + /** @var int The activity group mode */ + protected $groupmode; + /** @var bool Can all groups be accessed */ + protected $canaccessallgroups; + /** @var array Groups related to this activity */ + protected $groups; + + /** + * Constructor for this action menu. + * + * @param moodle_url $currenturl The current url for this page. + * @param \cm_info $cm course module information. + */ + public function __construct(moodle_url $currenturl, \cm_info $cm) { + $this->currenturl = $currenturl; + $this->cm = $cm; + $this->groupmode = groups_get_activity_groupmode($this->cm); + $this->canaccessallgroups = ($this->groupmode === NOGROUPS) || + has_capability('moodle/site:accessallgroups', $this->cm->context); + $this->groups = $this->canaccessallgroups ? groups_get_all_groups($this->cm->course) : + groups_get_activity_allowed_groups($this->cm); + } + + /** + * Create a select menu for overrides. + * + * @return url_select A url select object. + */ + protected function get_select_menu(): url_select { + $userlink = new moodle_url('/mod/assign/overrides.php', ['cmid' => $this->cm->id, 'mode' => 'user']); + $grouplink = new moodle_url('/mod/assign/overrides.php', ['cmid' => $this->cm->id, 'mode' => 'group']); + $menu = [ + $userlink->out(false) => get_string('useroverrides', 'mod_assign'), + $grouplink->out(false) => get_string('groupoverrides', 'mod_assign'), + ]; + return new url_select($menu, $this->currenturl->out(false), null, 'mod_assign_override_select'); + } + + /** + * Whether to show groups or not. + * + * @return bool + */ + protected function show_groups(): bool { + if ($this->groupmode == NOGROUPS) { + return false; + } + return !empty($this->groups); + } + + /** + * Whether to enable/disable user override button or not. + * + * @return bool + */ + protected function show_useroverride(): bool { + global $DB; + $users = []; + $context = $this->cm->context; + if ($this->canaccessallgroups) { + $users = get_enrolled_users($context, '', 0, 'u.id'); + } else if ($this->groups) { + $enrolledjoin = get_enrolled_join($context, 'u.id'); + list($ingroupsql, $ingroupparams) = $DB->get_in_or_equal(array_keys($this->groups), SQL_PARAMS_NAMED); + $params = $enrolledjoin->params + $ingroupparams; + $sql = "SELECT u.id + FROM {user} u + JOIN {groups_members} gm ON gm.userid = u.id + {$enrolledjoin->joins} + WHERE gm.groupid $ingroupsql + AND {$enrolledjoin->wheres}"; + $users = $DB->get_records_sql($sql, $params); + } + + $info = new info_module($this->cm); + $users = $info->filter_user_list($users); + + return !empty($users); + } + + /** + * Data to be used in a template. + * + * @param \renderer_base $output renderer base output. + * @return array The data to be used in a template. + */ + public function export_for_template(\renderer_base $output): array { + + $type = $this->currenturl->get_param('mode'); + if ($type == 'user') { + $text = get_string('addnewuseroverride', 'mod_assign'); + } else { + $text = get_string('addnewgroupoverride', 'mod_assign'); + } + $action = ($type == 'user') ? 'adduser' : 'addgroup'; + + $params = ['cmid' => $this->currenturl->get_param('cmid'), 'action' => $action]; + $url = new moodle_url('/mod/assign/overrideedit.php', $params); + + $options = []; + if ($action == 'addgroup' && !$this->show_groups()) { + $options = ['disabled' => 'true']; + } else if ($action === 'adduser' && !$this->show_useroverride()) { + $options = ['disabled' => 'true']; + } + $overridebutton = new single_button($url, $text, 'post', true, $options); + + $urlselect = $this->get_select_menu(); + return [ + 'addoverride' => $overridebutton->export_for_template($output), + 'urlselect' => $urlselect->export_for_template($output) + ]; + } +} diff --git a/mod/assign/classes/output/renderer.php b/mod/assign/classes/output/renderer.php index 869911fdd07..afae3a50bee 100644 --- a/mod/assign/classes/output/renderer.php +++ b/mod/assign/classes/output/renderer.php @@ -247,7 +247,9 @@ class renderer extends \plugin_renderer_base { $this->page->set_heading($this->page->course->fullname); $o .= $this->output->header(); - $o .= $this->output->heading($heading); + if (!$this->page->has_secondary_navigation()) { + $o .= $this->output->heading($heading); + } // Show the activity information output component. $modinfo = get_fast_modinfo($header->assign->course); @@ -373,21 +375,6 @@ class renderer extends \plugin_renderer_base { $o .= \html_writer::table($t); $o .= $this->output->box_end(); - // Link to the grading page. - $o .= \html_writer::start_tag('center'); - $o .= $this->output->container_start('submissionlinks'); - $urlparams = array('id' => $summary->coursemoduleid, 'action' => 'grading'); - $url = new \moodle_url('/mod/assign/view.php', $urlparams); - $o .= \html_writer::link($url, get_string('viewgrading', 'mod_assign'), - ['class' => 'btn btn-secondary']); - if ($summary->cangrade) { - $urlparams = array('id' => $summary->coursemoduleid, 'action' => 'grader'); - $url = new \moodle_url('/mod/assign/view.php', $urlparams); - $o .= \html_writer::link($url, get_string('gradeverb'), - ['class' => 'btn btn-primary ml-1']); - } - $o .= $this->output->container_end(); - // Close the container and insert a spacer. $o .= $this->output->container_end(); $o .= \html_writer::end_tag('center'); @@ -716,7 +703,7 @@ class renderer extends \plugin_renderer_base { if (!$status->submissionsenabled) { $cell2content = get_string('noonlinesubmissions', 'assign'); } else { - $cell2content = get_string('noattempt', 'assign'); + $cell2content = get_string('nosubmissionyet', 'assign'); } } } else { @@ -892,65 +879,6 @@ class renderer extends \plugin_renderer_base { $o .= $warningmsg; $o .= \html_writer::table($t); $o .= $this->output->box_end(); - - // Links. - if ($status->view == assign_submission_status::STUDENT_VIEW) { - if ($status->canedit) { - if (!$submission || $submission->status == ASSIGN_SUBMISSION_STATUS_NEW) { - $o .= $this->output->box_start('generalbox submissionaction'); - $urlparams = array('id' => $status->coursemoduleid, 'action' => 'editsubmission'); - $o .= $this->output->single_button(new \moodle_url('/mod/assign/view.php', $urlparams), - get_string('addsubmission', 'assign'), 'get'); - $o .= $this->output->box_start('boxaligncenter submithelp'); - $o .= get_string('addsubmission_help', 'assign'); - $o .= $this->output->box_end(); - $o .= $this->output->box_end(); - } else if ($submission->status == ASSIGN_SUBMISSION_STATUS_REOPENED) { - $o .= $this->output->box_start('generalbox submissionaction'); - $urlparams = array('id' => $status->coursemoduleid, - 'action' => 'editprevioussubmission', - 'sesskey'=>sesskey()); - $o .= $this->output->single_button(new \moodle_url('/mod/assign/view.php', $urlparams), - get_string('addnewattemptfromprevious', 'assign'), 'get'); - $o .= $this->output->box_start('boxaligncenter submithelp'); - $o .= get_string('addnewattemptfromprevious_help', 'assign'); - $o .= $this->output->box_end(); - $o .= $this->output->box_end(); - $o .= $this->output->box_start('generalbox submissionaction'); - $urlparams = array('id' => $status->coursemoduleid, 'action' => 'editsubmission'); - $o .= $this->output->single_button(new \moodle_url('/mod/assign/view.php', $urlparams), - get_string('addnewattempt', 'assign'), 'get'); - $o .= $this->output->box_start('boxaligncenter submithelp'); - $o .= get_string('addnewattempt_help', 'assign'); - $o .= $this->output->box_end(); - $o .= $this->output->box_end(); - } else { - $o .= $this->output->box_start('generalbox submissionaction'); - $urlparams = array('id' => $status->coursemoduleid, 'action' => 'editsubmission'); - $o .= $this->output->single_button(new \moodle_url('/mod/assign/view.php', $urlparams), - get_string('editsubmission', 'assign'), 'get'); - $urlparams = array('id' => $status->coursemoduleid, 'action' => 'removesubmissionconfirm'); - $o .= $this->output->single_button(new \moodle_url('/mod/assign/view.php', $urlparams), - get_string('removesubmission', 'assign'), 'get'); - $o .= $this->output->box_start('boxaligncenter submithelp'); - $o .= get_string('editsubmission_help', 'assign'); - $o .= $this->output->box_end(); - $o .= $this->output->box_end(); - } - } - - if ($status->cansubmit) { - $urlparams = array('id' => $status->coursemoduleid, 'action'=>'submit'); - $o .= $this->output->box_start('generalbox submissionaction'); - $o .= $this->output->single_button(new \moodle_url('/mod/assign/view.php', $urlparams), - get_string('submitassignment', 'assign'), 'get'); - $o .= $this->output->box_start('boxaligncenter submithelp'); - $o .= get_string('submitassignment_help', 'assign'); - $o .= $this->output->box_end(); - $o .= $this->output->box_end(); - } - } - $o .= $this->output->container_end(); return $o; } @@ -1488,4 +1416,47 @@ class renderer extends \plugin_renderer_base { return $this->render_from_template('mod_assign/grading_app', $context); } + /** + * Renders the submission action menu. + * + * @param \mod_assign\output\actionmenu $actionmenu The actionmenu + * @return string Rendered action menu. + */ + public function submission_actionmenu(\mod_assign\output\actionmenu $actionmenu): string { + $context = $actionmenu->export_for_template($this); + return $this->render_from_template('mod_assign/submission_actionmenu', $context); + } + + /** + * Renders the user submission action menu. + * + * @param \mod_assign\output\user_submission_actionmenu $actionmenu The actionmenu + * @return string The rendered action menu. + */ + public function render_user_submission_actionmenu(\mod_assign\output\user_submission_actionmenu $actionmenu): string { + $context = $actionmenu->export_for_template($this); + return $this->render_from_template('mod_assign/user_submission_actionmenu', $context); + } + + /** + * Renders the override action menu. + * + * @param \mod_assign\output\override_actionmenu $actionmenu The actionmenu + * @return string The rendered override action menu. + */ + public function render_override_actionmenu(\mod_assign\output\override_actionmenu $actionmenu): string { + $context = $actionmenu->export_for_template($this); + return $this->render_from_template('mod_assign/override_actionmenu', $context); + } + + /** + * Renders the grading action menu. + * + * @param \mod_assign\output\grading_actionmenu $actionmenu The actionmenu + * @return string The rendered grading action menu. + */ + public function render_grading_actionmenu(\mod_assign\output\grading_actionmenu $actionmenu): string { + $context = $actionmenu->export_for_template($this); + return $this->render_from_template('mod_assign/grading_actionmenu', $context); + } } diff --git a/mod/assign/classes/output/user_submission_actionmenu.php b/mod/assign/classes/output/user_submission_actionmenu.php new file mode 100644 index 00000000000..de09e2247ad --- /dev/null +++ b/mod/assign/classes/output/user_submission_actionmenu.php @@ -0,0 +1,140 @@ +. + +/** + * Output the user submission actionbar for this activity. + * + * @package mod_assign + * @copyright 2021 Adrian Greeve + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace mod_assign\output; + +use templatable; +use renderable; +use moodle_url; +use help_icon; +use single_button; +use stdClass; + +/** + * Output the user submission actionbar for this activity. + * + * @package mod_assign + * @copyright 2021 Adrian Greeve + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class user_submission_actionmenu implements templatable, renderable { + + /** @var int The course module ID. */ + protected $cmid; + /** @var bool Whether to show the submit button. */ + protected $showsubmit; + /** @var bool Whether to show the edit button. */ + protected $showedit; + /** @var stdClass A submission for this activity. */ + protected $submission; + /** @var stdClass A team submission for this activity. */ + protected $teamsubmission; + + /** + * Constructor for this object. + * + * @param int $cmid The course module ID. + * @param bool $showsubmit Whether to show the submit button. + * @param bool $showedit Whether to show the edit button. + * @param stdClass|null $submission A submission for this activity. + * @param stdClass|null $teamsubmission A team submission for this activity. + */ + public function __construct(int $cmid, bool $showsubmit, bool $showedit, stdClass $submission = null, + stdClass $teamsubmission = null) { + + $this->cmid = $cmid; + $this->showsubmit = $showsubmit; + $this->showedit = $showedit; + $this->submission = $submission; + $this->teamsubmission = $teamsubmission; + } + + /** + * Get the submission status. + * + * @return string The status of the submission. + */ + protected function get_current_status(): string { + if (!is_null($this->teamsubmission)) { + return $this->teamsubmission->status; + } else if (!empty((array)$this->submission)) { + return $this->submission->status; + } else { + return ASSIGN_SUBMISSION_STATUS_NEW; + } + } + + /** + * Export the submission buttons for the page. + * + * @param \renderer_base $output renderer base output. + * @return array The data to be rendered. + */ + public function export_for_template(\renderer_base $output): array { + $data = ['edit' => false, 'submit' => false, 'remove' => false, 'previoussubmission' => false]; + if ($this->showedit) { + $url = new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'editsubmission']); + $button = new single_button($url, get_string('editsubmission', 'mod_assign'), 'get'); + $data['edit'] = [ + 'button' => $button->export_for_template($output), + ]; + $status = $this->get_current_status(); + if ($status !== ASSIGN_SUBMISSION_STATUS_NEW && $status !== ASSIGN_SUBMISSION_STATUS_REOPENED) { + $url = new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'removesubmissionconfirm']); + $button = new single_button($url, get_string('removesubmission', 'mod_assign'), 'get'); + $data['remove'] = ['button' => $button->export_for_template($output)]; + } + if ($status === ASSIGN_SUBMISSION_STATUS_REOPENED) { + $params = ['id' => $this->cmid, 'action' => 'editprevioussubmission', 'sesskey' => sesskey()]; + $url = new moodle_url('/mod/assign/view.php', $params); + $button = new single_button($url, get_string('addnewattemptfromprevious', 'mod_assign'), 'get'); + $help = new help_icon('addnewattemptfromprevious', 'mod_assign'); + $data['previoussubmission'] = [ + 'button' => $button->export_for_template($output), + 'help' => $help->export_for_template($output) + ]; + $url = new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'editsubmission']); + $newattemptbutton = new single_button($url, get_string('addnewattempt', 'mod_assign'), 'get'); + $newattempthelp = new help_icon('addnewattempt', 'mod_assign'); + $data['edit']['button'] = $newattemptbutton->export_for_template($output); + $data['edit']['help'] = $newattempthelp->export_for_template($output); + } + if ($status === ASSIGN_SUBMISSION_STATUS_NEW) { + $newattemptbutton = new single_button($url, get_string('addsubmission', 'mod_assign'), 'get'); + $data['edit']['button'] = $newattemptbutton->export_for_template($output); + $data['edit']['help'] = ''; + } + } + if ($this->showsubmit) { + $url = new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'submit']); + $button = new single_button($url, get_string('submitassignment', 'mod_assign'), 'get', true); + $help = new help_icon('submitassignment', 'mod_assign'); + $data['submit'] = [ + 'button' => $button->export_for_template($output), + 'help' => $help->export_for_template($output) + ]; + } + return $data; + } +} diff --git a/mod/assign/feedback/comments/tests/behat/feedback_comments.feature b/mod/assign/feedback/comments/tests/behat/feedback_comments.feature index b370b20524e..c701bfc15d9 100644 --- a/mod/assign/feedback/comments/tests/behat/feedback_comments.feature +++ b/mod/assign/feedback/comments/tests/behat/feedback_comments.feature @@ -26,7 +26,7 @@ Feature: In an assignment, teachers can provide feedback comments on student sub | assign | user | onlinetext | | Test assignment name | student1 | I'm the student1 submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I click on "Quick grading" "checkbox" And I set the field "Feedback comments" to "Feedback from teacher." And I press "Save all quick grading changes" diff --git a/mod/assign/feedback/comments/tests/behat/preserve_changes_on_validation_failure.feature b/mod/assign/feedback/comments/tests/behat/preserve_changes_on_validation_failure.feature index 158f5cddff3..3c39f315b4c 100644 --- a/mod/assign/feedback/comments/tests/behat/preserve_changes_on_validation_failure.feature +++ b/mod/assign/feedback/comments/tests/behat/preserve_changes_on_validation_failure.feature @@ -22,7 +22,7 @@ Feature: Check that any changes to assignment feedback comments are not lost | activity | name | course | assignfeedback_comments_enabled | | assign | Test assignment name | C1 | 1 | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" When I set the following fields to these values: | Grade out of 100 | 101 | diff --git a/mod/assign/feedback/editpdf/tests/behat/annotate_pdf.feature b/mod/assign/feedback/editpdf/tests/behat/annotate_pdf.feature index 8b42008d6d1..8ed63f4f20b 100644 --- a/mod/assign/feedback/editpdf/tests/behat/annotate_pdf.feature +++ b/mod/assign/feedback/editpdf/tests/behat/annotate_pdf.feature @@ -46,7 +46,7 @@ Feature: In an assignment, teacher can annotate PDF files during grading And I log out When I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Submitted for grading" "table_row" Then I should see "Page 1 of 3" And I click on ".navigate-next-button" "css_element" @@ -116,7 +116,7 @@ Feature: In an assignment, teacher can annotate PDF files during grading | file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I open the action menu in "Student 2" "table_row" And I click on "Grade" "link" in the "Student 2" "table_row" And I wait for the complete PDF to load @@ -126,5 +126,5 @@ Feature: In an assignment, teacher can annotate PDF files during grading And I should see "The changes to the grade and feedback were saved" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "View annotated PDF..." in the "student2@example.com" "table_row" diff --git a/mod/assign/feedback/editpdf/tests/behat/comment_popup_menu.feature b/mod/assign/feedback/editpdf/tests/behat/comment_popup_menu.feature index 89735432aa5..88116eeeac2 100644 --- a/mod/assign/feedback/editpdf/tests/behat/comment_popup_menu.feature +++ b/mod/assign/feedback/editpdf/tests/behat/comment_popup_menu.feature @@ -32,7 +32,7 @@ Feature: Ensure that a comment remains visible if its popup menu is open | file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Submitted for grading" "table_row" And I wait for the complete PDF to load diff --git a/mod/assign/feedback/editpdf/tests/behat/group_annotations.feature b/mod/assign/feedback/editpdf/tests/behat/group_annotations.feature index bdb93f8de09..8a480795263 100644 --- a/mod/assign/feedback/editpdf/tests/behat/group_annotations.feature +++ b/mod/assign/feedback/editpdf/tests/behat/group_annotations.feature @@ -42,7 +42,7 @@ Feature: In a group assignment, teacher can annotate PDF files for all users | file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Submitted for grading" "table_row" And I wait for the complete PDF to load And I click on ".navigate-next-button" "css_element" diff --git a/mod/assign/feedback/editpdf/tests/behat/view_previous_annotations.feature b/mod/assign/feedback/editpdf/tests/behat/view_previous_annotations.feature index 63e3dbe4291..e51a94c2c6e 100644 --- a/mod/assign/feedback/editpdf/tests/behat/view_previous_annotations.feature +++ b/mod/assign/feedback/editpdf/tests/behat/view_previous_annotations.feature @@ -35,7 +35,7 @@ Feature: In an assignment, teacher can view the feedback for a previous attempt. | file | mod/assign/feedback/editpdf/tests/fixtures/submission.pdf, mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf | When I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Submitted for grading" "table_row" Then I should see "Page 1 of 3" And I click on ".navigate-next-button" "css_element" diff --git a/mod/assign/lang/en/assign.php b/mod/assign/lang/en/assign.php index 0847b6b6df1..a23b4a614ad 100644 --- a/mod/assign/lang/en/assign.php +++ b/mod/assign/lang/en/assign.php @@ -95,6 +95,7 @@ $string['attemptreopenmethod_manual'] = 'Manually'; $string['attemptreopenmethod_none'] = 'Never'; $string['attemptreopenmethod_untilpass'] = 'Automatically until pass'; $string['availability'] = 'Availability'; +$string['back'] = 'Back'; $string['backtoassignment'] = 'Back to assignment'; $string['batchoperationsdescription'] = 'With selected...'; $string['batchoperationconfirmlock'] = 'Lock all selected submissions?'; @@ -382,6 +383,7 @@ $string['noopen'] = 'No open date'; $string['nooverridedata'] = 'You must override at least one of the assignment settings.'; $string['nosavebutnext'] = 'Next'; $string['nosubmission'] = 'Nothing has been submitted for this assignment'; +$string['nosubmissionyet'] = 'No submissions have been made yet'; $string['noteam'] = 'Not a member of any group'; $string['noteam_desc'] = 'This assignment requires submission in groups. You are not a member of any group, so you cannot create a submission. Please contact your teacher to be added to a group.'; $string['noteamgrader'] = 'Not a member of any group, so unable to make submissions.'; diff --git a/mod/assign/lib.php b/mod/assign/lib.php index 79d3ba9ab56..5f03baf6db5 100644 --- a/mod/assign/lib.php +++ b/mod/assign/lib.php @@ -432,13 +432,9 @@ function assign_extend_settings_navigation(settings_navigation $settings, naviga if (has_capability('mod/assign:manageoverrides', $PAGE->cm->context)) { $url = new moodle_url('/mod/assign/overrides.php', array('cmid' => $PAGE->cm->id)); - $node = navigation_node::create(get_string('groupoverrides', 'assign'), - new moodle_url($url, array('mode' => 'group')), - navigation_node::TYPE_SETTING, null, 'mod_assign_groupoverrides'); - $navref->add_node($node, $beforekey); - $node = navigation_node::create(get_string('useroverrides', 'assign'), - new moodle_url($url, array('mode' => 'user')), + $node = navigation_node::create(get_string('overrides', 'assign'), + $url, navigation_node::TYPE_SETTING, null, 'mod_assign_useroverrides'); $navref->add_node($node, $beforekey); } @@ -449,15 +445,7 @@ function assign_extend_settings_navigation(settings_navigation $settings, naviga $link = new moodle_url('/grade/report/grader/index.php', array('id' => $course->id)); $linkname = get_string('viewgradebook', 'assign'); $node = $navref->add($linkname, $link, navigation_node::TYPE_SETTING); - } - - // Link to download all submissions. - if (has_any_capability(array('mod/assign:grade', 'mod/assign:viewgrades'), $context)) { - $link = new moodle_url('/mod/assign/view.php', array('id' => $cm->id, 'action'=>'grading')); - $node = $navref->add(get_string('viewgrading', 'assign'), $link, navigation_node::TYPE_SETTING); - - $link = new moodle_url('/mod/assign/view.php', array('id' => $cm->id, 'action'=>'downloadall')); - $node = $navref->add(get_string('downloadall', 'assign'), $link, navigation_node::TYPE_SETTING); + $node->set_force_into_more_menu(true); } if (has_capability('mod/assign:revealidentities', $context)) { diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index ba225ec221f..8f9046a1b2c 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -4569,7 +4569,9 @@ class assign { $gradingoptionsdata->workflowfilter = $workflowfilter; $gradingoptionsform->set_data($gradingoptionsdata); - $actionformtext = $this->get_renderer()->render($gradingactions); + $buttons = new \mod_assign\output\grading_actionmenu($this->get_course_module()->id); + $actionformtext = $this->get_renderer()->render($buttons); + $actionformtext .= $this->get_renderer()->render($gradingactions); $currenturl = new moodle_url('/mod/assign/view.php', ['id' => $this->get_course_module()->id, 'action' => 'grading']); @@ -5802,6 +5804,9 @@ class assign { } if ($this->can_view_grades()) { + $actionbuttons = new \mod_assign\output\actionmenu($this->get_course_module()->id); + $o .= $this->get_renderer()->submission_actionmenu($actionbuttons); + // Group selector will only be displayed if necessary. $currenturl = new moodle_url('/mod/assign/view.php', array('id' => $this->get_course_module()->id)); $o .= groups_print_activity_menu($this->get_course_module(), $currenturl->out(), true); @@ -5809,10 +5814,9 @@ class assign { $summary = $this->get_assign_grading_summary_renderable(); $o .= $this->get_renderer()->render($summary); } - $grade = $this->get_user_grade($USER->id, false); - $submission = $this->get_user_submission($USER->id, false); if ($this->can_view_submission($USER->id)) { + $o .= $this->view_submission_action_bar($instance, $USER); $o .= $this->view_student_summary($USER, true); } @@ -5823,6 +5827,44 @@ class assign { return $o; } + /** + * The action bar displayed in the submissions page. + * + * @param stdClass $instance The settings for the current instance of this assignment + * @param stdClass $user The user to print the action bar for + * @return string + */ + public function view_submission_action_bar(stdClass $instance, stdClass $user): string { + $submission = $this->get_user_submission($user->id, false); + // Figure out if we are team or solitary submission. + $teamsubmission = null; + if ($instance->teamsubmission) { + $teamsubmission = $this->get_group_submission($user->id, 0, false); + } + + $showsubmit = ($this->submissions_open($user->id) + && $this->show_submit_button($submission, $teamsubmission, $user->id)); + $showedit = ($this->is_any_submission_plugin_enabled()) && $this->can_edit_submission($user->id); + + // The method get_group_submission() says that it returns a stdClass, but it can return false >_>. + if ($teamsubmission === false) { + $teamsubmission = new stdClass(); + } + // Same goes for get_user_submission(). + if ($submission === false) { + $submission = new stdClass(); + } + $actionbuttons = new \mod_assign\output\user_submission_actionmenu( + $this->get_course_module()->id, + $showsubmit, + $showedit, + $submission, + $teamsubmission + ); + + return $this->get_renderer()->render($actionbuttons); + } + /** * Convert the final raw grade(s) in the grading table for the gradebook. * diff --git a/mod/assign/overrides.php b/mod/assign/overrides.php index 936cf3b00db..d239947c1c2 100644 --- a/mod/assign/overrides.php +++ b/mod/assign/overrides.php @@ -66,6 +66,7 @@ $groupmode = ($mode == "group"); $url = new moodle_url('/mod/assign/overrides.php', array('cmid' => $cm->id, 'mode' => $mode)); $PAGE->set_url($url); +navigation_node::override_active_url(new moodle_url('/mod/assign/overrides.php', ['cmid' => $cmid])); if ($action == 'movegroupoverride') { $id = required_param('id', PARAM_INT); @@ -82,7 +83,12 @@ $PAGE->set_pagelayout('admin'); $PAGE->set_title(get_string('overrides', 'assign')); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); -echo $OUTPUT->heading(format_string($assign->name, true, array('context' => $context))); +if (!$PAGE->has_secondary_navigation()) { + echo $OUTPUT->heading(format_string($assign->name, true, array('context' => $context))); +} +$overridemenu = new \mod_assign\output\override_actionmenu($url, $cm); +$renderer = $PAGE->get_renderer('mod_assign'); +echo $renderer->render($overridemenu); // Delete orphaned group overrides. $sql = 'SELECT o.id @@ -296,9 +302,6 @@ if ($groupmode) { echo $OUTPUT->notification(get_string('groupsnone', 'assign'), 'error'); $options['disabled'] = true; } - echo $OUTPUT->single_button($overrideediturl->out(true, - array('action' => 'addgroup', 'cmid' => $cm->id)), - get_string('addnewgroupoverride', 'assign'), 'post', $options); } else { $users = array(); // See if there are any users in the assign. @@ -329,9 +332,6 @@ if ($groupmode) { echo $OUTPUT->notification($nousermessage, 'error'); $options['disabled'] = true; } - echo $OUTPUT->single_button($overrideediturl->out(true, - array('action' => 'adduser', 'cmid' => $cm->id)), - get_string('addnewuseroverride', 'assign'), 'get', $options); } echo html_writer::end_tag('div'); echo html_writer::end_tag('div'); diff --git a/mod/assign/templates/grading_actionmenu.mustache b/mod/assign/templates/grading_actionmenu.mustache new file mode 100644 index 00000000000..fe77a9ffd0d --- /dev/null +++ b/mod/assign/templates/grading_actionmenu.mustache @@ -0,0 +1,44 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template mod_assign/grading_actionmenu + + Actions panel for the assignment grading UI. + + Classes required for JS: + * none + + Context variables required for this template: + * see mod/lesson/classes/output/grading_actionmenu.php + + Example context (json): + { + "back": "https://moodle.org", + "downloadall": "https://moodle.org" + } + +}} + diff --git a/mod/assign/templates/override_actionmenu.mustache b/mod/assign/templates/override_actionmenu.mustache new file mode 100644 index 00000000000..6730ea78ee8 --- /dev/null +++ b/mod/assign/templates/override_actionmenu.mustache @@ -0,0 +1,94 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template mod_assign/override_actionmenu + + Override select menu for users and groups. + + Classes required for JS: + * none + + Context variables required for this template: + * see mod/lesson/classes/output/override_actionmenu.php + + Example context (json): + { + "urlselect": { + "id": "url_select_test", + "action": "https://example.com/post", + "formid": "url_select_form", + "sesskey": "sesskey", + "label": "core/url_select", + "helpicon": { + "title": "Help with something", + "text": "Help with something", + "url": "http://example.org/help", + "linktext": "", + "icon": { + "extraclasses": "iconhelp", + "attributes": [ + {"name": "src", "value": "../../../pix/help.svg"}, + {"name": "alt", "value": "Help icon"} + ] + } + }, + "showbutton": "Go", + "options": [{ + "name": "Group 1", "isgroup": true, "options": + [ + {"name": "Item 1", "isgroup": false, "value": "1"}, + {"name": "Item 2", "isgroup": false, "value": "2"} + ]}, + {"name": "Group 2", "isgroup": true, "options": + [ + {"name": "Item 3", "isgroup": false, "value": "3"}, + {"name": "Item 4", "isgroup": false, "value": "4"} + ]}], + "disabled": false, + "title": "Some cool title" + }, + "addoverride": { + "method" : "get", + "url" : "#", + "formid": "1", + "primary" : true, + "tooltip" : "This is a tooltip", + "label" : "This is a the button text", + "attributes": [ + { + "name": "data-attribute", + "value": "yeah" + } + ] + } + } + +}} +
+
+
+ {{#urlselect}} + {{>core/url_select}} + {{/urlselect}} +
+
+ {{#addoverride}} + {{>core/single_button}} + {{/addoverride}} +
+
+
diff --git a/mod/assign/templates/submission_actionmenu.mustache b/mod/assign/templates/submission_actionmenu.mustache new file mode 100644 index 00000000000..532a3377c97 --- /dev/null +++ b/mod/assign/templates/submission_actionmenu.mustache @@ -0,0 +1,44 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template mod_assign/submission_actionmenu + + Actions for grading submissions in the assignment. + + Classes required for JS: + * none + + Context variables required for this template: + * see mod/assign/classes/output/actionmenu.php + + Example context (json): + { + "submissionlink": "https://moodle.org", + "gradelink": "https://moodle.org" + } + +}} + diff --git a/mod/assign/templates/user_submission_actionmenu.mustache b/mod/assign/templates/user_submission_actionmenu.mustache new file mode 100644 index 00000000000..28e5d6df6e9 --- /dev/null +++ b/mod/assign/templates/user_submission_actionmenu.mustache @@ -0,0 +1,185 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template mod_assign/user_submission_actionmenu + + Actions for editing and submitting assignments. + + Classes required for JS: + * none + + Context variables required for this template: + * see mod/assign/classes/output/user_submission_actionmenu.php + + Example context (json): + { + "submit": { + "button": { + "method" : "get", + "url" : "#", + "formid": "submit_button_1", + "primary" : true, + "tooltip" : "Submit tooltip", + "label" : "Submit", + "attributes": [ + { + "name": "data-attribute", + "value": "yeah" + } + ] + }, + "help": { + "title": "Help with something", + "url": "http://example.org/help", + "linktext": "", + "icon":{ + "attributes": [ + {"name": "class", "value": "iconhelp"}, + {"name": "src", "value": "../../../pix/help.svg"}, + {"name": "alt", "value": "Help icon"} + ] + } + } + }, + "previoussubmission": { + "button": { + "method" : "get", + "url" : "#", + "formid": "previous_button_2", + "primary" : true, + "tooltip" : "Submit tooltip", + "label" : "Previous submission", + "attributes": [ + { + "name": "data-attribute", + "value": "yeah" + } + ] + }, + "help": { + "title": "Help with something", + "url": "http://example.org/help", + "linktext": "", + "icon":{ + "attributes": [ + {"name": "class", "value": "iconhelp"}, + {"name": "src", "value": "../../../pix/help.svg"}, + {"name": "alt", "value": "Help icon"} + ] + } + } + }, + "edit": { + "button": { + "method" : "get", + "url" : "#", + "formid": "edit_button_3", + "primary" : true, + "tooltip" : "Submit tooltip", + "label" : "Edit", + "attributes": [ + { + "name": "data-attribute", + "value": "yeah" + } + ] + }, + "help": { + "title": "Help with something", + "url": "http://example.org/help", + "linktext": "", + "icon":{ + "attributes": [ + {"name": "class", "value": "iconhelp"}, + {"name": "src", "value": "../../../pix/help.svg"}, + {"name": "alt", "value": "Help icon"} + ] + } + } + }, + "remove": { + "button": { + "method" : "get", + "url" : "#", + "formid": "remove_button_4", + "primary" : true, + "tooltip" : "Submit tooltip", + "label" : "Remove", + "attributes": [ + { + "name": "data-attribute", + "value": "yeah" + } + ] + }, + "help": { + "title": "Help with something", + "url": "http://example.org/help", + "linktext": "", + "icon":{ + "attributes": [ + {"name": "class", "value": "iconhelp"}, + {"name": "src", "value": "../../../pix/help.svg"}, + {"name": "alt", "value": "Help icon"} + ] + } + } + } + } + +}} +
+
+ {{#submit}} +
+ {{#button}} + {{>core/single_button}} + {{/button}} + {{#help}} + {{>core/help_icon}} + {{/help}} +
+ {{/submit}} + {{#previoussubmission}} +
+ {{#button}} + {{>core/single_button}} + {{/button}} + {{#help}} + {{>core/help_icon}} + {{/help}} +
+ {{/previoussubmission}} + {{#edit}} +
+ {{#button}} + {{>core/single_button}} + {{/button}} + {{#help}} + {{>core/help_icon}} + {{/help}} +
+ {{/edit}} + {{#remove}} +
+ {{#button}} + {{>core/single_button}} + {{/button}} +
+ {{/remove}} +
+
diff --git a/mod/assign/tests/behat/allow_another_attempt.feature b/mod/assign/tests/behat/allow_another_attempt.feature index ed00fc5259a..6d243449ebc 100644 --- a/mod/assign/tests/behat/allow_another_attempt.feature +++ b/mod/assign/tests/behat/allow_another_attempt.feature @@ -32,7 +32,7 @@ Feature: In an assignment, students start a new attempt based on their previous | Test assignment name | student1 | I'm the student first submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the following fields to these values: | Allow another attempt | 1 | @@ -47,7 +47,7 @@ Feature: In an assignment, students start a new attempt based on their previous And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I should see "I'm the student first submission" @@ -98,7 +98,7 @@ Feature: In an assignment, students start a new attempt based on their previous | Test assignment name | student1 | I'm the student first submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading" And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading" And "Student 3" row "Status" column of "generaltable" table should contain "No submission" @@ -124,7 +124,7 @@ Feature: In an assignment, students start a new attempt based on their previous And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And "Student 1" row "Status" column of "generaltable" table should contain "Reopened" And "Student 2" row "Status" column of "generaltable" table should contain "Reopened" And "Student 3" row "Status" column of "generaltable" table should contain "Submitted for grading" diff --git a/mod/assign/tests/behat/assign_activity_completion.feature b/mod/assign/tests/behat/assign_activity_completion.feature index d95929b15f1..099ad809bba 100644 --- a/mod/assign/tests/behat/assign_activity_completion.feature +++ b/mod/assign/tests/behat/assign_activity_completion.feature @@ -112,7 +112,7 @@ Feature: View activity completion in the assignment activity And the "Receive a grade" completion condition of "Music history" is displayed as "todo" And I log out And I am on the "Music history" "assign activity" page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Vinnie Student1" "table_row" And I set the field "Grade out of 100" to "33" And I set the field "Notify students" to "0" diff --git a/mod/assign/tests/behat/assign_course_reset.feature b/mod/assign/tests/behat/assign_course_reset.feature index 02a3ae744df..10d2e7897c3 100644 --- a/mod/assign/tests/behat/assign_course_reset.feature +++ b/mod/assign/tests/behat/assign_course_reset.feature @@ -44,7 +44,7 @@ Feature: Assign reset And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Submitted for grading" And I am on "Course 1" course homepage When I navigate to "Reset" in current page administration @@ -53,13 +53,13 @@ Feature: Assign reset And I press "Reset course" And I press "Continue" And I am on the "Test assignment name" Activity page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should not see "Submitted for grading" @javascript Scenario: Use course reset to remove user overrides. And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "User overrides" in current page administration + And I navigate to "Overrides" in current page administration And I press "Add user override" And I set the following fields to these values: | Override user | Student1 | @@ -79,12 +79,13 @@ Feature: Assign reset And I press "Continue" And I am on "Course 1" course homepage And I click on "Test assignment name" "link" in the "region-main" "region" - And I navigate to "User overrides" in current page administration + And I navigate to "Overrides" in current page administration Then I should not see "Sam1 Student1" Scenario: Use course reset to remove group overrides. When I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "Group overrides" in current page administration + And I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect And I press "Add group override" And I set the following fields to these values: | Override group | Group 1 | @@ -103,7 +104,8 @@ Feature: Assign reset And I press "Reset course" And I press "Continue" And I am on the "Test assignment name" Activity page - And I navigate to "Group overrides" in current page administration + And I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect Then I should not see "Group 1" Scenario: Use course reset to reset blind marking assignment. @@ -113,7 +115,7 @@ Feature: Assign reset | blindmarking | 1 | And I press "Save" When I am on the "Test assignment name" Activity page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I select "Reveal student identities" from the "Grading action" singleselect And I press "Continue" And I should see "Sam1 Student1" @@ -124,5 +126,5 @@ Feature: Assign reset And I press "Reset course" And I press "Continue" And I am on the "Test assignment name" Activity page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should not see "Sam1 Student1" diff --git a/mod/assign/tests/behat/assign_group_override.feature b/mod/assign/tests/behat/assign_group_override.feature index 2f0c10020a4..8bce7188733 100644 --- a/mod/assign/tests/behat/assign_group_override.feature +++ b/mod/assign/tests/behat/assign_group_override.feature @@ -35,7 +35,8 @@ Feature: Assign group override Scenario: Add, modify then delete a group override Given I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "Group overrides" in current page administration + When I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect And I press "Add group override" And I set the following fields to these values: | Override group | Group 1 | @@ -53,7 +54,8 @@ Feature: Assign group override Scenario: Duplicate a user override Given I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "Group overrides" in current page administration + When I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect And I press "Add group override" And I set the following fields to these values: | Override group | Group 1 | @@ -76,7 +78,8 @@ Feature: Assign group override | Due date | ##1 Jan 2000 08:00## | | Cut-off date | disabled | And I press "Save and display" - And I navigate to "Group overrides" in current page administration + And I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect And I press "Add group override" And I set the following fields to these values: | Override group | Group 1 | @@ -98,7 +101,8 @@ Feature: Assign group override | Allow submissions from | disabled | | Cut-off date | ##1 Jan 2000 08:00## | And I press "Save and display" - And I navigate to "Group overrides" in current page administration + And I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect And I press "Add group override" And I set the following fields to these values: | Override group | Group 1 | @@ -110,7 +114,7 @@ Feature: Assign group override Then I should not see "You have not made a submission yet." And I log out And I am on the "Test assignment name" Activity page logged in as student1 - And I should see "You have not made a submission yet." + And I should see "No submissions have been made yet" Scenario: Allow a group to have a different start date Given I am on the "Test assignment name" Activity page logged in as teacher1 @@ -120,7 +124,8 @@ Feature: Assign group override | Allow submissions from | ##1 January 2030 08:00## | | Cut-off date | disabled | And I press "Save and display" - And I navigate to "Group overrides" in current page administration + And I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect And I press "Add group override" And I set the following fields to these values: | Override group | Group 1 | @@ -143,8 +148,10 @@ Feature: Assign group override | Due date | disabled | | Allow submissions from | ##1 January 2040 08:00## | | Cut-off date | disabled | + | Group mode | Visible groups | And I press "Save and display" - And I navigate to "Group overrides" in current page administration + And I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect And I press "Add group override" And I set the following fields to these values: | Override group | Group 1 | @@ -152,7 +159,7 @@ Feature: Assign group override And I press "Save" And I should see "Tuesday, 1 January 2030, 8:00" And I am on the "Test assignment name" Activity page - And I navigate to "User overrides" in current page administration + And I navigate to "Overrides" in current page administration And I press "Add user override" And I set the following fields to these values: | Override user | Student1 | @@ -177,7 +184,8 @@ Feature: Assign group override | activity | name | intro | course | groupmode | | assign | Assignment 2 | Assignment 2 description | C1 | 1 | And I am on the "Assignment 2" Activity page logged in as teacher1 - When I navigate to "Group overrides" in current page administration + When I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect Then I should see "No groups you can access." And the "Add group override" "button" should be disabled @@ -193,7 +201,8 @@ Feature: Assign group override | user | group | | teacher1 | G1 | And I am on the "Assignment 2" Activity page logged in as teacher1 - When I navigate to "Group overrides" in current page administration + When I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect And I press "Add group override" Then the "Override group" select box should contain "Group 1" And the "Override group" select box should not contain "Group 2" @@ -210,7 +219,8 @@ Feature: Assign group override | user | group | | teacher1 | G1 | And I am on the "Assignment 2" Activity page logged in as admin - And I navigate to "Group overrides" in current page administration + And I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect And I press "Add group override" And I set the following fields to these values: | Override group | Group 1 | @@ -223,6 +233,7 @@ Feature: Assign group override And I log out When I am on the "Assignment 2" Activity page logged in as teacher1 - And I navigate to "Group overrides" in current page administration + And I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect Then I should see "Group 1" in the ".generaltable" "css_element" And I should not see "Group 2" in the ".generaltable" "css_element" diff --git a/mod/assign/tests/behat/assign_user_override.feature b/mod/assign/tests/behat/assign_user_override.feature index 99cbb590997..ac98964a963 100644 --- a/mod/assign/tests/behat/assign_user_override.feature +++ b/mod/assign/tests/behat/assign_user_override.feature @@ -25,7 +25,7 @@ Feature: Assign user override @javascript Scenario: Add, modify then delete a user override Given I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "User overrides" in current page administration + When I navigate to "Overrides" in current page administration And I press "Add user override" And I set the following fields to these values: | Override user | Student1 | @@ -44,7 +44,7 @@ Feature: Assign user override @javascript Scenario: Duplicate a user override Given I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "User overrides" in current page administration + When I navigate to "Overrides" in current page administration And I press "Add user override" And I set the following fields to these values: | Override user | Student1 | @@ -68,7 +68,7 @@ Feature: Assign user override | Due date | ##1 Jan 2000 08:00## | | Cut-off date | disabled | And I press "Save and display" - And I navigate to "User overrides" in current page administration + And I navigate to "Overrides" in current page administration And I press "Add user override" And I set the following fields to these values: | Override user | Student1 | @@ -91,7 +91,7 @@ Feature: Assign user override | Allow submissions from | disabled | | Cut-off date | ##1 Jan 2000 08:00## | And I press "Save and display" - And I navigate to "User overrides" in current page administration + And I navigate to "Overrides" in current page administration And I press "Add user override" And I set the following fields to these values: | Override user | Student1 | @@ -100,10 +100,10 @@ Feature: Assign user override And I should see "Tuesday, 1 January 2030, 8:00" And I log out And I am on the "Test assignment name" Activity page logged in as student2 - Then I should not see "You have not made a submission yet." + Then I should not see "Add submission" And I log out And I am on the "Test assignment name" Activity page logged in as student1 - And I should see "You have not made a submission yet." + And I should see "Add submission" @javascript Scenario: Allow a user to have a different start date @@ -114,7 +114,7 @@ Feature: Assign user override | Allow submissions from | ##1 January 2030 08:00## | | Cut-off date | disabled | And I press "Save and display" - And I navigate to "User overrides" in current page administration + And I navigate to "Overrides" in current page administration And I press "Add user override" And I set the following fields to these values: | Override user | Student1 | @@ -140,7 +140,7 @@ Feature: Assign user override | activity | name | intro | course | groupmode | | assign | Assignment 2 | Assignment 2 description | C1 | 1 | And I am on the "Assignment 2" Activity page logged in as teacher1 - When I navigate to "User overrides" in current page administration + When I navigate to "Overrides" in current page administration Then I should see "No groups you can access." And the "Add user override" "button" should be disabled @@ -162,7 +162,7 @@ Feature: Assign user override | student1 | G1 | | student2 | G2 | And I am on the "Assignment 2" Activity page logged in as teacher1 - When I navigate to "User overrides" in current page administration + When I navigate to "Overrides" in current page administration And I press "Add user override" Then the "Override user" select box should contain "Sam1 Student1, student1@example.com" And the "Override user" select box should not contain "Sam2 Student2, student2@example.com" @@ -186,7 +186,7 @@ Feature: Assign user override | student1 | G1 | | student2 | G2 | And I am on the "Assignment 2" Activity page logged in as admin - And I navigate to "User overrides" in current page administration + And I navigate to "Overrides" in current page administration And I press "Add user override" And I set the following fields to these values: | Override user | Student1 | @@ -199,7 +199,7 @@ Feature: Assign user override And I log out And I am on the "Assignment 2" Activity page logged in as teacher1 - When I navigate to "User overrides" in current page administration + When I navigate to "Overrides" in current page administration Then I should see "Student1" in the ".generaltable" "css_element" But I should not see "Student2" in the ".generaltable" "css_element" @@ -210,7 +210,7 @@ Feature: Assign user override And I expand all fieldsets And I set the field "Availability" to "Hide from students" And I click on "Save and display" "button" - When I navigate to "User overrides" in current page administration + When I navigate to "Overrides" in current page administration And I press "Add user override" And I set the following fields to these values: | Override user | Student1 | diff --git a/mod/assign/tests/behat/bulk_release_anon_submissions.feature b/mod/assign/tests/behat/bulk_release_anon_submissions.feature index 1bdfa0b595d..4bda24e7c05 100644 --- a/mod/assign/tests/behat/bulk_release_anon_submissions.feature +++ b/mod/assign/tests/behat/bulk_release_anon_submissions.feature @@ -51,7 +51,7 @@ Feature: Bulk released grades should not be sent to gradebook while submissions And I log out # Mark the submissions. And I am on the "Test assignment name" "assign activity" page logged in as "teacher1" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should see "Not marked" in the "I'm student1's submission" "table_row" And I click on "Grade" "link" in the "I'm student1's submission" "table_row" And I set the field "Grade out of 100" to "50" @@ -60,7 +60,7 @@ Feature: Bulk released grades should not be sent to gradebook while submissions And I set the field "Notify students" to "0" And I press "Save changes" And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should see "Not marked" in the "I'm student2's submission" "table_row" And I click on "Grade" "link" in the "I'm student2's submission" "table_row" And I set the field "Grade out of 100" to "50" @@ -69,7 +69,7 @@ Feature: Bulk released grades should not be sent to gradebook while submissions And I set the field "Notify students" to "0" And I press "Save changes" And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should see "In review" in the "I'm student1's submission" "table_row" And I should see "In review" in the "I'm student2's submission" "table_row" @@ -84,7 +84,7 @@ Feature: Bulk released grades should not be sent to gradebook while submissions And I set the field "Notify students" to "No" And I press "Save changes" And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should see "Released" in the "I'm student1's submission" "table_row" And I should see "Released" in the "I'm student2's submission" "table_row" And I log out @@ -101,7 +101,7 @@ Feature: Bulk released grades should not be sent to gradebook while submissions And I should not see "Great job!" And I log out And I am on the "Test assignment name" "assign activity" page logged in as "teacher1" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I set the field "Grading action" to "Reveal student identities" And I press "Continue" Then I should see "Released" in the "Student 1" "table_row" @@ -132,7 +132,7 @@ Feature: Bulk released grades should not be sent to gradebook while submissions And I set the field "Notify students" to "No" And I press "Save changes" And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should see "Released" in the "Student 1" "table_row" And I should see "Released" in the "Student 2" "table_row" And I log out diff --git a/mod/assign/tests/behat/bulk_remove_submissions.feature b/mod/assign/tests/behat/bulk_remove_submissions.feature index 76a09b95420..98e789a4c5b 100644 --- a/mod/assign/tests/behat/bulk_remove_submissions.feature +++ b/mod/assign/tests/behat/bulk_remove_submissions.feature @@ -42,7 +42,7 @@ Feature: Bulk remove submissions And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "I'm the student1 submission" And I should see "I'm the student2 submission" And I set the field "selectall" to "1" @@ -75,7 +75,7 @@ Feature: Bulk remove submissions | Test assignment name | student2 | I'm the student2 submission | When I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "I'm the student1 submission" And I should see "I'm the student2 submission" And I set the field "selectall" to "1" @@ -104,7 +104,7 @@ Feature: Bulk remove submissions And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "I'm the student1 submission" And I should see "I'm the student2 submission" And I set the field "selectall" to "1" @@ -142,7 +142,7 @@ Feature: Bulk remove submissions And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "I'm the student1 submission" And I should see "I'm the student2 submission" And I set the field "selectall" to "1" diff --git a/mod/assign/tests/behat/comment_inline.feature b/mod/assign/tests/behat/comment_inline.feature index 8166658a8e3..eefea929367 100644 --- a/mod/assign/tests/behat/comment_inline.feature +++ b/mod/assign/tests/behat/comment_inline.feature @@ -32,7 +32,7 @@ Feature: In an assignment, teachers can edit a students submission inline | Test assignment name | student1 | I'm the student first submission | When I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the following fields to these values: | Grade out of 100 | 50 | @@ -41,7 +41,7 @@ Feature: In an assignment, teachers can edit a students submission inline And I press "Save changes" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should see "50.00" in the "Student 1" "table_row" And I should see "Submitted for grading" in the "Student 1" "table_row" And I should see "Graded" in the "Student 1" "table_row" diff --git a/mod/assign/tests/behat/display_error_message_onbadformat.feature b/mod/assign/tests/behat/display_error_message_onbadformat.feature index 92d54c0dbd8..55a265d2e66 100644 --- a/mod/assign/tests/behat/display_error_message_onbadformat.feature +++ b/mod/assign/tests/behat/display_error_message_onbadformat.feature @@ -28,7 +28,7 @@ Feature: Check that the assignment grade can not be input in a wrong format. | markingworkflow | 1 | | submissiondrafts | 0 | When I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade out of 100" to "50,,6" And I press "Save changes" @@ -58,7 +58,7 @@ Feature: Check that the assignment grade can not be input in a wrong format. | markingworkflow | 1 | | submissiondrafts | 0 | When I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade out of 100" to "50..6" And I press "Save changes" diff --git a/mod/assign/tests/behat/display_grade.feature b/mod/assign/tests/behat/display_grade.feature index e118ebe34ee..24a5666884b 100644 --- a/mod/assign/tests/behat/display_grade.feature +++ b/mod/assign/tests/behat/display_grade.feature @@ -28,14 +28,14 @@ Feature: Check that the assignment grade can be updated correctly | markingworkflow | 1 | | submissiondrafts | 0 | And I am on the "Test assignment name" Activity page logged in as teacher1 - Then I navigate to "View all submissions" in current page administration + Then I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade out of 100" to "50" And I set the field "Notify students" to "0" And I press "Save changes" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And "Student 1" row "Grade" column of "generaltable" table should contain "50.00" @javascript @@ -64,12 +64,12 @@ Feature: Check that the assignment grade can be updated correctly | teamsubmission | 1 | | groupmode | 0 | And I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade out of 100" to "50" And I set the field "Notify students" to "0" And I press "Save changes" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then "Student 1" row "Grade" column of "generaltable" table should contain "50.00" diff --git a/mod/assign/tests/behat/edit_previous_feedback.feature b/mod/assign/tests/behat/edit_previous_feedback.feature index 087c47286e0..22c91280439 100644 --- a/mod/assign/tests/behat/edit_previous_feedback.feature +++ b/mod/assign/tests/behat/edit_previous_feedback.feature @@ -32,7 +32,7 @@ Feature: In an assignment, teachers can edit feedback for a students previous su | assign | user | onlinetext | | Test assignment name | student2 | I'm the student first submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 2" "table_row" And I set the following fields to these values: | Grade | 49 | @@ -47,7 +47,7 @@ Feature: In an assignment, teachers can edit feedback for a students previous su And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 2" "table_row" And I click on "View a different attempt" "link" And I click on "Attempt 1" "radio" in the "View a different attempt" "dialogue" diff --git a/mod/assign/tests/behat/edit_student_submission.feature b/mod/assign/tests/behat/edit_student_submission.feature index 23816ee937d..3dd78dcd990 100644 --- a/mod/assign/tests/behat/edit_student_submission.feature +++ b/mod/assign/tests/behat/edit_student_submission.feature @@ -26,7 +26,7 @@ Feature: In an assignment, the administrator can edit students' submissions | Test assignment name | student1 | I'm the student1 submission | And I am on the "Test assignment name" Activity page logged in as admin - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I open the action menu in "Student 1" "table_row" And I choose "Edit submission" in the open action menu And I set the following fields to these values: diff --git a/mod/assign/tests/behat/filter_by_marker.feature b/mod/assign/tests/behat/filter_by_marker.feature index 8bbad795e8d..23a11598c4a 100644 --- a/mod/assign/tests/behat/filter_by_marker.feature +++ b/mod/assign/tests/behat/filter_by_marker.feature @@ -32,7 +32,7 @@ Feature: In an assignment, teachers can filter displayed submissions by assigned | markingworkflow | 1 | | markingallocation | 1 | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "allocatedmarker" to "Marker 1" And I set the field "Notify students" to "0" @@ -40,7 +40,7 @@ Feature: In an assignment, teachers can filter displayed submissions by assigned And I click on "Edit settings" "link" When I am on the "Test assignment name" Activity page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I set the field "markerfilter" to "Marker 1" Then I should see "Student 1" And I should not see "Student 2" diff --git a/mod/assign/tests/behat/filter_drafts.feature b/mod/assign/tests/behat/filter_drafts.feature index d5db665f772..53a111d4e19 100644 --- a/mod/assign/tests/behat/filter_drafts.feature +++ b/mod/assign/tests/behat/filter_drafts.feature @@ -42,7 +42,7 @@ Feature: In an assignment, teachers can filter displayed submissions and see dra @javascript Scenario: View assignments with draft status on the view all submissions page Given I am on the "Test assignment" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" When I set the field "Filter" to "Draft" Then I should see "Student 2" And I should not see "Student 1" @@ -51,7 +51,7 @@ Feature: In an assignment, teachers can filter displayed submissions and see dra @javascript Scenario: View assignments with draft status in the grader Given I am on the "Test assignment" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" When I click on "[data-region=user-filters]" "css_element" And I set the field "filter" to "Draft" diff --git a/mod/assign/tests/behat/grading_app_filters.feature b/mod/assign/tests/behat/grading_app_filters.feature index a0f93283f55..5f77eb2b16a 100644 --- a/mod/assign/tests/behat/grading_app_filters.feature +++ b/mod/assign/tests/behat/grading_app_filters.feature @@ -35,7 +35,7 @@ Feature: In an assignment, teachers can change filters in the grading app @javascript Scenario: Set filters in the grading table and see them in the grading app Given I am on the "Test assignment name &" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I should not see "Course 1 &" And the "title" attribute of "a[title='Course: Course 1 &']" "css_element" should not contain "&" @@ -46,7 +46,7 @@ Feature: In an assignment, teachers can change filters in the grading app And I press "Save changes" And I am on the "Test assignment name &" Activity page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I set the field "filter" to "Not submitted" And I set the field "markerfilter" to "Marker 1" And I set the field "workflowfilter" to "In marking" @@ -58,7 +58,7 @@ Feature: In an assignment, teachers can change filters in the grading app @javascript Scenario: Set filters in the grading app and see them in the grading table Given I am on the "Test assignment name &" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "allocatedmarker" to "Marker 1" And I set the field "workflowstate" to "In marking" @@ -66,7 +66,7 @@ Feature: In an assignment, teachers can change filters in the grading app And I press "Save changes" And I am on the "Test assignment name &" Activity page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I click on "[data-region=user-filters]" "css_element" And I set the field "filter" to "Not submitted" diff --git a/mod/assign/tests/behat/grading_status.feature b/mod/assign/tests/behat/grading_status.feature index 8a10bc7fe1b..9c583de2de8 100644 --- a/mod/assign/tests/behat/grading_status.feature +++ b/mod/assign/tests/behat/grading_status.feature @@ -36,7 +36,7 @@ Feature: View the grading status of an assignment | Test assignment name | student1 | I'm the student first submission | # Mark the submission. And I am on the "Test assignment name" "assign activity" page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Not marked" in the "Student 1" "table_row" And I click on "Grade" "link" in the "Student 1" "table_row" And I should see "1 of 2" @@ -49,7 +49,7 @@ Feature: View the grading status of an assignment And I set the field "Notify students" to "0" And I press "Save changes" And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "In review" in the "Student 1" "table_row" And I log out # View the grading status as a student. @@ -59,7 +59,7 @@ Feature: View the grading status of an assignment And I log out # Mark the submission again but set the marking workflow to 'Released'. And I am on the "Test assignment name" "assign activity" page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "In review" in the "Student 1" "table_row" And I click on "Grade" "link" in the "Student 1" "table_row" And I should see "1 of 1" @@ -67,7 +67,7 @@ Feature: View the grading status of an assignment And I press "Save changes" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Released" in the "Student 1" "table_row" And I log out # View the grading status as a student. @@ -77,7 +77,7 @@ Feature: View the grading status of an assignment And I log out # Now, change the status from 'Released' to 'In marking' (this will remove the grade from the gradebook). And I am on the "Test assignment name" "assign activity" page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Released" in the "Student 1" "table_row" And I click on "Grade" "link" in the "Student 1" "table_row" And I should see "1 of 1" @@ -85,7 +85,7 @@ Feature: View the grading status of an assignment And I set the field "Notify students" to "0" And I press "Save changes" And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "In marking" in the "Student 1" "table_row" # The grade should also remain displayed as it's stored in the assign DB tables, but the final grade should be empty. And "Student 1" row "Grade" column of "generaltable" table should contain "50.00" @@ -112,7 +112,7 @@ Feature: View the grading status of an assignment | Test assignment name | student1 | I'm the student first submission | # Mark the submission. And I am on the "Test assignment name" "assign activity" page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should not see "Graded" in the "Student 1" "table_row" And I click on "Grade" "link" in the "Student 1" "table_row" And I should see "1 of 2" @@ -124,7 +124,7 @@ Feature: View the grading status of an assignment And I press "Save changes" And I click on "Edit settings" "link" And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Graded" in the "Student 1" "table_row" And I log out # View the grading status as a student. @@ -141,7 +141,7 @@ Feature: View the grading status of an assignment And I log out # Teacher marks the submission again after noticing the 'Graded - follow-up submission received'. And I am on the "Test assignment name" "assign activity" page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Graded - follow-up submission received" in the "Student 1" "table_row" And I wait "10" seconds And I click on "Grade" "link" in the "Student 1" "table_row" @@ -151,7 +151,7 @@ Feature: View the grading status of an assignment And I press "Save changes" And I click on "Edit settings" "link" And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Graded" in the "Student 1" "table_row" And I log out # View the grading status as a student again. diff --git a/mod/assign/tests/behat/grant_extension.feature b/mod/assign/tests/behat/grant_extension.feature index d20b25b5e7f..9d1d5cef1e3 100644 --- a/mod/assign/tests/behat/grant_extension.feature +++ b/mod/assign/tests/behat/grant_extension.feature @@ -33,7 +33,7 @@ Feature: Grant an extension to an offline student | activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | duedate | | assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | And I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" And I open the action menu in "Student 1" "table_row" And I follow "Grant extension" And I should see "Student 1 (student1@example.com)" @@ -51,7 +51,7 @@ Feature: Grant an extension to an offline student | activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | duedate | | assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | And I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" And I set the field "selectall" to "1" And I set the field "operation" to "Grant extension" And I click on "Go" "button" confirming the dialogue @@ -80,7 +80,7 @@ Feature: Grant an extension to an offline student | activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | allowsubmissionsfromdate | duedate | | assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | 1388620800 | And I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" And I open the action menu in "Student 1" "table_row" And I follow "Grant extension" And I should see "Student 1 (student1@example.com)" @@ -100,7 +100,7 @@ Feature: Grant an extension to an offline student | activity | course | name | intro | assignsubmission_onlinetext_enabled | assignsubmission_file_enabled | allowsubmissionsfromdate | duedate | | assign | C1 | Test assignment name | Test assignment description | 0 | 0 | 1388534400 | 1388620800 | And I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" And I set the field "selectall" to "1" And I set the field "operation" to "Grant extension" And I click on "Go" "button" confirming the dialogue diff --git a/mod/assign/tests/behat/group_submission.feature b/mod/assign/tests/behat/group_submission.feature index 7cf09446126..3de840d428d 100644 --- a/mod/assign/tests/behat/group_submission.feature +++ b/mod/assign/tests/behat/group_submission.feature @@ -34,7 +34,7 @@ Feature: Group assignment submissions | submissiondrafts | 0 | | teamsubmission | 1 | And I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" Then "//tr[contains(., 'Student 0')][contains(., 'Default group')]" "xpath_element" should exist And "//tr[contains(., 'Student 1')][contains(., 'Default group')]" "xpath_element" should exist And "//tr[contains(., 'Student 2')][contains(., 'Default group')]" "xpath_element" should exist @@ -52,7 +52,7 @@ Feature: Group assignment submissions | student0 | G1 | | student1 | G1 | And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I set the field "Separate groups" to "Group 1" And "//tr[contains(., 'Student 0')][contains(., 'Group 1')]" "xpath_element" should exist And "//tr[contains(., 'Student 1')][contains(., 'Group 1')]" "xpath_element" should exist @@ -104,7 +104,7 @@ Feature: Group assignment submissions | Test assignment name | student1 | I'm the student's first submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading" And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading" And "Student 3" row "Status" column of "generaltable" table should not contain "Submitted for grading" @@ -115,7 +115,7 @@ Feature: Group assignment submissions | Test assignment name | student3 | I'm the student's first submission | And I am on the "Test assignment name" Activity page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading" And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading" And "Student 3" row "Status" column of "generaltable" table should contain "Submitted for grading" @@ -164,7 +164,7 @@ Feature: Group assignment submissions | Test assignment name | student1 | I'm the student's first submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the following fields to these values: | Grade out of 100 | 50.0 | @@ -175,7 +175,7 @@ Feature: Group assignment submissions And I press "Save changes" When I am on "Course 1" course homepage And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then "Student 1" row "Status" column of "generaltable" table should contain "Reopened" And "Student 2" row "Status" column of "generaltable" table should contain "Reopened" @@ -312,6 +312,6 @@ Feature: Group assignment submissions And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" Then "Student 1" row "Status" column of "generaltable" table should contain "Submitted for grading" And "Student 2" row "Status" column of "generaltable" table should contain "Submitted for grading" diff --git a/mod/assign/tests/behat/hide_grader.feature b/mod/assign/tests/behat/hide_grader.feature index a0b9411e678..13cbfb4aa88 100644 --- a/mod/assign/tests/behat/hide_grader.feature +++ b/mod/assign/tests/behat/hide_grader.feature @@ -36,14 +36,14 @@ Feature: Hide grader identities identity from students # Grade the submission and leave feedback And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should not see "Graded" in the "Student 1" "table_row" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade out of 100" to "50" And I set the field "Feedback comments" to "Catch for us the foxes." And I press "Save changes" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Graded" in the "Student 1" "table_row" And I log out diff --git a/mod/assign/tests/behat/outcome_grading.feature b/mod/assign/tests/behat/outcome_grading.feature index 32d0df8870e..09ccd67f7d4 100644 --- a/mod/assign/tests/behat/outcome_grading.feature +++ b/mod/assign/tests/behat/outcome_grading.feature @@ -57,14 +57,14 @@ Feature: Outcome grading And I press "Save changes" And I log out When I am on the "Test assignment name" "assign activity" page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 0" "table_row" And I set the following fields to these values: | Outcome Test: | Excellent | And I press "Save changes" And I click on "Edit settings" "link" When I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should see "Outcome Test: Excellent" in the "Student 0" "table_row" And I should not see "Outcome Test: Excellent" in the "Student 1" "table_row" @@ -100,14 +100,14 @@ Feature: Outcome grading And I press "Save changes" And I log out When I am on the "Test assignment name" "assign activity" page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 0" "table_row" And I set the following fields to these values: | Outcome Test: | Excellent | | Apply grades and feedback to entire group | Yes | And I press "Save changes" And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should see "Outcome Test: Excellent" in the "Student 0" "table_row" And I should see "Outcome Test: Excellent" in the "Student 1" "table_row" And I should not see "Outcome Test: Excellent" in the "Student 2" "table_row" @@ -117,7 +117,7 @@ Feature: Outcome grading | Apply grades and feedback to entire group | No | And I press "Save changes" And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Outcome Test: Excellent" in the "Student 0" "table_row" And I should see "Outcome Test: Disappointing" in the "Student 1" "table_row" And I should not see "Outcome Test: Disappointing" in the "Student 0" "table_row" diff --git a/mod/assign/tests/behat/page_titles.feature b/mod/assign/tests/behat/page_titles.feature index 53126e713e5..7dce9ffd6bf 100644 --- a/mod/assign/tests/behat/page_titles.feature +++ b/mod/assign/tests/behat/page_titles.feature @@ -28,7 +28,7 @@ Feature: In an assignment, page titles are informative Scenario: I view an assignment as a teacher and take an action When I am on the "History of ants" Activity page logged in as teacher1 Then "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And "title[text() = 'C1: History of ants - Grading']" "xpath_element" should exist in the "head" "css_element" And I click on "Grade" "link" in the "Student 1" "table_row" And "title[text() = 'C1: History of ants - Grading']" "xpath_element" should exist in the "head" "css_element" diff --git a/mod/assign/tests/behat/prevent_submission_changes.feature b/mod/assign/tests/behat/prevent_submission_changes.feature index 2767ca96a9c..29d4894d3d9 100644 --- a/mod/assign/tests/behat/prevent_submission_changes.feature +++ b/mod/assign/tests/behat/prevent_submission_changes.feature @@ -41,7 +41,7 @@ Feature: Prevent or allow assignment submission changes And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" And I open the action menu in "Student 1" "table_row" And I follow "Prevent submission changes" Then I should see "Submission changes not allowed" @@ -53,7 +53,7 @@ Feature: Prevent or allow assignment submission changes And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I open the action menu in "Student 1" "table_row" And I follow "Allow submission changes" And I should not see "Submission changes not allowed" @@ -78,7 +78,7 @@ Feature: Prevent or allow assignment submission changes | Test assignment name | student2 | I'm the student2 submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" And I set the field "selectall" to "1" And I click on "Go" "button" confirming the dialogue Then I should see "Submission changes not allowed" in the "Student 1" "table_row" @@ -90,7 +90,7 @@ Feature: Prevent or allow assignment submission changes And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I set the field "selectall" to "1" And I set the field "id_operation" to "Unlock submissions" And I click on "Go" "button" confirming the dialogue diff --git a/mod/assign/tests/behat/quickgrading.feature b/mod/assign/tests/behat/quickgrading.feature index cae53620f4e..9eaac14c34a 100644 --- a/mod/assign/tests/behat/quickgrading.feature +++ b/mod/assign/tests/behat/quickgrading.feature @@ -29,7 +29,7 @@ Feature: In an assignment, teachers grade multiple students on one page | Test assignment name | student1 | I'm the student1 submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" When I click on "Grade" "link" in the "Student 1" "table_row" And I press "Save changes" And I click on "Edit settings" "link" @@ -93,7 +93,7 @@ Feature: In an assignment, teachers grade multiple students on one page And I press "Save changes" And I log out And I am on the "Test assignment name" "assign activity" page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the following fields to these values: | Grade out of 100 | 50.0 | @@ -102,7 +102,7 @@ Feature: In an assignment, teachers grade multiple students on one page And I press "Save changes" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I click on "Quick grading" "checkbox" And I set the field "User grade" to "60.0" And I press "Save all quick grading changes" @@ -124,7 +124,7 @@ Feature: In an assignment, teachers grade multiple students on one page And I should not see "1337" And I log out And I am on the "Test assignment name" "assign activity" page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Hide User picture" "link" And I click on "Hide Full name" "link" And I click on "Hide Email address" "link" diff --git a/mod/assign/tests/behat/relative_dates.feature b/mod/assign/tests/behat/relative_dates.feature index 838446dcbb2..0b7624e0a75 100644 --- a/mod/assign/tests/behat/relative_dates.feature +++ b/mod/assign/tests/behat/relative_dates.feature @@ -80,7 +80,7 @@ I should be able to create an assignment with a due date relative to the course And I am on the "Test assignment name" Activity page logged in as teacher1 And the activity date in "Test assignment name" should contain "after course start" And I should see "Calculated for each student" in the "Time remaining" "table_row" - When I navigate to "View all submissions" in current page administration + When I follow "View all submissions" Then I should see "No submission" in the "Student 1" "table_row" And I should see "Assignment is overdue by:" in the "Student 1" "table_row" And I should see "No submission" in the "Student 2" "table_row" diff --git a/mod/assign/tests/behat/remove_submission.feature b/mod/assign/tests/behat/remove_submission.feature index 1a98e2a1993..84c029721b6 100644 --- a/mod/assign/tests/behat/remove_submission.feature +++ b/mod/assign/tests/behat/remove_submission.feature @@ -46,7 +46,7 @@ Feature: Remove a submission | Test assignment name | student1 | I'm the student submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I open the action menu in "Student 1" "table_row" When I follow "Remove submission" And I click on "Continue" "button" @@ -74,7 +74,7 @@ Feature: Remove a submission | Test assignment name | student1 | I'm the student submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I open the action menu in "Student 1" "table_row" When I follow "Remove submission" And I click on "Continue" "button" @@ -106,7 +106,7 @@ Feature: Remove a submission And I log out When I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should not see "I'm the student submission" And "Student 1" row "Status" column of "generaltable" table should contain "No submission" And I log out diff --git a/mod/assign/tests/behat/reopen_locked_submission.feature b/mod/assign/tests/behat/reopen_locked_submission.feature index 1d36aaecf5e..f351203f317 100644 --- a/mod/assign/tests/behat/reopen_locked_submission.feature +++ b/mod/assign/tests/behat/reopen_locked_submission.feature @@ -33,7 +33,7 @@ Feature: Submissions are unlocked when a new attempt is given | Test assignment name | student1 | I'm the student1 submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I open the action menu in "Student 1" "table_row" And I follow "Prevent submission changes" And I should see "Submission changes not allowed" @@ -59,7 +59,7 @@ Feature: Submissions are unlocked when a new attempt is given | Test assignment name | student1 | I'm the student1 submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" When I open the action menu in "Student 1" "table_row" And I follow "Prevent submission changes" Then I should see "Submission changes not allowed" diff --git a/mod/assign/tests/behat/rescale_grades.feature b/mod/assign/tests/behat/rescale_grades.feature index a2c6b18c612..9bb54909807 100644 --- a/mod/assign/tests/behat/rescale_grades.feature +++ b/mod/assign/tests/behat/rescale_grades.feature @@ -28,13 +28,13 @@ Feature: Check that the assignment grade can be rescaled when the max grade is c | submissiondrafts | 0 | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade out of 100" to "40" And I press "Save changes" And I follow "Edit settings" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And "Student 1" row "Grade" column of "generaltable" table should contain "40.00" And I am on the "Test assignment name" "assign activity" page @@ -44,7 +44,7 @@ Feature: Check that the assignment grade can be rescaled when the max grade is c And I set the field "Rescale existing grades" to "No" And I set the field "Maximum grade" to "80" When I press "Save and display" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then "Student 1" row "Grade" column of "generaltable" table should contain "40.00" Scenario: Update an assignment without touching the max grades @@ -60,7 +60,7 @@ Feature: Check that the assignment grade can be rescaled when the max grade is c And I set the field "Rescale existing grades" to "Yes" And I set the field "Maximum grade" to "80" When I press "Save and display" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then "Student 1" row "Grade" column of "generaltable" table should contain "40.00" Scenario: Update the max grade for an assignment rescaling existing grades @@ -69,11 +69,11 @@ Feature: Check that the assignment grade can be rescaled when the max grade is c And I set the field "Rescale existing grades" to "Yes" And I set the field "Maximum grade" to "50" When I press "Save and display" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then "Student 1" row "Grade" column of "generaltable" table should contain "20.00" Scenario: Rescaling should not produce negative grades - Given I navigate to "View all submissions" in current page administration + Given I follow "View all submissions" And I click on "Grade" "link" in the "Student 2" "table_row" And I wait until the page is ready And I follow "Assignment: Test assignment name" @@ -82,6 +82,6 @@ Feature: Check that the assignment grade can be rescaled when the max grade is c And I set the field "Rescale existing grades" to "Yes" And I set the field "Maximum grade" to "50" When I press "Save and display" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" # Make sure the student did not receive a negative grade. Then "Student 2" row "Grade" column of "generaltable" table should not contain "-0.50" diff --git a/mod/assign/tests/behat/set_availability.feature b/mod/assign/tests/behat/set_availability.feature index fa44b831753..9ea34325057 100644 --- a/mod/assign/tests/behat/set_availability.feature +++ b/mod/assign/tests/behat/set_availability.feature @@ -85,7 +85,7 @@ Feature: Set availability dates for an assignment And I am on the "Assignment name" Activity page logged in as teacher1 And I should see "1" in the "Submitted" "table_row" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Submitted for grading" in the "Student 1" "table_row" @_file_upload @@ -116,7 +116,7 @@ Feature: Set availability dates for an assignment And I am on the "Assignment name" Activity page logged in as teacher1 And I should see "1" in the "Submitted" "table_row" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Submitted for grading" in the "Student 1" "table_row" And I should see "2 days 5 hours late" in the "Student 1" "table_row" @@ -139,6 +139,6 @@ Feature: Set availability dates for an assignment And I am on the "Assignment name" Activity page logged in as teacher1 And I should see "0" in the "Submitted" "table_row" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "No submission" in the "Student 1" "table_row" And I should see "Assignment is overdue by: 2 days 5 hours" in the "Student 1" "table_row" diff --git a/mod/assign/tests/behat/steps_blind_marking.feature b/mod/assign/tests/behat/steps_blind_marking.feature index 69dfda27778..7fb4ec5c47a 100644 --- a/mod/assign/tests/behat/steps_blind_marking.feature +++ b/mod/assign/tests/behat/steps_blind_marking.feature @@ -34,7 +34,7 @@ Feature: Assignments correctly add feedback to the grade report when workflow an # Mark the submission. And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Not marked" in the "I'm the student's first submission" "table_row" And I click on "Grade" "link" in the "I'm the student's first submission" "table_row" And I set the field "Grade out of 100" to "50" @@ -44,7 +44,7 @@ Feature: Assignments correctly add feedback to the grade report when workflow an And I press "Save changes" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "In review" in the "I'm the student's first submission" "table_row" @javascript @@ -55,14 +55,14 @@ Feature: Assignments correctly add feedback to the grade report when workflow an And I press "Save changes" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Ready for release" in the "I'm the student's first submission" "table_row" And I click on "Grade" "link" in the "I'm the student's first submission" "table_row" And I set the field "Marking workflow state" to "Released" And I press "Save changes" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Released" in the "I'm the student's first submission" "table_row" And I set the field "Grading action" to "Reveal student identities" And I press "Continue" @@ -81,7 +81,7 @@ Feature: Assignments correctly add feedback to the grade report when workflow an And I press "Save changes" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Ready for release" in the "I'm the student's first submission" "table_row" And I set the field "Grading action" to "Reveal student identities" And I press "Continue" @@ -90,7 +90,7 @@ Feature: Assignments correctly add feedback to the grade report when workflow an And I press "Save changes" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Released" in the "Student 1" "table_row" And I log out @@ -102,7 +102,7 @@ Feature: Assignments correctly add feedback to the grade report when workflow an @javascript Scenario: Submissions table visible with overrides and blind marking When I am on the "Test assignment name" "assign activity" page - And I navigate to "User overrides" in current page administration + And I navigate to "Overrides" in current page administration And I press "Add user override" And I set the following fields to these values: | Override user | Student | @@ -110,5 +110,5 @@ Feature: Assignments correctly add feedback to the grade report when workflow an And I press "Save" And I should see "Tuesday, 1 January 2030, 8:00" And I am on the "Test assignment name" "assign activity" page - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "In review" in the "I'm the student's first submission" "table_row" diff --git a/mod/assign/tests/behat/submission_comments.feature b/mod/assign/tests/behat/submission_comments.feature index 2b42681222c..071473c08b3 100644 --- a/mod/assign/tests/behat/submission_comments.feature +++ b/mod/assign/tests/behat/submission_comments.feature @@ -57,7 +57,7 @@ Feature: In an assignment, students can comment in their submissions And I log out And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I click on ".comment-link" "css_element" When I set the field "content" to "Teacher feedback first comment" @@ -75,7 +75,7 @@ Feature: In an assignment, students can comment in their submissions | Test assignment name | student1 | I'm the student submission | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I click on ".comment-link" "css_element" When I set the field "content" to "Teacher feedback first comment" @@ -92,7 +92,7 @@ Feature: In an assignment, students can comment in their submissions | activity | course | name | assignsubmission_onlinetext_enabled | assignmentsubmission_file_enabled | assignfeedback_comments_enabled | | assign | C1 | Test assignment name | 0 | 0 | 1 | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" When I set the following fields to these values: | Grade out of 100 | 50 | @@ -100,7 +100,7 @@ Feature: In an assignment, students can comment in their submissions And I press "Save changes" And I click on "Edit settings" "link" And I follow "Test assignment name" - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" Then I should see "50.00" in the "Student 1" "table_row" And I should see "I'm the teacher feedback" in the "Student 1" "table_row" @@ -109,7 +109,7 @@ Feature: In an assignment, students can comment in their submissions | activity | course | name | assignsubmission_onlinetext_enabled | assignmentsubmission_file_enabled | assignfeedback_comments_enabled | | assign | C1 | Test assignment name | 0 | 0 | 1 | And I am on the "Test assignment name" Activity page logged in as teacher1 - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I click on "Grade" "link" in the "Student 1" "table_row" And I set the following fields to these values: | Grade out of 100 | 0 | diff --git a/mod/assign/tests/behat/submit_without_group.feature b/mod/assign/tests/behat/submit_without_group.feature index 93eeb4a0c08..85428007cf8 100644 --- a/mod/assign/tests/behat/submit_without_group.feature +++ b/mod/assign/tests/behat/submit_without_group.feature @@ -81,7 +81,7 @@ Feature: Submit assignment without group And I am on the "c1assign1" "assign activity" page logged in as teacher1 And I should see "1" in the "Groups" "table_row" And I should not see "The setting 'Require group to make submission\' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions." - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Default group" in the "Student 1" "table_row" And I should see "Default group" in the "Student 2" "table_row" And I should see "Submitted for grading" in the "Student 1" "table_row" @@ -89,7 +89,7 @@ Feature: Submit assignment without group And I am on the "c1assign2" "assign activity" page And I should see "0" in the "Groups" "table_row" And I should see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions." - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Not a member of any group, so unable to make submissions." in the "Student 1" "table_row" And I should see "Not a member of any group, so unable to make submissions." in the "Student 2" "table_row" And I should not see "Submitted for grading" in the "Student 1" "table_row" @@ -97,7 +97,7 @@ Feature: Submit assignment without group And I am on the "c2assign1" "assign activity" page And I should see "1" in the "Groups" "table_row" And I should not see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions." - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Group 1" in the "Student 1" "table_row" And I should see "Group 1" in the "Student 2" "table_row" And I should see "Submitted for grading" in the "Student 1" "table_row" @@ -112,7 +112,7 @@ Feature: Submit assignment without group And I log out And I am on the "c3assign1" "assign activity" page logged in as teacher1 And I should see "The setting 'Require group to make submission' is enabled and some users are either not a member of any group, or are a member of more than one group, so are unable to make submissions." - And I navigate to "View all submissions" in current page administration + And I follow "View all submissions" And I should see "Member of more than one group, so unable to make submissions." in the "Student 3" "table_row" Scenario: All users are in groups, so no warning messages needed. diff --git a/mod/assign/tests/locallib_test.php b/mod/assign/tests/locallib_test.php index c08ab734671..dfa43f6a47b 100644 --- a/mod/assign/tests/locallib_test.php +++ b/mod/assign/tests/locallib_test.php @@ -859,7 +859,7 @@ class mod_assign_locallib_testcase extends advanced_testcase { // Test you can see the submit button for an online text assignment with a submission. $this->setUser($student); - $output = $assign->view_student_summary($student, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); $this->assertStringContainsString(get_string('submitassignment', 'assign'), $output, 'Can submit non empty onlinetext assignment'); } @@ -1990,7 +1990,7 @@ class mod_assign_locallib_testcase extends advanced_testcase { // Check we can see the submit button. $this->setUser($student); - $output = $assign->view_student_summary($student, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); $this->assertStringContainsString(get_string('submitassignment', 'assign'), $output); $submission = $assign->get_group_submission($student->id, 0, true); @@ -1998,18 +1998,18 @@ class mod_assign_locallib_testcase extends advanced_testcase { $assign->testable_update_submission($submission, $student->id, true, true); // Check that the student does not see "Submit" button. - $output = $assign->view_student_summary($student, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output); // Change to another user in the same group. $this->setUser($otherstudent); - $output = $assign->view_student_summary($otherstudent, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $otherstudent); $this->assertStringContainsString(get_string('submitassignment', 'assign'), $output); $submission = $assign->get_group_submission($otherstudent->id, 0, true); $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED; $assign->testable_update_submission($submission, $otherstudent->id, true, true); - $output = $assign->view_student_summary($otherstudent, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $otherstudent); $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output); } @@ -2044,8 +2044,9 @@ class mod_assign_locallib_testcase extends advanced_testcase { $this->add_submission($student, $assign); // Check we can see the submit button. - $output = $assign->view_student_summary($student, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); $this->assertStringContainsString(get_string('submitassignment', 'assign'), $output); + $output = $assign->view_student_summary($student, true); $this->assertStringContainsString(get_string('timeremaining', 'assign'), $output); $difftime = time() - $time; $this->assertStringContainsString(get_string('overdue', 'assign', format_time((2 * DAYSECS) + $difftime)), $output); @@ -2055,15 +2056,16 @@ class mod_assign_locallib_testcase extends advanced_testcase { $assign->testable_update_submission($submission, $student->id, true, true); // Check that the student does not see "Submit" button. - $output = $assign->view_student_summary($student, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output); // Change to another user in the same group. $this->setUser($otherstudent); - $output = $assign->view_student_summary($otherstudent, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $otherstudent); $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output); // Check that time remaining is not overdue. + $output = $assign->view_student_summary($otherstudent, true); $this->assertStringContainsString(get_string('timeremaining', 'assign'), $output); $difftime = time() - $time; $this->assertStringContainsString(get_string('submittedlate', 'assign', format_time((2 * DAYSECS) + $difftime)), $output); @@ -2071,7 +2073,7 @@ class mod_assign_locallib_testcase extends advanced_testcase { $submission = $assign->get_group_submission($otherstudent->id, 0, true); $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED; $assign->testable_update_submission($submission, $otherstudent->id, true, true); - $output = $assign->view_student_summary($otherstudent, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $otherstudent); $this->assertStringNotContainsString(get_string('submitassignment', 'assign'), $output); } @@ -2507,7 +2509,7 @@ class mod_assign_locallib_testcase extends advanced_testcase { // Student should be able to see an add submission button. $this->setUser($student); - $output = $assign->view_student_summary($student, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); $this->assertNotEquals(false, strpos($output, get_string('addsubmission', 'assign'))); // Add a submission. @@ -2538,14 +2540,16 @@ class mod_assign_locallib_testcase extends advanced_testcase { // Need a better check. $this->assertNotEquals(false, strpos($output, 'Submission text'), 'Contains: Submission text'); - // Check that the student now has a button for Add a new attempt". - $this->assertNotEquals(false, strpos($output, get_string('addnewattempt', 'assign'))); - // Check that the student now does not have a button for Submit. - $this->assertEquals(false, strpos($output, get_string('submitassignment', 'assign'))); - // Check that the student now has a submission history. $this->assertNotEquals(false, strpos($output, get_string('attempthistory', 'assign'))); + // Check that the student now does not have a button for Submit. + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); + $this->assertEquals(false, strpos($output, get_string('submitassignment', 'assign'))); + + // Check that the student now has a button for Add a new attempt". + $this->assertNotEquals(false, strpos($output, get_string('addnewattempt', 'assign'))); + $this->setUser($teacher); // Check that the grading table loads correctly and contains this user. // This is also testing that we do not get duplicate rows in the grading table. @@ -2608,7 +2612,7 @@ class mod_assign_locallib_testcase extends advanced_testcase { // Student should be able to see an add submission button. $this->setUser($student); - $output = $assign->view_student_summary($student, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); $this->assertNotEquals(false, strpos($output, get_string('addsubmission', 'assign'))); // Add a submission. @@ -2627,16 +2631,16 @@ class mod_assign_locallib_testcase extends advanced_testcase { $output = $assign->view_student_summary($student, true); $this->assertNotEquals(false, strpos($output, '50.0')); - // Check that the student now has a button for Add a new attempt. - $output = $assign->view_student_summary($student, true); - $this->assertNotEquals(false, strpos($output, get_string('addnewattempt', 'assign'))); - - // Check that the student now does not have a button for Submit. - $this->assertEquals(false, strpos($output, get_string('submitassignment', 'assign'))); - // Check that the student now has a submission history. $this->assertNotEquals(false, strpos($output, get_string('attempthistory', 'assign'))); + // Check that the student now does not have a button for Submit. + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); + $this->assertEquals(false, strpos($output, get_string('submitassignment', 'assign'))); + + // Check that the student now has a button for Add a new attempt. + $this->assertNotEquals(false, strpos($output, get_string('addnewattempt', 'assign'))); + // Add a second submission. $this->add_submission($student, $assign); $this->submit_for_grading($student, $assign); @@ -2654,7 +2658,7 @@ class mod_assign_locallib_testcase extends advanced_testcase { // Check that the student now has a button for Add a new attempt. $this->setUser($student); - $output = $assign->view_student_summary($student, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); $this->assertMatchesRegularExpression('/' . get_string('addnewattempt', 'assign') . '/', $output); $this->assertNotEquals(false, strpos($output, get_string('addnewattempt', 'assign'))); } @@ -2682,7 +2686,7 @@ class mod_assign_locallib_testcase extends advanced_testcase { // Student should be able to see an add submission button. $this->setUser($student); - $output = $assign->view_student_summary($student, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); $this->assertNotEquals(false, strpos($output, get_string('addsubmission', 'assign'))); // Add a submission as a student. @@ -2725,7 +2729,7 @@ class mod_assign_locallib_testcase extends advanced_testcase { // Student should be able to see an add submission button. $this->setUser($student); - $output = $assign->view_student_summary($student, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); $this->assertNotEquals(false, strpos($output, get_string('addsubmission', 'assign'))); // Add a submission. @@ -3012,7 +3016,7 @@ class mod_assign_locallib_testcase extends advanced_testcase { // Student should be able to see an add submission button. $this->setUser($student); - $output = $assign->view_student_summary($student, true); + $output = $assign->view_submission_action_bar($assign->get_instance(), $student); $this->assertNotEquals(false, strpos($output, get_string('addsubmission', 'assign'))); // Add a submission but don't submit now.