From 821ab1bf9b8a6747ce31af6bfb554f6139df23b1 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Fri, 15 Apr 2016 13:44:16 +0800 Subject: [PATCH] MDL-52954 assign: Behat fixes because the assign grading ui has changed --- .../tests/behat/availability_grade.feature | 6 +++-- .../behat/restrict_activity_by_grade.feature | 6 +++-- .../restrict_section_availability.feature | 6 +++-- .../form/guide/tests/behat/edit_guide.feature | 6 +++-- .../rubric/tests/behat/edit_rubric.feature | 8 ++----- grade/grading/tests/behat/behat_grading.php | 23 ++++++++++--------- .../tests/behat/bulk_insert_grades.feature | 18 +++++++++------ grade/tests/behat/grade_scales.feature | 23 +++++++++++++------ .../behat/grade_single_item_scales.feature | 7 +++--- .../tests/behat/modgrade_validation.feature | 21 ++++++++--------- mod/assign/lang/en/assign.php | 1 + mod/assign/locallib.php | 2 +- 12 files changed, 73 insertions(+), 54 deletions(-) diff --git a/availability/condition/grade/tests/behat/availability_grade.feature b/availability/condition/grade/tests/behat/availability_grade.feature index 9c250e12b05..e987ed3259c 100644 --- a/availability/condition/grade/tests/behat/availability_grade.feature +++ b/availability/condition/grade/tests/behat/availability_grade.feature @@ -115,11 +115,13 @@ Feature: availability_grade # Give the assignment 40%. And I follow "A1" - And I follow "View/grade all submissions" + And I follow "View all submissions" # Pick the grade link in the row that has s@example.com in it. - And I click on "//a[contains(@href, 'action=grade') and ancestor::tr/td[normalize-space(.) = 's@example.com']]/img" "xpath_element" + And I click on "Grade" "link" in the "s@example.com" "table_row" And I set the field "Grade out of 100" to "40" And I click on "Save changes" "button" + And I press "Ok" + And I click on "Edit settings" "link" # Log back in as student. And I log out diff --git a/completion/tests/behat/restrict_activity_by_grade.feature b/completion/tests/behat/restrict_activity_by_grade.feature index 27fa4234cde..89ef52127fa 100644 --- a/completion/tests/behat/restrict_activity_by_grade.feature +++ b/completion/tests/behat/restrict_activity_by_grade.feature @@ -56,11 +56,13 @@ Feature: Restrict activity availability through grade conditions And I am on site homepage And I follow "Course 1" And I follow "Grade assignment" - And I follow "View/grade all submissions" - And I click on "Grade Student First" "link" in the "Student First" "table_row" + And I follow "View all submissions" + And I click on "Grade" "link" in the "Student First" "table_row" And I set the following fields to these values: | Grade | 21 | And I press "Save changes" + And I press "Ok" + And I follow "Edit settings" And I log out And I log in as "student1" And I am on site homepage diff --git a/completion/tests/behat/restrict_section_availability.feature b/completion/tests/behat/restrict_section_availability.feature index 3a74723dd08..7e0eeec7d5b 100644 --- a/completion/tests/behat/restrict_section_availability.feature +++ b/completion/tests/behat/restrict_section_availability.feature @@ -93,11 +93,13 @@ Feature: Restrict sections availability through completion or grade conditions And I am on site homepage And I follow "Course 1" And I follow "Grade assignment" - And I follow "View/grade all submissions" - And I click on "Grade Student First" "link" in the "Student First" "table_row" + And I follow "View all submissions" + And I click on "Grade" "link" in the "Student First" "table_row" And I set the following fields to these values: | Grade | 21 | And I press "Save changes" + And I press "Ok" + And I follow "Edit settings" And I log out And I log in as "student1" And I am on site homepage diff --git a/grade/grading/form/guide/tests/behat/edit_guide.feature b/grade/grading/form/guide/tests/behat/edit_guide.feature index c7ee03d2668..abe994a774a 100644 --- a/grade/grading/form/guide/tests/behat/edit_guide.feature +++ b/grade/grading/form/guide/tests/behat/edit_guide.feature @@ -84,9 +84,11 @@ Feature: Marking guides can be created and edited And I wait "1" seconds Then the field "Guide criterion B criterion remark" matches value "Comment 4" When I press "Save changes" - Then I should see "The grade changes were saved" + And I press "Ok" + And I follow "Edit settings" + And I follow "Test assignment 1 name" + And I follow "View all submissions" # Checking that the user grade is correct. - When I press "Continue" Then I should see "80" in the "Student 1" "table_row" And I log out # Viewing it as a student. diff --git a/grade/grading/form/rubric/tests/behat/edit_rubric.feature b/grade/grading/form/rubric/tests/behat/edit_rubric.feature index c2ee6f434e5..232e9959e96 100644 --- a/grade/grading/form/rubric/tests/behat/edit_rubric.feature +++ b/grade/grading/form/rubric/tests/behat/edit_rubric.feature @@ -4,7 +4,8 @@ Feature: Rubrics can be created and edited As a teacher I need to edit previously used rubrics - Background: + @javascript + Scenario: I can use rubrics to grade and edit them later updating students grades Given the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | @@ -152,8 +153,3 @@ Feature: Rubrics can be created and edited And I should not see "Criterion 2" in the ".submissionstatustable" "css_element" And I should not see "Criterion 3" in the ".submissionstatustable" "css_element" And I should not see "Rubric test description" in the ".feedback" "css_element" - - @javascript - Scenario: I can use rubrics to grade and edit them later updating students grades with Javascript enabled - - Scenario: I can use rubrics to grade and edit them later updating students grades with Javascript disabled diff --git a/grade/grading/tests/behat/behat_grading.php b/grade/grading/tests/behat/behat_grading.php index 5f32cacb509..0ee77e5f90c 100644 --- a/grade/grading/tests/behat/behat_grading.php +++ b/grade/grading/tests/behat/behat_grading.php @@ -82,21 +82,19 @@ class behat_grading extends behat_base { public function i_go_to_activity_advanced_grading_page($userfullname, $activityname) { // Step to access the user grade page from the grading page. - $usergradetext = get_string('gradeuser', 'assign', $userfullname); - - // Shortcut in case we already are in the grading page. - $usergradetextliteral = behat_context_helper::escape($usergradetext); - if ($this->getSession()->getPage()->find('named_partial', array('link', $usergradetextliteral))) { - $this->execute('behat_general::click_link', $this->escape($usergradetext)); - - return true; - } + $gradetext = get_string('grade'); $this->execute('behat_general::click_link', $this->escape($activityname)); $this->execute('behat_general::click_link', $this->escape(get_string('viewgrading', 'assign'))); - $this->execute('behat_general::click_link', $this->escape($usergradetext)); + $this->execute('behat_general::i_click_on_in_the', + array( + $this->escape($gradetext), + 'link', + $this->escape($userfullname), + 'table_row' + )); } /** @@ -156,7 +154,10 @@ class behat_grading extends behat_base { public function i_save_the_advanced_grading_form() { $this->execute('behat_forms::press_button', get_string('savechanges')); - $this->execute('behat_forms::press_button', get_string('continue')); + $this->execute('behat_forms::press_button', 'Ok'); + $this->execute('behat_general::i_click_on', array($this->escape(get_string('editsettings')), 'link')); + $this->execute('behat_forms::press_button', get_string('cancel')); + $this->execute('behat_general::i_click_on', array($this->escape(get_string('viewgrading', 'mod_assign')), 'link')); } /** diff --git a/grade/report/singleview/tests/behat/bulk_insert_grades.feature b/grade/report/singleview/tests/behat/bulk_insert_grades.feature index 218a8320295..ce9905d498a 100644 --- a/grade/report/singleview/tests/behat/bulk_insert_grades.feature +++ b/grade/report/singleview/tests/behat/bulk_insert_grades.feature @@ -1,4 +1,4 @@ -@core @core_grades @gradereport_singleview +@core @core_grades @gradereport_singleview @javascript Feature: We can bulk insert grades for students in a course As a teacher In order to quickly grade items @@ -33,12 +33,13 @@ Feature: We can bulk insert grades for students in a course Given I log in as "teacher1" And I follow "Course 1" And I follow "Test assignment one" - And I follow "View/grade all submissions" - And I follow "Grade Student 1" + 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 | And I press "Save changes" - And I press "Continue" + And I press "Ok" + And I follow "Edit settings" And I follow "View gradebook" And I follow "Single view for Test assignment one" Then the field "Grade for james (Student) 1" matches value "50.00" @@ -73,13 +74,16 @@ Feature: We can bulk insert grades for students in a course Given I log in as "teacher1" And I follow "Course 1" And I follow "Test assignment two" - And I follow "View/grade all submissions" - And I follow "Grade Student 1" + 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 | And I press "Save changes" - And I press "Continue" + And I press "Ok" + And I follow "Edit settings" And I follow "View gradebook" + And I click on "input[title='Dock Navigation block']" "css_element" + And I click on "input[title='Dock Administration block']" "css_element" And I follow "Single view for Test assignment two" And I select "Student 1" from the "Select user..." singleselect Then the field "Grade for Test assignment two" matches value "50.00" diff --git a/grade/tests/behat/grade_scales.feature b/grade/tests/behat/grade_scales.feature index ed42b97e9ea..f6485ed2d04 100644 --- a/grade/tests/behat/grade_scales.feature +++ b/grade/tests/behat/grade_scales.feature @@ -1,4 +1,4 @@ -@core @core_grades +@core @core_grades @javascript Feature: View gradebook when scales are used In order to use scales to grade activities As an teacher @@ -49,18 +49,27 @@ Feature: View gradebook when scales are used And I set the field "grade[modgrade_type]" to "Scale" And I set the field "grade[modgrade_scale]" to "Letterscale" And I press "Save and display" - And I follow "View/grade all submissions" - And I click on "Grade Student 1" "link" in the "Student 1" "table_row" + And I follow "View all submissions" + And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade" to "A" - And I press "Save and show next" + And I press "Save changes" + And I press "Ok" + And I click on "[data-action=next-user]" "css_element" And I set the field "Grade" to "B" - And I press "Save and show next" + And I press "Save changes" + And I press "Ok" + And I click on "[data-action=next-user]" "css_element" And I set the field "Grade" to "C" - And I press "Save and show next" + And I press "Save changes" + And I press "Ok" + And I click on "[data-action=next-user]" "css_element" And I set the field "Grade" to "D" - And I press "Save and show next" + And I press "Save changes" + And I press "Ok" + And I click on "[data-action=next-user]" "css_element" And I set the field "Grade" to "F" And I press "Save changes" + And I press "Ok" And I follow "Course 1" And I navigate to "Grades" node in "Course administration" And I navigate to "Course grade settings" node in "Grade administration > Setup" diff --git a/grade/tests/behat/grade_single_item_scales.feature b/grade/tests/behat/grade_single_item_scales.feature index ed3a96ab04a..f62db0af703 100644 --- a/grade/tests/behat/grade_single_item_scales.feature +++ b/grade/tests/behat/grade_single_item_scales.feature @@ -1,4 +1,4 @@ -@core @core_grades +@core @core_grades @javascript Feature: View gradebook when single item scales are used In order to use single item scales to grade activities As an teacher @@ -43,10 +43,11 @@ Feature: View gradebook when single item scales are used And I set the field "grade[modgrade_type]" to "Scale" And I set the field "grade[modgrade_scale]" to "Singleitem" And I press "Save and display" - And I follow "View/grade all submissions" - And I click on "Grade Student 1" "link" in the "Student 1" "table_row" + And I follow "View all submissions" + And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade" to "A" And I press "Save changes" + And I press "Ok" And I follow "Course 1" And I navigate to "Grades" node in "Course administration" And I navigate to "Course grade settings" node in "Grade administration > Setup" diff --git a/lib/form/tests/behat/modgrade_validation.feature b/lib/form/tests/behat/modgrade_validation.feature index 8218293be30..3aa71e40841 100644 --- a/lib/form/tests/behat/modgrade_validation.feature +++ b/lib/form/tests/behat/modgrade_validation.feature @@ -64,6 +64,7 @@ Feature: Using the activity grade form element And I press "Save and display" And I should not see "You must choose whether to rescale existing grades or not" + @javascript Scenario: Attempting to change the scale when grades already exist Given I log in as "admin" And I navigate to "Scales" node in "Site administration > Grades" @@ -88,12 +89,12 @@ Feature: Using the activity grade form element | grade[modgrade_scale] | ABCDEF | And I follow "Course 1" And I follow "Test assignment name" - And I follow "View/grade all submissions" - And I click on "Grade Student 1" "link" in the "Student 1" "table_row" + And I follow "View all submissions" + And I click on "Grade" "link" in the "Student 1" "table_row" And I set the field "Grade" to "C" And I press "Save changes" - And I press "Continue" - And I click on "Edit settings" "link" in the "Administration" "block" + And I press "Ok" + And I click on "Edit settings" "link" When I expand all fieldsets Then I should see "Some grades have already been awarded, so the grade type and scale cannot be changed" @@ -132,6 +133,7 @@ Feature: Using the activity grade form element And I press "Save and display" And I should see "You cannot change the maximum grade when grades already exist for an activity with ratings" + @javascript Scenario: Attempting to change the maximum grade when no rescaling option has been chosen Given I log in as "teacher1" And I follow "Course 1" @@ -141,14 +143,11 @@ Feature: Using the activity grade form element | Description | Test assignment description | And I follow "Course 1" And I follow "Test assignment name" - And I follow "View/grade all submissions" - And I click on "Grade Student 1" "link" in the "Student 1" "table_row" + 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" And I press "Save changes" - And I press "Continue" - And I click on "Edit settings" "link" in the "Administration" "block" + And I press "Ok" + And I click on "Edit settings" "link" When I expand all fieldsets Then I should see "Some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades." - And I set the field "Maximum grade" to "50" - And I press "Save and display" - And I should see "You must choose whether to rescale existing grades or not" diff --git a/mod/assign/lang/en/assign.php b/mod/assign/lang/en/assign.php index 238721889a7..b600f73c746 100644 --- a/mod/assign/lang/en/assign.php +++ b/mod/assign/lang/en/assign.php @@ -447,6 +447,7 @@ $string['subplugintype_assignsubmission'] = 'Submission plugin'; $string['subplugintype_assignsubmission_plural'] = 'Submission plugins'; $string['subplugintype_assignfeedback'] = 'Feedback plugin'; $string['subplugintype_assignfeedback_plural'] = 'Feedback plugins'; +$string['teamname'] = 'Team: {$a}'; $string['teamsubmission'] = 'Students submit in groups'; $string['teamsubmission_help'] = 'If enabled students will be divided into groups based on the default set of groups or a custom grouping. A group submission will be shared among group members and all members of the group will see each others changes to the submission.'; $string['teamsubmissiongroupingid'] = 'Grouping for student groups'; diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index f92c631154d..19cc6546d1c 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -205,7 +205,7 @@ class assign { public function register_return_link($action, $params) { global $PAGE; $params['action'] = $action; - $currenturl = new moodle_url('/mod/assign/view.php'); + $currenturl = new moodle_url('/mod/assign/view.php', array('id' => $this->get_course_module()->id)); $currenturl->params($params); $PAGE->set_url($currenturl);