MDL-75455 gradereport_singleview: Readd Behat tests for bulk insert.

Part of: MDL-75423
This commit is contained in:
Ilya Tregubov 2022-11-01 11:11:27 +03:00 committed by Mihail Geshoski
parent b837be1e3e
commit afd45fd90e
2 changed files with 173 additions and 135 deletions

View file

@ -1,107 +1,140 @@
#@core @core_grades @gradereport_singleview @javascript @core @core_grades @gradereport_singleview @javascript
#Feature: We can bulk insert grades for students in a course Feature: We can bulk insert grades for students in a course
# As a teacher As a teacher
# In order to quickly grade items In order to quickly grade items
# I can bulk insert values for all or empty grades. I can bulk insert values for all or empty grades.
#
# Background: Background:
# Given the following "courses" exist: Given the following "courses" exist:
# | fullname | shortname | category | | fullname | shortname | category |
# | Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
# And the following "users" exist: And the following "users" exist:
# | username | firstname | lastname | email | idnumber | alternatename | | username | firstname | lastname | email | idnumber | alternatename |
# | teacher1 | Teacher | 1 | teacher1@example.com | t1 | fred | | teacher1 | Teacher | 1 | teacher1@example.com | t1 | fred |
# | student1 | Student | 1 | student1@example.com | s1 | james | | student1 | Student | 1 | student1@example.com | s1 | james |
# | student2 | Student | 2 | student1@example.com | s2 | holly | | student2 | Student | 2 | student1@example.com | s2 | holly |
# | student3 | Student | 3 | student1@example.com | s3 | anna | | student3 | Student | 3 | student1@example.com | s3 | anna |
# | student4 | Student | 4 | student1@example.com | s4 | zac | | student4 | Student | 4 | student1@example.com | s4 | zac |
# And the following "course enrolments" exist: And the following "course enrolments" exist:
# | user | course | role | | user | course | role |
# | teacher1 | C1 | editingteacher | | teacher1 | C1 | editingteacher |
# | student1 | C1 | student | | student1 | C1 | student |
# | student2 | C1 | student | | student2 | C1 | student |
# | student3 | C1 | student | | student3 | C1 | student |
# | student4 | C1 | student | | student4 | C1 | student |
# And the following "activities" exist: And the following "activities" exist:
# | activity | course | idnumber | name | intro | | activity | course | idnumber | name | intro |
# | assign | C1 | a1 | Test assignment one | Submit something! | | assign | C1 | a1 | Test assignment one | Submit something! |
# | assign | C1 | a2 | Test assignment two | Submit something! | | assign | C1 | a2 | Test assignment two | Submit something! |
# | assign | C1 | a3 | Test assignment three | Submit something! | | assign | C1 | a3 | Test assignment three | Submit something! |
# | assign | C1 | a4 | Test assignment four | Submit nothing! | | assign | C1 | a4 | Test assignment four | Submit nothing! |
#
# Scenario: I can bulk insert grades and check their override flags for grade view. Scenario: I can not save bulk insert until I fill required form elements
# Given I am on the "Test assignment one" "assign activity" page logged in as teacher1 Given I am on the "Test assignment one" "assign activity" page logged in as teacher1
# And I follow "View all submissions" And I am on "Course 1" course homepage with editing mode on
# And I click on "Grade" "link" in the "Student 1" "table_row" And I navigate to "View > Grader report" in the course gradebook
# And I set the following fields to these values: And I follow "Single view for Test assignment one"
# | Grade out of 100 | 50 | And I click on "Actions" "link"
# And I press "Save changes" When I click on "Bulk insert" "link"
# And I am on "Course 1" course homepage And the "Empty grades" "radio" should be disabled
# And I navigate to "View > Grader report" in the course gradebook And the "All grades" "radio" should be disabled
# And I follow "Single view for Test assignment one" And the "Insert value modal" "field" should be disabled
# Then the field "Grade for Student 1" matches value "50.00" And the "[data-action=save]" "css_element" should be disabled
# And the field "Override for Student 1" matches value "0" And I click on "I understand that my unsaved data might be lost" "checkbox"
# And I set the field "Perform bulk insert" to "1" And the "Empty grades" "radio" should be enabled
# And I set the field "Insert value" to "1.0" And the "All grades" "radio" should be enabled
# And I press "Save" And the "Insert value modal" "field" should be enabled
# And the field "Grade for Student 1" matches value "50.00" And the "[data-action=save]" "css_element" should be disabled
# And the field "Override for Student 1" matches value "0" And I click on "Empty grades" "radio"
# And the field "Grade for Student 2" matches value "1.00" And the "Empty grades" "radio" should be enabled
# And the field "Override for Student 2" matches value "1" And the "All grades" "radio" should be enabled
# And the field "Grade for Student 3" matches value "1.00" And the "Insert value modal" "field" should be enabled
# And the field "Override for Student 3" matches value "1" And the "[data-action=save]" "css_element" should be enabled
# And the field "Grade for Student 4" matches value "1.00"
# And the field "Override for Student 4" matches value "1" Scenario: I can bulk insert grades and check their override flags for grade view.
# And I set the field "For" to "All grades" Given I am on the "Test assignment one" "assign activity" page logged in as teacher1
# And I set the field "Perform bulk insert" to "1" And I follow "View all submissions"
# And I set the field "Insert value" to "2.0" And I click on "Grade" "link" in the "Student 1" "table_row"
# And I press "Save" And I set the following fields to these values:
# And the field "Grade for Student 1" matches value "2.00" | Grade out of 100 | 50 |
# And the field "Override for Student 1" matches value "1" And I press "Save changes"
# And the field "Grade for Student 2" matches value "2.00" And I am on "Course 1" course homepage with editing mode on
# And the field "Override for Student 2" matches value "1" And I navigate to "View > Grader report" in the course gradebook
# And the field "Grade for Student 3" matches value "2.00" And I follow "Single view for Test assignment one"
# And the field "Override for Student 3" matches value "1" Then the field "Grade for Student 1" matches value "50.00"
# And the field "Grade for Student 4" matches value "2.00" And the field "Override for Student 1" matches value "0"
# And the field "Override for Student 4" matches value "1" And I click on "Actions" "link"
# And I click on "Bulk insert" "link"
# Scenario: I can bulk insert grades and check their override flags for user view. And I click on "I understand that my unsaved data might be lost" "checkbox"
# Given I am on the "Test assignment two" "assign activity" page logged in as teacher1 And I click on "Empty grades" "radio"
# And I follow "View all submissions" And I set the field "Insert value modal" to "1.0"
# And I click on "Grade" "link" in the "Student 1" "table_row" And I click on "Save" "button" in the ".modal-dialog" "css_element"
# And I set the following fields to these values: And the field "Grade for Student 1" matches value "50.00"
# | Grade out of 100 | 50 | And the field "Override for Student 1" matches value "0"
# And I press "Save changes" And the field "Grade for Student 2" matches value "1.00"
# And I am on "Course 1" course homepage And the field "Override for Student 2" matches value "1"
# And I navigate to "View > Grader report" in the course gradebook And the field "Grade for Student 3" matches value "1.00"
# # And I click on "input[title='Dock Navigation block']" "css_element" And the field "Override for Student 3" matches value "1"
# # And I click on "input[title='Dock Administration block']" "css_element" And the field "Grade for Student 4" matches value "1.00"
# And I follow "Single view for Test assignment two" And the field "Override for Student 4" matches value "1"
# And I select "Student 1" from the "Select user..." singleselect
# Then the field "Grade for Test assignment two" matches value "50.00" And I click on "Actions" "link"
# And the field "Override for Test assignment two" matches value "0" And I click on "Bulk insert" "link"
# And I set the field "For" to "Empty grades" And I click on "I understand that my unsaved data might be lost" "checkbox"
# And I set the field "Perform bulk insert" to "1" And I click on "All grades" "radio"
# And I set the field "Insert value" to "1.0" And I set the field "Insert value modal" to "2.0"
# And I press "Save" And I click on "Save" "button" in the ".modal-dialog" "css_element"
# And the field "Grade for Test assignment two" matches value "50.00" And the field "Grade for Student 1" matches value "2.00"
# And the field "Override for Test assignment two" matches value "0" And the field "Override for Student 1" matches value "1"
# And the field "Grade for Test assignment one" matches value "1.00" And the field "Grade for Student 2" matches value "2.00"
# And the field "Override for Test assignment one" matches value "1" And the field "Override for Student 2" matches value "1"
# And the field "Grade for Test assignment three" matches value "1.00" And the field "Grade for Student 3" matches value "2.00"
# And the field "Override for Test assignment three" matches value "1" And the field "Override for Student 3" matches value "1"
# And the field "Grade for Test assignment four" matches value "1.00" And the field "Grade for Student 4" matches value "2.00"
# And the field "Override for Test assignment four" matches value "1" And the field "Override for Student 4" matches value "1"
#
# Scenario: I can not update grades if the value is out of bounds. Scenario: I can bulk insert grades and check their override flags for user view.
# Given I am on the "Course 1" course page logged in as teacher1 Given I am on the "Test assignment two" "assign activity" page logged in as teacher1
# And I navigate to "View > Grader report" in the course gradebook And I follow "View all submissions"
# And I follow "Single view for Test assignment one" And I click on "Grade" "link" in the "Student 1" "table_row"
# And I set the field "Perform bulk insert" to "1" And I set the following fields to these values:
# When I set the field "Insert value" to "-1" | Grade out of 100 | 50 |
# And I press "Save" And I press "Save changes"
# Then I should see "The grade entered for Test assignment one for Student 1 is less than the minimum allowed" And I am on "Course 1" course homepage with editing mode on
# And I should see "The grade entered for Test assignment one for Student 2 is less than the minimum allowed" And I navigate to "View > Grader report" in the course gradebook
# And I should see "The grade entered for Test assignment one for Student 3 is less than the minimum allowed" # And I click on "input[title='Dock Navigation block']" "css_element"
# And I should see "The grade entered for Test assignment one for Student 4 is less than the minimum allowed" # And I click on "input[title='Dock Administration block']" "css_element"
# And I should see "Grades were set for 0 items" And I follow "Single view for Student 1"
Then the field "Grade for Test assignment two" matches value "50.00"
And the field "Override for Test assignment two" matches value "0"
And I click on "Actions" "link"
And I click on "Bulk insert" "link"
And I click on "I understand that my unsaved data might be lost" "checkbox"
And I click on "Empty grades" "radio"
And I set the field "Insert value modal" to "1.0"
And I click on "Save" "button" in the ".modal-dialog" "css_element"
And the field "Grade for Test assignment two" matches value "50.00"
And the field "Override for Test assignment two" matches value "0"
And the field "Grade for Test assignment one" matches value "1.00"
And the field "Override for Test assignment one" matches value "1"
And the field "Grade for Test assignment three" matches value "1.00"
And the field "Override for Test assignment three" matches value "1"
And the field "Grade for Test assignment four" matches value "1.00"
And the field "Override for Test assignment four" matches value "1"
Scenario: I can not update grades if the value is out of bounds.
Given I am on the "Course 1" course page logged in as teacher1
And I turn editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I follow "Single view for Test assignment one"
And I click on "Actions" "link"
And I click on "Bulk insert" "link"
And I click on "I understand that my unsaved data might be lost" "checkbox"
And I click on "Empty grades" "radio"
And I set the field "Insert value modal" to "-1"
And I click on "Save" "button" in the ".modal-dialog" "css_element"
Then I should see "The grade entered for Test assignment one for Student 1 is less than the minimum allowed"
And I should see "The grade entered for Test assignment one for Student 2 is less than the minimum allowed"
And I should see "The grade entered for Test assignment one for Student 3 is less than the minimum allowed"
And I should see "The grade entered for Test assignment one for Student 4 is less than the minimum allowed"
And I should see "Grades were set for 0 items"

