MDL-87090 behat: improve new test

This commit is contained in:
Simey Lameze
2026-01-19 14:14:01 +08:00
parent 9c9b31658d
commit 99809ba681
@@ -6,20 +6,20 @@ Feature: Assign override deadlines
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Tina | Teacher1 | teacher1@example.com |
| student1 | Sam1 | Student1 | student1@example.com |
| student2 | Sam2 | Student2 | student2@example.com |
| student3 | Sam3 | Student3 | student3@example.com |
| username | firstname | lastname | email |
| teacher1 | Tina | Teacher1 | teacher1@example.com |
| student1 | Sam1 | Student1 | student1@example.com |
| student2 | Sam2 | Student2 | student2@example.com |
| student3 | Sam3 | Student3 | student3@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
@@ -33,10 +33,7 @@ Feature: Assign override deadlines
And the following "activities" exist:
| activity | name | intro | course | assignsubmission_onlinetext_enabled |
| assign | Test assignment name | Submit your online text | C1 | 1 |
@javascript
Scenario: Teacher can override assignment deadlines
Given I am on the "Test assignment name" Activity page logged in as teacher1
And I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Overrides" in current page administration
And I select "Group overrides" from the "jump" singleselect
And I press "Add group override"
@@ -55,18 +52,47 @@ Feature: Assign override deadlines
| Override user | student1 |
| Due date | ##3 January 2031 08:00## |
And I press "Save"
And I navigate to "Submissions" in current page administration
And I should see "Wednesday, 1 January 2020, 8:00"
And I should see "Thursday, 2 January 2020, 8:00"
And I should see "Friday, 3 January 2031, 8:00"
@javascript
Scenario: Teacher can override assignment deadlines
Given I navigate to "Submissions" in current page administration
Then the following should exist in the "generaltable" table:
| First name | Due date |
| Sam1 Student1 | Friday, 3 January 2031, 8:00 AM |
| Sam2 Student2 | Thursday, 2 January 2020, 8:00 AM |
| Sam3 Student3 | Wednesday, 1 January 2020, 8:00 AM |
@javascript
Scenario: Students see overridden assignment deadlines
When I am on the "Test assignment name" Activity page logged in as student1
Then I should see "Due: Friday, 3 January 2031, 8:00"
And I am on the "Test assignment name" Activity page logged in as student2
And I should see "Due: Thursday, 2 January 2020, 8:00"
And I am on the "Test assignment name" Activity page logged in as student3
And I should see "Due: Wednesday, 1 January 2020, 8:00"
@javascript
Scenario: Teacher can reorder group overrides
Given I am on the "Test assignment name" Activity page logged in as teacher1
And I navigate to "Overrides" in current page administration
And I select "Group overrides" from the "jump" singleselect
And I follow "Move down"
When I click on "Move down" "link" in the "Group 1" "table_row"
# Verify the position of Group 1 and Group 2 has swapped in the list.
Then the following should exist in the "generaltable" table:
| Group | Overrides | -3- |
| Group 2 | Due date | Thursday, 2 January 2020, 8:00 AM |
| Group 1 | Due date | Wednesday, 1 January 2020, 8:00 AM |
And I navigate to "Submissions" in current page administration
And "Sam3 Student3" row "Due date" column of "submissions" table should contain "Thursday, 2 January 2020, 8:00"
And I am on "Course 1" course homepage with editing mode on
When I open "Test assignment name" actions menu
And I choose "Hide" in the open action menu
Then "Sam3 Student3" row "Due date" column of "submissions" table should contain "Thursday, 2 January 2020, 8:00"
@javascript
Scenario: Inactive override due to hidden assignment
Given I am on "Course 1" course homepage with editing mode on
And I open "Test assignment name" actions menu
When I choose "Hide" in the open action menu
And I am on the "Test assignment name" Activity page
And I navigate to "Overrides" in current page administration
Then I should see "* This override is inactive because the user's access to the activity is restricted. This can be due to group or role assignments, other access restrictions, or the activity being hidden."
And "Edit" "icon" should exist in the "Sam1 Student1" "table_row"
And "copy" "icon" should exist in the "Sam1 Student1" "table_row"
And "Delete" "icon" should exist in the "Sam1 Student1" "table_row"