Skip to content

Commit

Permalink
MDL-78684 Behat: Replace gradebook navigation to use page resolvers
Browse files Browse the repository at this point in the history
This commit also does other things such as:
- Replace manual steps to setup gradebook by data generators
- Added support for outcomes and scales page resolvers
- Behat clean up
  • Loading branch information
andelacruz committed Aug 8, 2023
1 parent 1474f74 commit 6385949
Show file tree
Hide file tree
Showing 75 changed files with 371 additions and 871 deletions.
41 changes: 11 additions & 30 deletions admin/tool/behat/tests/behat/data_generators.feature
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ Feature: Set up contextual data for tests
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
When I log in as "student1"
And I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as student1
Then I should see "Topic 1"

Scenario: Add role assigns
Expand Down Expand Up @@ -135,17 +134,11 @@ Feature: Set up contextual data for tests
When I log in as "user1"
And I am on site homepage
Then edit mode should be available on the current page
And I log out
And I log in as "user2"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as user2
Then edit mode should be available on the current page
And I log out
And I log in as "user3"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as user3
Then edit mode should be available on the current page
And I log out
And I log in as "user4"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as user4
Then edit mode should be available on the current page
And I log out
And I log in as "user5"
Expand Down Expand Up @@ -186,8 +179,7 @@ Feature: Set up contextual data for tests
And the following "activities" exist:
| activity | name | intro | course | idnumber | grade |
| assign | Test assignment name with scale | Test assignment description | C1 | assign1 | Test Scale 1 |
When I log in as "admin"
And I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as admin
Then I should see "Test assignment name"
# Assignment 2.2 module type is disabled by default
# And I should see "Test assignment22 name"
Expand Down Expand Up @@ -303,9 +295,7 @@ Feature: Set up contextual data for tests
And the following "grade categories" exist:
| fullname | course | gradecategory |
| Grade sub category 2 | C1 | Grade category 1 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
When I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
Then I should see "Grade category 1"
And I should see "Grade sub category 2"

Expand All @@ -326,9 +316,7 @@ Feature: Set up contextual data for tests
| itemname | course | gradecategory |
| Test Grade Item 2 | C1 | Grade category 1 |
| Test Grade Item 3 | C1 | Grade sub category 2 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
When I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
Then I should see "Test Grade Item 1"
And I click on grade item menu "Test Grade Item 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
Expand Down Expand Up @@ -357,9 +345,7 @@ Feature: Set up contextual data for tests
And the following "scales" exist:
| name | scale |
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Scales" in the course gradebook
When I am on the "Course 1" "grades > scales" page logged in as admin
Then I should see "Test Scale 1"
And I should see "Disappointing, Good, Very good, Excellent"

Expand All @@ -378,9 +364,7 @@ Feature: Set up contextual data for tests
| Grade outcome 2 | OT2 | C1 | Test Scale 1 |
And the following config values are set as admin:
| enableoutcomes | 1 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "More > Outcomes" in the course gradebook
When I am on the "Course 1" "grades > outcomes" page logged in as admin
Then I should see "Grade outcome 1" in the "#addoutcomes" "css_element"
And I should see "Grade outcome 2" in the "#removeoutcomes" "css_element"
And I press "Manage outcomes"
Expand All @@ -406,9 +390,7 @@ Feature: Set up contextual data for tests
| Test Outcome Grade Item 1 | C1 | OT1 | Grade category 1 |
And the following config values are set as admin:
| enableoutcomes | 1 |
When I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
When I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
Then I should see "Test Outcome Grade Item 1"
And I click on grade item menu "Test Outcome Grade Item 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
Expand All @@ -424,6 +406,5 @@ Feature: Set up contextual data for tests
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| online_users | Course | C1 | course-view-* | site-pre |
When I log in as "admin"
And I am on "Course 1" course homepage
When I am on the "Course 1" course page logged in as admin
Then I should see "Online users"
5 changes: 1 addition & 4 deletions admin/tool/recyclebin/tests/behat/backup_user_data.feature
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ Feature: Backup user data
And I navigate to "Recycle bin" in current page administration
And I should see "Quiz 1"
And I click on "Restore" "link" in the "region-main" "region"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I navigate to "User report" in the course gradebook
When I am on the "Course 1" "grades > User report > View" page logged in as "student1"
Then "Quiz 1" row "Grade" column of "user-grade" table should contain "50"
And "Quiz 1" row "Percentage" column of "user-grade" table should contain "50"

