From cff60901418b88f9b9a5085c5aba616d10a7b4e7 Mon Sep 17 00:00:00 2001 From: mioyu-ubiq Date: Tue, 6 Jan 2026 17:06:19 +0800 Subject: [PATCH 1/2] MDL-87090 mod_assign : Teacher can override assignment deadlines --- .../behat/assign_override_deadline.feature | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 public/mod/assign/tests/behat/assign_override_deadline.feature diff --git a/public/mod/assign/tests/behat/assign_override_deadline.feature b/public/mod/assign/tests/behat/assign_override_deadline.feature new file mode 100644 index 00000000000..728b1f36c0b --- /dev/null +++ b/public/mod/assign/tests/behat/assign_override_deadline.feature @@ -0,0 +1,72 @@ +@mod @mod_assign +Feature: Assign override deadlines + In order to grant students deadline override + As a teacher + I need to create an override for the students. + + 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 | + And the following "courses" exist: + | fullname | shortname | category | + | 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 | + And the following "groups" exist: + | name | course | idnumber | + | Group 1 | C1 | G1 | + | Group 2 | C1 | G2 | + And the following "group members" exist: + | user | group | + | student1 | G1 | + | student3 | G1 | + | student2 | G2 | + | student3 | G2 | + 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 navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect + And I press "Add group override" + And I set the following fields to these values: + | Override group | Group 1 | + | Due date | ##1 Jan 2020 08:00## | + And I press "Save" + And I press "Add group override" + And I set the following fields to these values: + | Override group | Group 2 | + | Due date | ##2 Jan 2020 08:00## | + And I press "Save" + And I select "User overrides" from the "jump" singleselect + And I press "Add user override" + And I set the following fields to these values: + | 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" + And I navigate to "Overrides" in current page administration + And I select "Group overrides" from the "jump" singleselect + And I follow "Move down" + 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 + 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." From 5d46e3c88ebee662198d7bddc9bff89bd40a6387 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Mon, 19 Jan 2026 13:38:41 +0800 Subject: [PATCH 2/2] MDL-87090 behat: improve new test --- .../behat/assign_override_deadline.feature | 74 +++++++++++++------ 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/public/mod/assign/tests/behat/assign_override_deadline.feature b/public/mod/assign/tests/behat/assign_override_deadline.feature index 728b1f36c0b..56d64e34dd7 100644 --- a/public/mod/assign/tests/behat/assign_override_deadline.feature +++ b/public/mod/assign/tests/behat/assign_override_deadline.feature @@ -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"