first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,140 @@
@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
I can bulk insert values for all or empty grades.
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber | alternatename |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 | fred |
| student1 | Student | 1 | student1@example.com | s1 | james |
| student2 | Student | 2 | student1@example.com | s2 | holly |
| student3 | Student | 3 | student1@example.com | s3 | anna |
| student4 | Student | 4 | student1@example.com | s4 | zac |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| student4 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro |
| assign | C1 | a1 | Test assignment one | Submit something! |
| assign | C1 | a2 | Test assignment two | Submit something! |
| assign | C1 | a3 | Test assignment three | Submit something! |
| assign | C1 | a4 | Test assignment four | Submit nothing! |
And I am on the "Course 1" "Course" page logged in as "teacher1"
And I turn editing mode on
Scenario: I can not save bulk insert until I fill required form elements
Given I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
And I click on "Actions" "link"
When I click on "Bulk insert" "link"
And the "Empty grades" "radio" should be disabled
And the "All grades" "radio" should be disabled
And the "[name=bulkinsertmodal]" "css_element" should be disabled
And the "[data-action=save]" "css_element" should be disabled
And I click on "I understand that my unsaved changes will be lost." "checkbox"
And the "Empty grades" "radio" should be enabled
And the "All grades" "radio" should be enabled
And the "[name=bulkinsertmodal]" "css_element" should be enabled
And the "[data-action=save]" "css_element" should be disabled
And I click on "Empty grades" "radio"
And the "Empty grades" "radio" should be enabled
And the "All grades" "radio" should be enabled
And the "[name=bulkinsertmodal]" "css_element" should be enabled
Then the "[data-action=save]" "css_element" should be enabled
Scenario: I can bulk insert grades and check their override flags for grade view.
Given I am on the "Test assignment one" "assign activity" page
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 am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
And the field "Grade for Student 1" matches value "50.00"
And the field "Override for Student 1" 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 changes will be lost." "checkbox"
And I click on "Empty grades" "radio"
And I set the field "Insert new grade" to "1.0"
And I click on "Save" "button" in the ".modal-dialog" "css_element"
And the field "Grade for Student 1" matches value "50.00"
And the field "Override for Student 1" matches value "0"
And the field "Grade for Student 2" matches value "1.00"
And the field "Override for Student 2" matches value "1"
And the field "Grade for Student 3" matches value "1.00"
And the field "Override for Student 3" matches value "1"
And the field "Grade for Student 4" matches value "1.00"
And the field "Override for Student 4" matches value "1"
And I click on "Actions" "link"
When I click on "Bulk insert" "link"
And I click on "I understand that my unsaved changes will be lost." "checkbox"
And I click on "All grades" "radio"
And I set the field "Insert new grade" to "2.0"
And I click on "Save" "button" in the ".modal-dialog" "css_element"
And the field "Grade for Student 1" matches value "2.00"
And the field "Override for Student 1" matches value "1"
And the field "Grade for Student 2" matches value "2.00"
And the field "Override for Student 2" matches value "1"
And the field "Grade for Student 3" matches value "2.00"
And the field "Override for Student 3" matches value "1"
And the field "Grade for Student 4" matches value "2.00"
Then the field "Override for Student 4" matches value "1"
Scenario: I can bulk insert grades and check their override flags for user view.
Given I am on the "Test assignment two" "assign activity" page
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 am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I click on user menu "Student 1"
And I choose "Single view for this user" in the open action menu
And 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"
When I click on "Bulk insert" "link"
And I click on "I understand that my unsaved changes will be lost." "checkbox"
And I click on "Empty grades" "radio"
And I set the field "Insert new grade" 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"
Then 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 navigate to "View > Grader report" in the course gradebook
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
And I click on "Actions" "link"
When I click on "Bulk insert" "link"
And I click on "I understand that my unsaved changes will be lost." "checkbox"
And I click on "Empty grades" "radio"
And I set the field "Insert new grade" to "-1"
And I click on "Save" "button" in the ".modal-dialog" "css_element"
And 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"
Then I should see "Grades were set for 0 items"
@@ -0,0 +1,70 @@
@core @core_grades @gradereport_singleview @javascript
Feature: Given we have opted to search for a grade item, Lets find and search them.
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
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 "activities" exist:
| activity | course | idnumber | name |
| assign | C1 | a1 | Test assignment one |
| assign | C1 | a2 | Test assignment two |
And I am on the "Course 1" "grades > Single view > View" page logged in as "teacher1"
And I change window size to "large"
Scenario: A teacher can search for and find a grade item to view
Given I click on "Grade items" "link" in the ".page-toggler" "css_element"
And I click on ".gradesearchwidget" "css_element"
When I confirm "Test assignment one" in "grade" search within the gradebook widget exists
And I confirm "Test assignment two" in "grade" search within the gradebook widget exists
Then I set the field "Search items" to "two"
And I wait until "Test assignment one" "option_role" does not exist
And I confirm "Test assignment one" in "grade" search within the gradebook widget does not exist
And I confirm "Test assignment two" in "grade" search within the gradebook widget exists
And I click on "Test assignment two" in the "grade" search widget
# The search input remains in the field on reload this is in keeping with other search implementations.
And I click on ".gradesearchwidget" "css_element"
And the field "Search items" matches value "two"
Then I set the field "Search items" to "Turtle"
And I should see "No results for \"Turtle\""
@accessibility
Scenario: A teacher can set focus and search using the input with a keyboard
# Basic tests for the page.
Given I click on "Grade items" "link" in the ".page-toggler" "css_element"
And I click on ".gradesearchwidget" "css_element"
And the page should meet accessibility standards
And the page should meet "wcag131, wcag141, wcag412" accessibility standards
And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests
# Move onto general keyboard navigation testing.
And I click on "Search items" "field"
And I wait until "Test assignment one" "option_role" exists
And I press the down key
And the focused element is "Search items" "field"
And ".active" "css_element" should exist in the "Test assignment one" "option_role"
And I press the up key
And the focused element is "Search items" "field"
And ".active" "css_element" should exist in the "Course total" "option_role"
And I press the down key
And the focused element is "Search items" "field"
And ".active" "css_element" should exist in the "Test assignment one" "option_role"
Then I set the field "Search items" to "Goodmeme"
And I wait until "Test assignment one" "option_role" does not exist
And I press the down key
And the focused element is "Search items" "field"
# Lets check the tabbing order.
And I set the field "Search items" to "one"
And I wait until "Test assignment one" "option_role" exists
And I press the tab key
And the focused element is "Clear search input" "button" in the ".grade-search" "css_element"
And I press the enter key
And I wait until the page is ready
And ".gradesearchwidget" "css_element" should exist
@@ -0,0 +1,95 @@
@gradereport @gradereport_singleview @javascript
Feature: Singleview report pagination
In order to consume the content of the report better
As a teacher
I need the report to be paginated
Background:
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | 300 |
Scenario: Default is used when teachers have no preference yet on singleview report
Given "41" "users" exist with the following data:
| username | student[count] |
| firstname | Student |
| lastname | [count] |
| email | student[count]@example.com |
And "41" "course enrolments" exist with the following data:
| user | student[count] |
| course | C1 |
| role |student |
When I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
Then the field "perpage" matches value "20"
# There is also 1 header row.
And I should see "21" node occurrences of type "tr" in the "singleview-grades" "table"
And I should see "3" in the ".stickyfooter .pagination" "css_element"
And I should not see "4" in the ".stickyfooter .pagination" "css_element"
Scenario: Teachers can have their preference for the number of students on singleview report
Given the following "courses" exist:
| fullname | shortname |
| Course 2 | C2 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C2 | editingteacher |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C2 | a2 | Test assignment two | Submit something! | 300 |
When I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
And I set the field "perpage" to "100"
And I am on the "Course 2" "grades > Grader report > View" page
And I click on grade item menu "Test assignment two" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
Then the field "perpage" matches value "100"
Scenario: Teachers can change the number of students shown on singleview report
Given "101" "users" exist with the following data:
| username | student[count] |
| firstname | Student |
| lastname | [count] |
| email | student[count]@example.com |
And "101" "course enrolments" exist with the following data:
| user | student[count] |
| course | C1 |
| role |student |
When I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
And I set the field "perpage" to "100"
# There is also 1 header row.
Then I should see "101" node occurrences of type "tr" in the "singleview-grades" "table"
And I should see "2" in the ".stickyfooter .pagination" "css_element"
And I should not see "3" in the ".stickyfooter .pagination" "css_element"
@javascript
Scenario: The pagination bar is only displayed when there is more than one page on singleview report
Given "21" "users" exist with the following data:
| username | student[count] |
| firstname | Student |
| lastname | [count] |
| email | student[count]@example.com |
And "21" "course enrolments" exist with the following data:
| user | student[count] |
| course | C1 |
| role |student |
When I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
# By default, we have 20 students per page.
And ".stickyfooter .pagination" "css_element" should exist
And I set the field "perpage" to "100"
Then ".stickyfooter .pagination" "css_element" should not exist
@@ -0,0 +1,26 @@
@core @core_grades @gradereport_singleview @javascript
Feature: Given we land on the index page, select what type of report we wish to view.
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
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 "activities" exist:
| activity | course | idnumber | name |
| assign | C1 | a1 | Test assignment one |
Scenario: I switch between the two report types within singleview
Given I am on the "Course 1" "grades > Single view > View" page logged in as "teacher1"
And I click on "Grade items" "link" in the ".page-toggler" "css_element"
And "Search users" "field" should not exist
And I confirm "Test assignment one" in "grade" search within the gradebook widget exists
When I click on "Users" "link" in the ".page-toggler" "css_element"
Then "Search users" "field" should exist
And "Select a grade item" "combobox" should not exist
@@ -0,0 +1,260 @@
@core @core_grades @gradereport_singleview @javascript
Feature: We can use Single view
As a teacher
In order to view and edit grades
For users and activities for a course.
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber | middlename | alternatename | firstnamephonetic | lastnamephonetic |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 | | fred | | |
| teacher2 | No edit | 1 | teacher2@example.com | t2 | | nick | | |
| teacher3 | Teacher | 3 | teacher3@example.com | t3 | | jack | | |
| student1 | Grainne | Beauchamp | student1@example.com | s1 | Ann | Jill | Gronya | Beecham |
| student2 | Niamh | Cholmondely | student2@example.com | s2 | Jane | Nina | Nee | Chumlee |
| student3 | Siobhan | Desforges | student3@example.com | s3 | Sarah | Sev | Shevon | De-forjay |
| student4 | Student | 4 | student4@example.com | s4 | | zac | | |
And the following "scales" exist:
| name | scale |
| Test Scale | Disappointing, Good, Very good, Excellent |
And the following "grade items" exist:
| itemname | course | gradetype | scale |
| new grade item 1 | C1 | Scale | Test Scale |
And the following "scales" exist:
| name | scale |
| Test Scale | Disappointing, Good, Very good, Excellent |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher2 | C1 | teacher |
| teacher3 | C1 | teacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| student4 | C1 | student |
And the following "grade categories" exist:
| fullname | course |
| Sub category 1 | C1|
| Sub category 2 | C1|
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | 300 |
| assign | C1 | a2 | Test assignment two | Submit something! | 100 |
| assign | C1 | a3 | Test assignment three | Submit something! | 150 |
| assign | C1 | a4 | Test assignment four | Submit nothing! | 150 |
And the following "grade items" exist:
| itemname | course | gradetype |
| Test grade item | C1 | Scale |
And the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/grade:edit | Allow | teacher | Course | C1 |
| gradereport/singleview:view | Allow | teacher | Course | C1 |
And the following config values are set as admin:
| fullnamedisplay | firstnamephonetic,lastnamephonetic |
| alternativefullnameformat | middlename, alternatename, firstname, lastname |
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
Scenario: I can update grades, add feedback and exclude grades.
Given I navigate to "View > Single view" in the course gradebook
And I click on "Users" "link" in the ".page-toggler" "css_element"
And I click on "Student" in the "user" search widget
And I turn editing mode on
And I set the field "Override for Test assignment one" to "1"
When I set the following fields to these values:
| Grade for Test assignment one | 10.00 |
| Feedback for Test assignment one | test data |
And I set the field "Exclude for Test assignment four" to "1"
And I press "Save"
Then I should see "Grades were set for 2 items"
And the field "Exclude for Test assignment four" matches value "1"
And the field "Grade for Test assignment one" matches value "10.00"
And I set the following fields to these values:
| Test grade item | 45 |
And I press "Save"
Then I should see "Grades were set for 1 items"
And the field "Grade for Test grade item" matches value "45.00"
And the field "Grade for Course total" matches value "55.00"
And I open the action menu in "Test assignment three" "table_row"
And I choose "Show all grades" in the open action menu
And I click on "Override for Ann, Jill, Grainne, Beauchamp" "checkbox"
And I set the following fields to these values:
| Grade for Ann, Jill, Grainne, Beauchamp | 12.05 |
| Feedback for Ann, Jill, Grainne, Beauchamp | test data2 |
And I set the field "Exclude for Jane, Nina, Niamh, Cholmondely" to "1"
And I press "Save"
Then I should see "Grades were set for 2 items"
And the field "Grade for Ann, Jill, Grainne, Beauchamp" matches value "12.05"
And the field "Exclude for Jane, Nina, Niamh, Cholmondely" matches value "1"
And I click on "new grade item 1" in the "grade" search widget
And I set the field "Grade for Ann, Jill, Grainne, Beauchamp" to "Very good"
And I press "Save"
Then I should see "Grades were set for 1 items"
And the following should exist in the "generaltable" table:
| User full name | Grade |
| Ann, Jill, Grainne, Beauchamp | Very good |
And I am on the "Course 1" "grades > Single view > View" page logged in as "teacher2"
And I click on "Users" "link" in the ".page-toggler" "css_element"
And I click on "Student" in the "user" search widget
And I turn editing mode on
And the "Exclude for Test assignment one" "checkbox" should be disabled
And the "Override for Test assignment one" "checkbox" should be enabled
Scenario: Single view links work on grade report.
Given I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
And I choose "Single view for this item" in the open action menu
And I should see "Test assignment one"
When I navigate to "View > Grader report" in the course gradebook
And I click on user menu "Grainne Beauchamp"
And I choose "Single view for this user" in the open action menu
Then I should see "Gronya,Beecham"
Scenario: I can bulk update grades.
Given I click on user menu "Grainne Beauchamp"
And I choose "Single view for this user" in the open action menu
And I should see "Gronya,Beecham"
When I turn editing mode on
And I click on "Actions" "link"
And I click on "Bulk insert" "link"
And I click on "I understand that my unsaved changes will be lost." "checkbox"
And I click on "All grades" "radio"
And I set the field "Insert new grade" to "1.0"
And I click on "Save" "button" in the ".modal-dialog" "css_element"
Then I should see "Grades were set for 6 items"
Scenario: I can bulk update grades with custom decimal separator
Given the following "language customisations" exist:
| component | stringid | value |
| core_langconfig | decsep | # |
And I click on user menu "Grainne Beauchamp"
And I choose "Single view for this user" in the open action menu
And I should see "Gronya,Beecham"
When I turn editing mode on
And I click on "Actions" "link"
And I click on "Bulk insert" "link"
And I click on "I understand that my unsaved changes will be lost." "checkbox"
And I click on "All grades" "radio"
And I set the field "Insert new grade" to "1#25"
And I click on "Save" "button" in the ".modal-dialog" "css_element"
Then I should see "Grades were set for 6 items"
# Custom 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.
Given I click on user menu "Grainne Beauchamp"
And I choose "Single view for this user" in the open action menu
Then I should see "Gronya,Beecham"
And I click on "Nee,Chumlee" "link" in the ".stickyfooter" "css_element"
Then I should see "Nee,Chumlee"
And I click on "Gronya,Beecham" "link" in the ".stickyfooter" "css_element"
Then I should see "Gronya,Beecham"
And I open the action menu in "Test assignment four" "table_row"
And I choose "Show all grades" in the open action menu
Then I should see "Test assignment four"
And I click on "Test assignment three" in the "grade" search widget
Then I should see "Test assignment three"
And I click on "Test assignment four" in the "grade" search widget
Then I should see "Test assignment four"
Scenario: Activities are clickable only when it has a valid activity page.
Given I click on user menu "Grainne Beauchamp"
And I choose "Single view for this user" in the open action menu
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"
And "Course total" "link" should not exist in the "//tbody//tr[position()=last()]//td[position()=2]" "xpath_element"
Scenario: Teacher sees his last viewed singleview report type when navigating back to the gradebook singleview report.
Given I navigate to "View > Single view" in the course gradebook
And I should see "Search for a user to view all their grades" in the "region-main" "region"
And I click on "Grade items" "link"
And I should see "Select a grade item above" in the "region-main" "region"
When I am on the "Course 1" "grades > Single view > View" page
Then I should see "Select a grade item above" in the "region-main" "region"
And I am on the "Course 1" "grades > Single view > View" page logged in as "teacher3"
And I should see "Search for a user to view all their grades" in the "region-main" "region"
Scenario: Teacher sees his last viewed user report when navigating back to the gradebook singleview report.
Given I navigate to "View > Single view" in the course gradebook
And I click on "Gronya,Beecham" in the "user" search widget
And I should see "Gronya,Beecham" in the "region-main" "region"
When I am on the "Course 1" "grades > Single view > View" page
Then I should not see "Search for a user to view all their grades" in the "region-main" "region"
And I should see "Gronya,Beecham" in the "region-main" "region"
And I am on the "Course 1" "grades > Single view > View" page logged in as "teacher3"
And I should see "Search for a user to view all their grades" in the "region-main" "region"
Scenario: Teacher sees his last viewed grade item report when navigating back to the gradebook singleview report.
Given I navigate to "View > Single view" in the course gradebook
And I click on "Grade items" "link"
And I click on "Test assignment one" in the "grade" search widget
And I should see "Test assignment one" in the "region-main" "region"
When I am on the "Course 1" "grades > Single view > View" page
Then I should not see "Select a grade item above" in the "region-main" "region"
And I should see "Test assignment one" in the "region-main" "region"
And I am on the "Course 1" "grades > Single view > View" page logged in as "teacher3"
And I should see "Search for a user to view all their grades" 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 "group members" exist:
| user | group |
| student2 | G1 |
And I am on the "Course 1" "course editing" page
And I expand all fieldsets
And I set the field "Group mode" to "Visible groups"
And I press "Save and display"
And I navigate to "View > Single view" in the course gradebook
And I click on "Nee,Chumlee" 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 > Single view" in the course gradebook
Then I should see "Nee,Chumlee" in the "region-main" "region"
And I should not see "Search for a user to view all their grades" in the "region-main" "region"
Scenario: Teacher does not see his last viewed user report 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 "group members" exist:
| user | group |
| student2 | G1 |
And I am on the "Course 1" "course editing" page
And I expand all fieldsets
And I set the field "Group mode" to "Visible groups"
And I press "Save and display"
And I navigate to "View > Single view" in the course gradebook
And I click on "Gronya,Beecham" 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 > Single view" in the course gradebook
Then I should see "Search for a user to view all their grades" in the "region-main" "region"
And I should not see "Gronya,Beecham" in the "region-main" "region"
Scenario: Teacher does not see his last viewed user report if that user is no longer enrolled in the course.
Given I navigate to "View > Single view" in the course gradebook
And I click on "Gronya,Beecham" in the "user" search widget
And I navigate to course participants
And I click on "Unenrol" "icon" in the "Gronya,Beecham" "table_row"
And I click on "Unenrol" "button" in the "Unenrol" "dialogue"
When I am on the "Course 1" "grades > Single view > View" page
Then I should see "Search for a user to view all their grades" in the "region-main" "region"
And I should not see "Gronya,Beecham" in the "region-main" "region"
Scenario: Teacher does not see his last viewed grade item report if the item no longer exists in the course.
Given I navigate to "View > Single view" in the course gradebook
And I click on "Grade items" "link"
And I click on "Test assignment four" in the "grade" search widget
And I am on "Course 1" course homepage with editing mode on
And I delete "Test assignment four" activity
And I run all adhoc tasks
When I navigate to "View > Single view" in the course gradebook
Then I should see "Select a grade item above" in the "region-main" "region"
And I should not see "Test grade item" in the "region-main" "region"
@@ -0,0 +1,222 @@
@core @core_grades @gradereport_singleview @javascript
Feature: Within the singleview report, a teacher can search for users.
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
| Course 2 | C2 | 0 | 0 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber | phone1 | phone2 | department | institution | city | country |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 | 1234567892 | 1234567893 | ABC1 | ABCD | Perth | AU |
| student1 | Student | 1 | student1@example.com | s1 | 3213078612 | 8974325612 | ABC1 | ABCD | Hanoi | VN |
| student2 | Dummy | User | student2@example.com | s2 | 4365899871 | 7654789012 | ABC2 | ABCD | Tokyo | JP |
| student3 | User | Example | student3@example.com | s3 | 3243249087 | 0875421745 | ABC2 | ABCD | Olney | GB |
| student4 | User | Test | student4@example.com | s4 | 0987532523 | 2149871323 | ABC3 | ABCD | Tokyo | JP |
| student5 | Turtle | Manatee | student5@example.com | s5 | 1239087780 | 9873623589 | ABC3 | ABCD | Perth | AU |
# Note: Add groups etc so we can test that the search ignores those filters as well if we go down the filter dataset path.
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| student4 | C1 | student |
| student5 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name |
| assign | C1 | a1 | Test assignment one |
And the following config values are set as admin:
| showuseridentity | idnumber,email,city,country,phone1,phone2,department,institution |
And I change window size to "large"
And I am on the "Course 1" "grades > Single view > View" page logged in as "teacher1"
And I click on "Users" "link" in the ".page-toggler" "css_element"
Scenario: A teacher can view and trigger the user search
# Check the placeholder text (no users are initially shown).
Given I should see "Search users"
And I should see "Search for a user to view all their grades"
When I set the field "Search users" to "Turtle"
And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
And I confirm "User Example" in "user" search within the gradebook widget does not exist
And I click on "Turtle Manatee" "list_item"
# Business case: This will trigger a page reload and can not dynamically update the table.
And I wait until the page is ready
And "Turtle Manatee" "heading" should exist
And "Teacher 1" "heading" should not exist
And "Student 1" "heading" should not exist
And "User Example" "heading" should not exist
And "User Test" "heading" should not exist
And "Dummy User" "heading" should not exist
And I set the field "Search users" to "Turt"
And I wait until "Turtle Manatee" "option_role" exists
And I click on "Clear search input" "button" in the ".user-search" "css_element"
And "Turtle Manatee" "option_role" should not be visible
Scenario: A teacher can search the single view report to find specified users
# Case: Standard search.
Given I click on "Dummy" in the "user" search widget
And "Dummy User" "heading" should exist
And "Teacher 1" "heading" should not exist
And "Student 1" "heading" should not exist
And "User Example" "heading" should not exist
And "User Test" "heading" should not exist
And "Turtle Manatee" "heading" should not exist
# Case: No users found.
When I set the field "Search users" to "Plagiarism"
And I should see "No results for \"Plagiarism\""
# Table remains unchanged as the user had no results to select from the dropdown.
And "Dummy User" "heading" should exist
And "Teacher 1" "heading" should not exist
And "Student 1" "heading" should not exist
And "User Example" "heading" should not exist
And "User Test" "heading" should not exist
And "Turtle Manatee" "heading" should not exist
# Case: Multiple users found and select only one result.
Then I set the field "Search users" to "User"
And I wait until "Dummy User" "option_role" exists
And I confirm "Dummy User" in "user" search within the gradebook widget exists
And I confirm "User Example" in "user" search within the gradebook widget exists
And I confirm "User Test" in "user" search within the gradebook widget exists
And I confirm "Turtle Manatee" in "user" search within the gradebook widget does not exist
# Check if the matched field names (by lines) includes some identifiable info to help differentiate similar users.
And I confirm "User (student2@example.com)" in "user" search within the gradebook widget exists
And I confirm "User (student3@example.com)" in "user" search within the gradebook widget exists
And I confirm "User (student4@example.com)" in "user" search within the gradebook widget exists
And I click on "Dummy User" "list_item"
And I wait until the page is ready
And "Dummy User" "heading" should exist
And "Teacher 1" "heading" should not exist
And "Student 1" "heading" should not exist
And "User Example" "heading" should not exist
And "User Test" "heading" should not exist
And "Turtle Manatee" "heading" should not exist
# Case: No users enrolled.
And I am on the "Course 2" "grades > Single view > View" page
And I click on "Users" "link" in the ".page-toggler" "css_element"
And I set the field "Search users" to "a"
And I wait until "No results for \"a\"" "text" exists
Scenario: A teacher can quickly tell that a search is active on the current table
Given I click on "Turtle" in the "user" search widget
And I wait until the page is ready
# The search input remains in the field on reload this is in keeping with other search implementations.
When the field "Search users" matches value "Turtle Manatee"
# The users get preloaded for accessibility reasons.
And "Turtle Manatee" "option_role" should exist
# Test if we can then further retain the turtle result set and further filter from there.
Then I set the field "Search users" to "Turtle plagiarism"
And I wait until "Turtle Manatee" "option_role" does not exist
And I should see "No results for \"Turtle plagiarism\""
Scenario: A teacher can search for values besides the users' name
Given I set the field "Search users" to "student5@example.com"
And I wait until "Turtle Manatee" "list_item" exists
And I set the field "Search users" to "@example.com"
And I wait until "Dummy User" "list_item" exists
# Note: All learners match this email & showing emails is current default.
And I confirm "Dummy User" in "user" search within the gradebook widget exists
And I confirm "User Example" in "user" search within the gradebook widget exists
And I confirm "User Test" in "user" search within the gradebook widget exists
And I confirm "Student 1" in "user" search within the gradebook widget exists
And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
# Search on the country field.
When I set the field "Search users" to "JP"
And I wait until "Dummy User" "list_item" exists
And I wait until "Turtle Manatee" "list_item" does not exist
And I confirm "Dummy User" in "user" search within the gradebook widget exists
And I confirm "User Test" in "user" search within the gradebook widget exists
# Search on the city field.
And I set the field "Search users" to "Hanoi"
And I wait until "User Test" "list_item" does not exist
Then I confirm "Student 1" in "user" search within the gradebook widget exists
# Search on the institution field.
And I set the field "Search users" to "ABCD"
And I wait until "Dummy User" "list_item" exists
And I confirm "User Example" in "user" search within the gradebook widget exists
And I confirm "User Test" in "user" search within the gradebook widget exists
And I confirm "Student 1" in "user" search within the gradebook widget exists
And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
# Search on the department field.
And I set the field "Search users" to "ABC3"
And I wait until "User Example" "list_item" does not exist
And I confirm "User Test" in "user" search within the gradebook widget exists
And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
# Search on the phone1 field.
And I set the field "Search users" to "4365899871"
And I wait until "User Test" "list_item" does not exist
And I confirm "Dummy User" in "user" search within the gradebook widget exists
# Search on the phone2 field.
And I set the field "Search users" to "2149871323"
And I wait until "Dummy User" "list_item" does not exist
And I confirm "User Test" in "user" search within the gradebook widget exists
# Search on the institution field then press enter to show the record set.
And I set the field "Search users" to "ABC"
And "Turtle Manatee" "list_item" should exist
And I confirm "Dummy User" in "user" search within the gradebook widget exists
And I confirm "User Example" in "user" search within the gradebook widget exists
And I confirm "User Test" in "user" search within the gradebook widget exists
And I confirm "Student 1" in "user" search within the gradebook widget exists
And I press the down key
And I press the enter key
And I wait until the page is ready
And "Student 1" "heading" should exist
And "User Example" "heading" should not exist
And "User Test" "heading" should not exist
And "Dummy User" "heading" should not exist
And "Turtle Manatee" "heading" should not exist
And "Teacher 1" "heading" should not exist
@accessibility
Scenario: A teacher can set focus and search using the input are with a keyboard
Given I set the field "Search users" to "ABC"
# Basic tests for the page.
And the page should meet accessibility standards
And the page should meet "wcag131, wcag141, wcag412" accessibility standards
And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests
# Move onto general keyboard navigation testing.
When I wait until "Turtle Manatee" "option_role" exists
And I press the down key
And ".active" "css_element" should exist in the "Student 1" "option_role"
And I press the up key
And ".active" "css_element" should exist in the "Dummy User" "option_role"
And I press the down key
And ".active" "css_element" should exist in the "Student 1" "option_role"
And I press the escape key
And the focused element is "Search users" "field"
Then I set the field "Search users" to "Goodmeme"
And I press the down key
And the focused element is "Search users" "field"
And I navigate to "View > Single view" in the course gradebook
And I click on "Users" "link" in the ".page-toggler" "css_element"
And I set the field "Search users" to "ABC"
And I wait until "Turtle Manatee" "option_role" exists
And I press the down key
And ".active" "css_element" should exist in the "Student 1" "option_role"
# Lets check the tabbing order.
And I set the field "Search users" to "ABC"
And I wait until "Turtle Manatee" "option_role" exists
And I press the tab key
And the focused element is "Clear search input" "button" in the ".user-search" "css_element"
And I press the tab key
And the focused element is not "Search users" "field"
# Ensure we can interact with the clear search with the keyboard.
# Sometimes with behat we get unattached nodes causing spurious failures.
And I set the field "Search users" to "ABC"
And I wait "1" seconds
And I press the tab key
And the focused element is "Clear search input" "button" in the ".user-search" "css_element"
And I press the enter key
And I confirm "Turtle Manatee" in "user" search within the gradebook widget does not exist
+55
View File
@@ -0,0 +1,55 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Fixtures for single view report screen class testing.
*
* @package gradereport_singleview
* @copyright 2014 onwards Simey Lameze <simey@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
class gradereport_singleview_screen_testable extends \gradereport_singleview\local\screen\screen {
/**
* Wrapper to make protected method accessible during testing.
*
* @return array returns array of users.
*/
public function test_load_users(): array {
return $this->load_users();
}
/**
* Return the HTML for the page.
*/
public function init($selfitemisempty = false) {
}
/**
* Get the type of items on this screen, not valid so return false.
*/
public function item_type(): string {
}
/**
* Return the HTML for the page.
*/
public function html(): string {
}
}
@@ -0,0 +1,104 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace gradereport_singleview;
use gradereport_singleview_screen_testable;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once(__DIR__ . '/fixtures/screen.php');
require_once($CFG->libdir . '/gradelib.php');
/**
* Tests for screen class.
*
* @package gradereport_singleview
* @category test
* @copyright 2014 onwards Simey Lameze <simey@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class screen_test extends \advanced_testcase {
/**
* Test load_users method.
*/
public function test_load_users(): void {
global $DB;
$this->setAdminUser();
$this->resetAfterTest(true);
$roleteacher = $DB->get_record('role', ['shortname' => 'teacher'], '*', MUST_EXIST);
// Create a course, users and groups.
$course = $this->getDataGenerator()->create_course();
$coursecontext = \context_course::instance($course->id);
$group = $this->getDataGenerator()->create_group(['courseid' => $course->id]);
$teacher = $this->getDataGenerator()->create_user();
$user1 = $this->getDataGenerator()->create_user();
$user2 = $this->getDataGenerator()->create_user();
$this->getDataGenerator()->enrol_user($teacher->id, $course->id, $roleteacher->id);
$this->getDataGenerator()->enrol_user($user1->id, $course->id);
$this->getDataGenerator()->enrol_user($user2->id, $course->id);
$this->getDataGenerator()->create_group_member(['groupid' => $group->id, 'userid' => $teacher->id]);
$this->getDataGenerator()->create_group_member(['groupid' => $group->id, 'userid' => $user1->id]);
$this->getDataGenerator()->create_group_member(['groupid' => $group->id, 'userid' => $user2->id]);
// Perform a regrade before creating the report.
grade_regrade_final_grades($course->id);
$screentest = new gradereport_singleview_screen_testable($course->id, 0, $group->id);
$groupusers = $screentest->test_load_users();
$this->assertDebuggingCalled('The function load_users() is deprecated. ' .
'Please use grade_report::get_gradable_users() instead.');
$this->assertCount(2, $groupusers);
// Now, let's suspend the enrolment of a user. Should return only one user.
$this->getDataGenerator()->enrol_user($user2->id, $course->id, $roleteacher->id, 'manual', 0, 0, ENROL_USER_SUSPENDED);
$users = $screentest->test_load_users();
$this->assertDebuggingCalled('The function load_users() is deprecated. ' .
'Please use grade_report::get_gradable_users() instead.');
$this->assertCount(1, $users);
// Change the viewsuspendedusers capabilities and set the user preference to display suspended users.
assign_capability('moodle/course:viewsuspendedusers', CAP_ALLOW, $roleteacher->id, $coursecontext, true);
set_user_preference('grade_report_showonlyactiveenrol', false, $teacher);
accesslib_clear_all_caches_for_unit_testing();
$this->setUser($teacher);
$screentest = new gradereport_singleview_screen_testable($course->id, 0, $group->id);
$users = $screentest->test_load_users();
$this->assertDebuggingCalled('The function load_users() is deprecated. ' .
'Please use grade_report::get_gradable_users() instead.');
$this->assertCount(2, $users);
// Change the capability again, now the user can't see the suspended enrolments.
assign_capability('moodle/course:viewsuspendedusers', CAP_PROHIBIT, $roleteacher->id, $coursecontext, true);
set_user_preference('grade_report_showonlyactiveenrol', false, $teacher);
accesslib_clear_all_caches_for_unit_testing();
$users = $screentest->test_load_users();
$this->assertDebuggingCalled('The function load_users() is deprecated. ' .
'Please use grade_report::get_gradable_users() instead.');
$this->assertCount(1, $users);
// Now, activate the user enrolment again. We shall get 2 users now.
$this->getDataGenerator()->enrol_user($user2->id, $course->id, $roleteacher->id, 'manual', 0, 0, ENROL_USER_ACTIVE);
$users = $screentest->test_load_users();
$this->assertDebuggingCalled('The function load_users() is deprecated. ' .
'Please use grade_report::get_gradable_users() instead.');
$this->assertCount(2, $users);
}
}