Expand Down
17 changes: 7 additions & 10 deletions blocks/activity_results/tests/behat/addblockinactivity.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,15 @@ Feature: The activity results block displays student scores
And the following "activities" exist:
| activity | name | content | course | section | idnumber |
| page | Test page name | This is a page | C1 | 1 | page1 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment 1 | student1 | 90.00 |
| Test assignment 1 | student2 | 80.00 |
| Test assignment 1 | student3 | 70.00 |
| Test assignment 1 | student4 | 60.00 |
| Test assignment 1 | student5 | 50.00 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I should see "Test page name"
And I navigate to "View > Grader report" in the course gradebook
And I change window size to "large"
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment 1"
And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment 1"
And I give the grade "70.00" to the user "Student 3" for the grade item "Test assignment 1"
And I give the grade "60.00" to the user "Student 4" for the grade item "Test assignment 1"
And I give the grade "50.00" to the user "Student 5" for the grade item "Test assignment 1"
And I press "Save changes"
And I am on "Course 1" course homepage

Scenario: Configure the block on a non-graded activity to show 3 high scores
Given I am on the "Test page name" "page activity" page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ Feature: The activity results block displays student high scores
And the following "activities" exist:
| activity | name | intro | course | section | idnumber | assignsubmission_file_enabled |
| assign | Test assignment | Offline text | C1 | 1 | assign1 | 0 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment | student1 | 90.00 |
| Test assignment | student2 | 80.00 |
| Test assignment | student3 | 70.00 |
| Test assignment | student4 | 60.00 |
| Test assignment | student5 | 50.00 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment"
And I give the grade "70.00" to the user "Student 3" for the grade item "Test assignment"
And I give the grade "60.00" to the user "Student 4" for the grade item "Test assignment"
And I give the grade "50.00" to the user "Student 5" for the grade item "Test assignment"
And I press "Save changes"
And I am on "Course 1" course homepage

Scenario: Configure the block on the course page to show 0 high scores
Given I add the "Activity results" block to the default region with:
Expand Down
18 changes: 5 additions & 13 deletions blocks/activity_results/tests/behat/highscoreswithscales.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,15 @@ Feature: The activity results block displays students high scores in group as sc
| name | Test assignment |
| intro | Offline text |
| assignsubmission_file_enabled | 0 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Scales" in the course gradebook
And I press "Add a new scale"
And I set the following fields to these values:
| Name | My Scale |
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I press "Save changes"
And I am on "Course 1" course homepage
And I follow "Test assignment"
And I navigate to "Settings" in current page administration
And the following "scales" exist:
| name | scale |
| My Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I am on the "Test assignment" "assign activity editing" page logged in as teacher1
And I set the following fields to these values:
| id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode on
And I give the grade "Excellent!" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "Very good" to the user "Student 2" for the grade item "Test assignment"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,19 @@ Feature: The activity results block displays student in group high scores as sca
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Test assignment | Offline text | C1 | 1 | assign1 |
And the following "scales" exist:
| name | scale |
| My Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I change window size to "large"
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "Scales" in the course gradebook
And I press "Add a new scale"
And I set the following fields to these values:
| Name | My Scale |
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I press "Save changes"
And I am on "Course 1" course homepage
And I am on the "Test assignment" "assign activity" page
And I navigate to "Settings" in current page administration
And I am on the "Test assignment" "assign activity editing" page logged in as teacher1
And I set the following fields to these values:
| assignsubmission_file_enabled | 0 |
| id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale |
| Group mode | Separate groups |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I am on the "Course 1" "grades > Grader report > View" page
And I give the grade "Excellent!" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "Very good" to the user "Student 2" for the grade item "Test assignment"
And I give the grade "Very good" to the user "Student 3" for the grade item "Test assignment"
Expand All @@ -81,9 +74,7 @@ Feature: The activity results block displays student in group high scores as sca
| config_usegroups | Yes |
Then I should see "Group 1" in the "Activity results" "block"
And I should see "Excellent!" in the "Activity results" "block"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "Student 1" in the "Activity results" "block"
And I should see "Excellent!" in the "Activity results" "block"

Expand All @@ -99,9 +90,7 @@ Feature: The activity results block displays student in group high scores as sca
And I should see "Very good" in the "Activity results" "block"
And I should see "Group 3" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student3
And I should see "Student 3" in the "Activity results" "block"
And I should see "Very good" in the "Activity results" "block"
And I should see "Student 4" in the "Activity results" "block"
Expand All @@ -119,10 +108,8 @@ Feature: The activity results block displays student in group high scores as sca
And I should see "Excellent!" in the "Activity results" "block"
And I should see "Very good" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
And I log out
# Students cannot see user identity fields.
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "User" in the "Activity results" "block"
And I should not see "User S1" in the "Activity results" "block"
And I should see "Excellent!" in the "Activity results" "block"
Expand All @@ -139,9 +126,7 @@ Feature: The activity results block displays student in group high scores as sca
And I should see "Excellent!" in the "Activity results" "block"
And I should see "Very good" in the "Activity results" "block"
And I should see "Good" in the "Activity results" "block"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I am on the "Course 1" course page logged in as student1
And I should see "User" in the "Activity results" "block"
And I should see "Excellent!" in the "Activity results" "block"
And I should see "Very good" in the "Activity results" "block"
Loading

0 comments on commit 6385949

Please sign in to comment.