Skip to content

Commit

Permalink
MDL-78673 grade: Switch to behat navigation steps
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jul 10, 2023
1 parent 7961e16 commit 23c2c5d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
12 changes: 12 additions & 0 deletions grade/tests/behat/behat_grades.php
Expand Up @@ -33,6 +33,8 @@ class behat_grades extends behat_base {
* Recognised page names are:
* | pagetype | name meaning | description |
* | [report] view | Course name | The view page for the specified course and report |
* | gradebook setup | Course name | The gradebook setup page for the specified course |
* | course grade settings | Course name | The grade settings page |
*
* @param string $type identifies which type of page this is - for example "Grader > View"
* @param string $identifier identifies the particular page - for example "Course name"
Expand Down Expand Up @@ -72,6 +74,16 @@ protected function resolve_page_instance_url(string $type, string $identifier):
"/grade/report/{$plugin}/index.php",
['id' => $this->get_course_id($identifier)]
);
case 'gradebook setup':
return new moodle_url(
"/grade/edit/tree/index.php",
['id' => $this->get_course_id($identifier)]
);
case 'course grade settings':
return new moodle_url(
"/grade/edit/settings/index.php",
['id' => $this->get_course_id($identifier)]
);
default:
throw new \coding_exception(
"Unknown page type '$type' for page identifier '$identifier'"
Expand Down
39 changes: 20 additions & 19 deletions grade/tests/behat/grade_average.feature
@@ -1,46 +1,47 @@
@core @core_grades @javascript
Feature: Average grades are displayed in the gradebook
In order to check the expected results are displayed
As an admin
I need to assign grades and check that they display correctly in the gradebook.
In order to check the expected results are displayed
As an admin
I need to assign grades and check that they display correctly in the gradebook.

Background:
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
| Course 1 | C1 | topics |
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 |
| student3 | Student | 3 | student3@example.com |
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| student3 | Student | 3 | student3@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And I log in as "admin"
And I am on "Course 1" course homepage
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
# Enable averages
And I navigate to "Setup > Course grade settings" in the course gradebook
And I am on the "Course 1" "grades > course grade settings" page logged in as "admin"
And I set the following fields to these values:
| Show average | Show |
And I press "Save changes"

# Add a manual grade item
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I am on the "Course 1" "grades > gradebook setup" page
And I press "Add grade item"
And I set the following fields to these values:
| Item name | Manual item 1 |
And I press "Save changes"

# Give all student the same grade for the manual grade item
And I navigate to "View > Grader report" in the course gradebook
And I am on the "Course 1" "grades > grader > View" page
And I turn editing mode on
And I give the grade "50.00" to the user "Student 1" for the grade item "Manual item 1"
And I give the grade "50.00" to the user "Student 2" for the grade item "Manual item 1"
And I give the grade "50.00" to the user "Student 3" for the grade item "Manual item 1"
And I press "Save changes"
And I turn editing mode off

# Suspend a user
And I am on the "Course 1" "enrolled users" page
And I click on "Edit enrolment" "link" in the "Student 2" "table_row"
Expand Down

0 comments on commit 23c2c5d

Please sign in to comment.