View file

@ -112,32 +112,38 @@ Feature: We can use Single view
And I follow "Single view for Ann, Jill, Grainne, Beauchamp" And I follow "Single view for Ann, Jill, Grainne, Beauchamp"
Then I should see "Gronya,Beecham" Then I should see "Gronya,Beecham"
# Scenario: I can bulk update grades. Scenario: I can bulk update grades.
# Given I follow "Single view for Ann, Jill, Grainne, Beauchamp" Given I follow "Single view for Ann, Jill, Grainne, Beauchamp"
# Then I should see "Gronya,Beecham" And I should see "Gronya,Beecham"
# When I set the field "For" to "All grades" When I turn editing mode on
# And I set the field "Insert value" to "1.0" And I click on "Actions" "link"
# And I set the field "Perform bulk insert" to "1" And I click on "Bulk insert" "link"
# And I press "Save" And I click on "I understand that my unsaved data might be lost" "checkbox"
# Then I should see "Grades were set for 6 items" And I click on "All grades" "radio"
# And I set the field "Insert value modal" to "1.0"
# Scenario: I can bulk update grades with custom decimal separator And I click on "Save" "button" in the ".modal-dialog" "css_element"
# Given the following "language customisations" exist: Then I should see "Grades were set for 6 items"
# | component | stringid | value |
# | core_langconfig | decsep | # | Scenario: I can bulk update grades with custom decimal separator
# And I follow "Single view for Ann, Jill, Grainne, Beauchamp" Given the following "language customisations" exist:
# And I should see "Gronya,Beecham" | component | stringid | value |
# When I set the field "For" to "All grades" | core_langconfig | decsep | # |
# And I set the field "Insert value" to "1#25" And I follow "Single view for Ann, Jill, Grainne, Beauchamp"
# And I set the field "Perform bulk insert" to "1" And I should see "Gronya,Beecham"
# And I press "Save" When I turn editing mode on
# Then I should see "Grades were set for 6 items" And I click on "Actions" "link"
# # Custome scale, cast to int And I click on "Bulk insert" "link"
# And the field "Grade for new grade item 1" matches value "Disappointing" And I click on "I understand that my unsaved data might be lost" "checkbox"
# # Value grade, float with custom decsep. And I click on "All grades" "radio"
# And the field "Grade for Test assignment one" matches value "1#25" And I set the field "Insert value modal" to "1#25"
# # Numerical scale, cast to int, showing as float with custom decsep. And I click on "Save" "button" in the ".modal-dialog" "css_element"
# And the field "Grade for Test grade item" matches value "1#00" Then I should see "Grades were set for 6 items"
# Custome scale, cast to int
And the field "Grade for new grade item 1" matches value "Disappointing"
# Value grade, float with custom decsep.
And the field "Grade for Test assignment one" matches value "1#25"
# Numerical scale, cast to int, showing as float with custom decsep.
And the field "Grade for Test grade item" matches value "1#00"
Scenario: Navigation works in the Single view. Scenario: Navigation works in the Single view.
Given I follow "Single view for Ann, Jill, Grainne, Beauchamp" Given I follow "Single view for Ann, Jill, Grainne, Beauchamp"
@ -154,8 +160,7 @@ Feature: We can use Single view
And I follow "Test assignment four" And I follow "Test assignment four"
Then I should see "Test assignment four" Then I should see "Test assignment four"
Scenario: Activities are clickable only when Scenario: Activities are clickable only when it has a valid activity page.
it has a valid activity page.
Given I follow "Single view for Ann, Jill, Grainne, Beauchamp" Given I follow "Single view for Ann, Jill, Grainne, Beauchamp"
And "new grade item 1" "link" should not exist in the "//tbody//tr[position()=1]//td[position()=2]" "xpath_element" And "new grade item 1" "link" should not exist in the "//tbody//tr[position()=1]//td[position()=2]" "xpath_element"
Then "Category total" "link" should not exist in the "//tbody//tr[position()=2]//td[position()=2]" "xpath_element" Then "Category total" "link" should not exist in the "//tbody//tr[position()=2]//td[position()=2]" "xpath_element"