MDL-75513 gradereport_user: Add behat tests

This commit is contained in:
Mihail Geshoski 2022-10-10 22:13:59 +08:00
parent 3414a93268
commit e8caeb85e3
2 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,55 @@
@core @core_grades @gradereport_user @javascript
Feature: User can toggle the visibility of the grade categories within the user grade report.
In order to focus only on the information that I am interested in
As a teacher
I need to be able to easily toggle the visibility of grade categories in the user grade report
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "grade categories" exist:
| fullname | course |
| Category 1 | C1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | 300 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | gradecategory | grade | gradepass |
| assign | C1 | a2 | Test assignment two | Submit something! | Category 1 | 100 | 50 |
And I log in as "teacher1"
And I am on "Course" course homepage
Scenario: A teacher can search for and find a user to view
Given I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
And I should see "Test assignment one" in the "user-grade" "table"
And I should see "Test assignment two" in the "user-grade" "table"
And I should see "Category 1 total" in the "user-grade" "table"
And I should see "Course total" in the "user-grade" "table"
# Hide the grade category 'Category 1'.
When I click on ".toggle-category" "css_element" in the "Category 1" "table_row"
Then I should not see "Test assignment two" in the "user-grade" "table"
And I should not see "Category 1 total" in the "user-grade" "table"
And I should see "Test assignment one" in the "user-grade" "table"
And I should see "Course total" in the "user-grade" "table"
# Show the grade category 'Category 1'.
And I click on ".toggle-category" "css_element" in the "Category 1" "table_row"
And I should see "Test assignment two" in the "user-grade" "table"
And I should see "Category 1 total" in the "user-grade" "table"
And I should see "Test assignment one" in the "user-grade" "table"
And I should see "Course total" in the "user-grade" "table"
# Hide the grade category 'Course'.
And I click on ".toggle-category" "css_element" in the "Course" "table_row"
And I should not see "Test assignment two" in the "user-grade" "table"
And I should not see "Category 1 total" in the "user-grade" "table"
And I should not see "Test assignment one" in the "user-grade" "table"
And I should not see "Course total" in the "user-grade" "table"

View File

@ -0,0 +1,65 @@
@core @core_grades @gradereport_user @javascript
Feature: Teacher can navigate to the previous or next user report.
In order to get go the previous or next user report
As a teacher
I need to click on the previous/next navigation links
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
| student2 | Student | 2 | student2@example.com | s2 |
| student3 | Student | 3 | student3@example.com | s3 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | 300 |
And I log in as "teacher1"
And I am on "Course" course homepage
Scenario: A teacher can navigate to the next user report
Given I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
And I should see "Student 1" in the ".user-heading" "css_element"
And ".previous" "css_element" should not exist in the ".user-navigation" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".next" "css_element"
When I click on "Student 2" "link" in the ".next" "css_element"
Then I should see "Student 2" in the ".user-heading" "css_element"
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 1" in the ".previous" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 3" in the ".next" "css_element"
And I click on "Student 3" "link" in the ".next" "css_element"
And I should see "Student 3" in the ".user-heading" "css_element"
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".previous" "css_element"
And ".next" "css_element" should not exist in the ".user-navigation" "css_element"
Scenario: A teacher can navigate to the previous user report
Given I navigate to "View > User report" in the course gradebook
And I click on "Student 3" in the "user" search widget
And I should see "Student 3" in the ".user-heading" "css_element"
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".previous" "css_element"
And ".next" "css_element" should not exist in the ".user-navigation" "css_element"
When I click on "Student 2" "link" in the ".previous" "css_element"
Then I should see "Student 2" in the ".user-heading" "css_element"
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 1" in the ".previous" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 3" in the ".next" "css_element"
And I click on "Student 1" "link" in the ".previous" "css_element"
And I should see "Student 1" in the ".user-heading" "css_element"
And ".previous" "css_element" should not exist in the ".user-navigation" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".next" "css_element"