moodle/grade/report/user/tests/behat/view_usereport.feature
Ilya Tregubov b699da1461
MDL-76445 core_grades: Use group select instead of group search
On Moodle 4.1 we don't have group search on grader report.
That is only available in 4.2+
2023-06-14 09:34:22 +08:00

121 lines
6.2 KiB
Gherkin

@core @core_grades @gradereport_user @javascript
Feature: We can use the user report
As a user
I browse to the User report
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
Scenario: Verify we can view a user grade report with no users enrolled.
Given I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "View > User report" in the course gradebook
And I click on "All users (0)" in the "user" search widget
Then I should see "There are no students enrolled in this course."
Scenario: Teacher sees his last viewed user report when navigating back to the gradebook user report.
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| teacher2 | Teacher | 2 | teacher2@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher2 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > User report" in the course gradebook
And I should see "Select a user above to view their report" in the "region-main" "region"
And I click on "Student 1" in the "user" search widget
And I should see "Student 1" in the "region-main" "region"
And I am on "Course 1" course homepage
When I navigate to "View > User report" in the course gradebook
Then I should not see "Select a user above to view their report" in the "region-main" "region"
And I should see "Student 1" in the "region-main" "region"
And I log out
And I log in as "teacher2"
And I am on "Course 1" course homepage
And I navigate to "View > User report" in the course gradebook
And I should see "Select a user above to view their report" in the "region-main" "region"
Scenario: Teacher sees his last viewed user report if the user is a part of the the current group.
Given the following "groups" exist:
| name | course | idnumber | participation |
| Group 1 | C1 | G1 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "group members" exist:
| user | group |
| student2 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > User report" in the course gradebook
And I click on "Student 2" in the "user" search widget
And I navigate to "View > Grader report" in the course gradebook
And I select "Group 1" from the "group" singleselect
When I navigate to "View > User report" in the course gradebook
Then I should see "Student 2" in the "region-main" "region"
And I should not see "Select a user above to view their report" in the "region-main" "region"
Scenario: Teacher does not see the last viewed user if the user is not a part of the the current group.
Given the following "groups" exist:
| name | course | idnumber | participation |
| Group 1 | C1 | G1 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "group members" exist:
| user | group |
| student2 | G1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
And I navigate to "View > Grader report" in the course gradebook
And I click on "Group 1" in the "group" search widget
When I navigate to "View > User report" in the course gradebook
Then I should see "Select a user above to view their report" in the "region-main" "region"
And I should not see "Student 1" in the "region-main" "region"
Scenario: Teacher does not see his last viewed user report if the user is no longer enrolled in the course.
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And 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 "region-main" "region"
And I navigate to course participants
And I click on "Unenrol" "icon" in the "Student 1" "table_row"
And I click on "Unenrol" "button" in the "Unenrol" "dialogue"
And I am on "Course 1" course homepage
When I navigate to "View > User report" in the course gradebook
Then I should see "Select a user above to view their report" in the "region-main" "region"
And I should not see "Student 1" in the "region-main" "region"