diff --git a/admin/tool/behat/tests/behat/datetime_strings.feature b/admin/tool/behat/tests/behat/datetime_strings.feature index 1e15acc262f..59799ac529d 100644 --- a/admin/tool/behat/tests/behat/datetime_strings.feature +++ b/admin/tool/behat/tests/behat/datetime_strings.feature @@ -21,5 +21,5 @@ Feature: Transform date time string arguments And I log in as "teacher1" And I am on "Course 1" course homepage And I follow "Test assignment name" - And I should see "##yesterday##l, j F Y##" + And I should see "##yesterday##%A, %d %B %Y##" And I log out diff --git a/lib/tests/behat/behat_transformations.php b/lib/tests/behat/behat_transformations.php index 7e4fd490b4c..cd5c4a41221 100644 --- a/lib/tests/behat/behat_transformations.php +++ b/lib/tests/behat/behat_transformations.php @@ -167,8 +167,8 @@ class behat_transformations extends behat_base { $count = count($timepassed); if ($count === 2) { - // If timestamp with spcified format, then retrun date. - return date($timepassed[1], $timestamp); + // If timestamp with specified strftime format, then return formatted date string. + return userdate($timestamp, $timepassed[1]); } else if ($count === 1) { return $timestamp; } else { diff --git a/lib/upgrade.txt b/lib/upgrade.txt index c064e0a075e..397664609c6 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -1,6 +1,11 @@ This files describes API changes in core libraries and APIs, information provided here is intended especially for developers. +=== 3.10.3 === +* The behat transformation 'string time to timestamp' no longer supports datetime format. If provided, the format must + be strftime compatible. Example: + - I should see "##tomorrow noon##%A, %d %B %Y, %I:%M %p##" + === 3.10.1 === * New optional parameter $extracontent for print_collapsible_region_start(). This allows developers to add interactive HTML elements (e.g. a help icon) after the collapsible region's toggle link. diff --git a/message/tests/behat/delete_messages.feature b/message/tests/behat/delete_messages.feature index 1504d8ebb89..ebe35eda322 100644 --- a/message/tests/behat/delete_messages.feature +++ b/message/tests/behat/delete_messages.feature @@ -57,7 +57,7 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element" Then I should not see "Delete" And I should not see "Hi!" - And I should see "##today##j F##" in the "Group 1" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Group 1" "core_message > Message conversation" And I should see "How are you?" in the "Group 1" "core_message > Message conversation" And I should see "Can somebody help me?" in the "Group 1" "core_message > Message conversation" And I should not see "Messages selected" @@ -78,7 +78,7 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element" Then I should not see "Delete" And I should not see "Hi!" - And I should see "##today##j F##" in the "Group 1" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Group 1" "core_message > Message conversation" And I should not see "How are you?" in the "Group 1" "core_message > Message conversation" And I should see "Can somebody help me?" in the "Group 1" "core_message > Message conversation" And I should not see "Messages selected" @@ -124,7 +124,7 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element" Then I should not see "Delete" And I should not see "Hi!" - And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation" And I should see "Hello!" in the "Student 2" "core_message > Message conversation" And I should see "Are you free?" in the "Student 2" "core_message > Message conversation" And I should not see "Messages selected" @@ -148,7 +148,7 @@ Feature: Delete messages from conversations Then I should not see "Delete" And I should not see "Hi!" And I should not see "Hello!" in the "Student 2" "core_message > Message conversation" - And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation" And I should see "Are you free?" in the "Student 2" "core_message > Message conversation" And I should not see "Messages selected" # Check messages were not deleted for the other user @@ -197,7 +197,7 @@ Feature: Delete messages from conversations And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element" Then I should not see "Delete" And I should not see "Hi!" - And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation" And I should see "Hello!" in the "Student 2" "core_message > Message conversation" And I should not see "Messages selected" @@ -221,7 +221,7 @@ Feature: Delete messages from conversations Then I should not see "Delete" And I should not see "Hi!" And I should not see "Hello!" in the "Student 2" "core_message > Message conversation" - And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation" And I should see "Are you free?" in the "Student 2" "core_message > Message conversation" And I should not see "Messages selected" diff --git a/message/tests/behat/message_delete_conversation.feature b/message/tests/behat/message_delete_conversation.feature index 5d7d65a31de..7740972a471 100644 --- a/message/tests/behat/message_delete_conversation.feature +++ b/message/tests/behat/message_delete_conversation.feature @@ -37,7 +37,7 @@ Feature: Message delete conversations And I should not see "Delete" And I should not see "Hi!" in the "Student 1" "core_message > Message conversation" And I should not see "What do you need?" in the "Student 1" "core_message > Message conversation" - And I should not see "##today##j F##" in the "Student 1" "core_message > Message conversation" + And I should not see "##today##%d %B##" in the "Student 1" "core_message > Message conversation" # Check user is deleting private conversation only for them And I log out And I log in as "student1" @@ -45,7 +45,7 @@ Feature: Message delete conversations And I select "Student 2" conversation in the "messages" conversations list And I should see "Hi!" in the "Student 2" "core_message > Message conversation" And I should see "What do you need?" in the "Student 2" "core_message > Message conversation" - And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation" Scenario: Cancel deleting a private conversation Given I log in as "student1" @@ -58,7 +58,7 @@ Feature: Message delete conversations And I click on "//button[@data-action='cancel-confirm']" "xpath_element" And I should not see "Cancel" And I should see "Hi!" in the "Student 2" "core_message > Message conversation" - And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation" Scenario: Delete a starred conversation Given the following "favourite conversations" exist: @@ -75,7 +75,7 @@ Feature: Message delete conversations And I should not see "Delete" And I should not see "Hi!" in the "Student 2" "core_message > Message conversation" And I should not see "What do you need?" in the "Student 2" "core_message > Message conversation" - And I should not see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should not see "##today##%d %B##" in the "Student 2" "core_message > Message conversation" # Check user is deleting private conversation only for them And I log out And I log in as "student2" @@ -83,7 +83,7 @@ Feature: Message delete conversations And I select "Student 1" conversation in the "messages" conversations list And I should see "Hi!" in the "Student 1" "core_message > Message conversation" And I should see "What do you need?" in the "Student 1" "core_message > Message conversation" - And I should see "##today##j F##" in the "Student 1" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 1" "core_message > Message conversation" Scenario: Cancel deleting a starred conversation Given the following "favourite conversations" exist: @@ -93,7 +93,7 @@ Feature: Message delete conversations And I open messaging And I select "Student 2" conversation in the "favourites" conversations list Then I should see "Hi!" in the "Student 2" "core_message > Message conversation" - And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation" And I open contact menu And I click on "Delete conversation" "link" in the "//div[@data-region='header-container']" "xpath_element" # Cancel deletion, so conversation should be there @@ -101,7 +101,7 @@ Feature: Message delete conversations And I click on "//button[@data-action='cancel-confirm']" "xpath_element" And I should not see "Cancel" And I should see "Hi!" in the "Student 2" "core_message > Message conversation" - And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation" Scenario: Check a deleted starred conversation is still starred Given the following "favourite conversations" exist: diff --git a/message/tests/behat/message_send_messages.feature b/message/tests/behat/message_send_messages.feature index 519cee1649c..d729ce68522 100644 --- a/message/tests/behat/message_send_messages.feature +++ b/message/tests/behat/message_send_messages.feature @@ -35,7 +35,7 @@ Feature: Message send messages And I select "Group 1" conversation in messaging When I send "Hi!" message in the message area Then I should see "Hi!" in the "Group 1" "core_message > Message conversation" - And I should see "##today##j F##" in the "Group 1" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Group 1" "core_message > Message conversation" And I log out And I log in as "student2" And I open messaging @@ -57,7 +57,7 @@ Feature: Message send messages And I select "Group 1" conversation in the "favourites" conversations list And I send "Hi!" message in the message area And I should see "Hi!" in the "Group 1" "core_message > Message conversation" - And I should see "##today##j F##" in the "Group 1" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Group 1" "core_message > Message conversation" And I go back in "view-conversation" message drawer And I open the "Group" conversations list And I should not see "Group 1" in the "Group" "core_message > Message tab" @@ -72,14 +72,14 @@ Feature: Message send messages And I click on "Student 2" "link" in the "//*[@data-section='contacts']" "xpath_element" When I send "Hi!" message in the message area Then I should see "Hi!" in the "Student 2" "core_message > Message conversation" - And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation" Scenario: Try to send a message to a private conversation is not contact but you are allowed to send a message Given I log in as "student1" And I open messaging When I send "Hi!" message to "Student 2" user Then I should see "Hi!" in the "Student 2" "core_message > Message conversation" - And I should see "##today##j F##" in the "Student 2" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation" And I log out And I log in as "student2" And I open messaging diff --git a/message/tests/behat/self_conversation.feature b/message/tests/behat/self_conversation.feature index ea7a669cce4..ea612d2b6c2 100644 --- a/message/tests/behat/self_conversation.feature +++ b/message/tests/behat/self_conversation.feature @@ -55,7 +55,7 @@ Feature: Self conversation And I select "Student 1" conversation in messaging And I send "Hi!" message in the message area And I should see "Hi!" in the "Student 1" "core_message > Message conversation" - And I should see "##today##j F##" in the "Student 1" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 1" "core_message > Message conversation" Scenario: Send a message to a self-conversation via user profile Given I log in as "student1" @@ -64,4 +64,4 @@ Feature: Self conversation And I click on "Message" "icon" And I send "Hi!" message in the message area And I should see "Hi!" in the "Student 1" "core_message > Message conversation" - And I should see "##today##j F##" in the "Student 1" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "Student 1" "core_message > Message conversation" diff --git a/message/tests/behat/unread_messages.feature b/message/tests/behat/unread_messages.feature index bf6095e12ad..7051b231fba 100644 --- a/message/tests/behat/unread_messages.feature +++ b/message/tests/behat/unread_messages.feature @@ -35,7 +35,7 @@ Feature: Unread messages And I select "New group" conversation in messaging And I send "Hi!" message in the message area And I should see "Hi!" in the "New group" "core_message > Message conversation" - And I should see "##today##j F##" in the "New group" "core_message > Message conversation" + And I should see "##today##%d %B##" in the "New group" "core_message > Message conversation" And I log out And I log in as "student2" And I should see "1" in the "//*[@title='Toggle messaging drawer']/../*[@data-region='count-container']" "xpath_element" diff --git a/mod/assign/tests/behat/set_availability.feature b/mod/assign/tests/behat/set_availability.feature new file mode 100644 index 00000000000..75ce429132e --- /dev/null +++ b/mod/assign/tests/behat/set_availability.feature @@ -0,0 +1,158 @@ +@mod @mod_assign @javascript +Feature: Set availability dates for an assignment + In order to control when a student can upload an assignment + As a teacher + I need be able to set availability dates for an assignment + + 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 | + | 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 "activity" exists: + | activity | assign | + | course | C1 | + | name | Assignment name | + | idnumber | assign | + | description | Assignment description | + | assignsubmission_file_enabled | 1 | + | assignsubmission_file_maxfiles | 1 | + | assignsubmission_file_maxsizebytes | 0 | + | submissiondrafts | 0 | + + Scenario: Student cannot submit an assignment prior to the 'allow submissions from' date + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Assignment name" + And I navigate to "Edit settings" in current page administration + And I follow "Expand all" + # Set 'Allow submissions from' to tomorrow at noon. + And I set the field "Allow submissions from" to "##tomorrow noon##" + And I press "Save and return to course" + And I log out + And I log in as "student1" + And I am on "Course 1" course homepage + When I follow "Assignment name" + Then "Add submission" "button" should not exist + And I should see "This assignment will accept submissions from" + And I should see "##tomorrow noon##%A, %d %B %Y, %I:%M %p##" + + Scenario: Student can see the assignment's due date in the course calendar + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Assignment name" + And I navigate to "Edit settings" in current page administration + And I follow "Expand all" + # Set 'Allow submissions from' to the first day of this month at noon. + And I set the field "Allow submissions from" to "##first day of this month noon##" + # Set 'Due date' to the second day of this month at noon. + And I set the field "Due date" to "##first day of this month noon +24 hours##" + And I press "Save and return to course" + And I log out + And I log in as "student1" + And I am on "Course 1" course homepage + And I follow "Calendar" + When I hover over day "2" of this month in the calendar + Then I should see "C1: Assignment name is due" + + @_file_upload + Scenario: Student can submit an assignment before the due date + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Assignment name" + And I navigate to "Edit settings" in current page administration + And I follow "Expand all" + # Set 'Allow submissions from' to now. + And I set the field "Allow submissions from" to "##now##" + # Set 'Due date' to 2 days 5 hours 30 minutes in the future. + And I set the field "Due date" to "##+2 days 5 hours 30 minutes##" + And I press "Save and return to course" + And I log out + And I log in as "student1" + And I am on "Course 1" course homepage + And I follow "Assignment name" + And I should see "##+2 days 5 hours 30 minutes##%A, %d %B %Y##" in the "Due date" "table_row" + And I should see "2 days 5 hours" in the "Time remaining" "table_row" + And "Add submission" "button" should exist + And I press "Add submission" + And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filemanager + When I press "Save changes" + Then I should see "Submitted for grading" in the "Submission status" "table_row" + And I log out + And I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Assignment name" + And I should see "1" in the "Submitted" "table_row" + And I navigate to "View all submissions" in current page administration + And I should see "Submitted for grading" in the "Student 1" "table_row" + + @_file_upload + Scenario: Student can submit an assignment after the due date and the submission is marked as late + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Assignment name" + And I navigate to "Edit settings" in current page administration + And I follow "Expand all" + # Set 'Allow submissions from' to 3 days ago. + And I set the field "Allow submissions from" to "##3 days ago##" + # Set 'Due date' to 2 days 5 hours 30 minutes ago. + And I set the field "Due date" to "##2 days 5 hours 30 minutes ago##" + # Set 'Cut-off date' to tomorrow at noon. + And I set the field "Cut-off date" to "##tomorrow noon##" + And I press "Save and return to course" + And I log out + And I log in as "student1" + And I am on "Course 1" course homepage + And I follow "Assignment name" + And I should see "##2 days 5 hours 30 minutes ago##%A, %d %B %Y##" in the "Due date" "table_row" + And I should see "Assignment is overdue by: 2 days 5 hours" in the "Time remaining" "table_row" + And "Add submission" "button" should exist + And I press "Add submission" + And I upload "lib/tests/fixtures/empty.txt" file to "File submissions" filemanager + When I press "Save changes" + Then I should see "Submitted for grading" in the "Submission status" "table_row" + And I should see "Assignment was submitted 2 days 5 hours late" in the "Time remaining" "table_row" + And I log out + And I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Assignment name" + And I should see "1" in the "Submitted" "table_row" + And I navigate to "View all submissions" in current page administration + And I should see "Submitted for grading" in the "Student 1" "table_row" + And I should see "2 days 5 hours late" in the "Student 1" "table_row" + + Scenario: Student cannot submit an assignment after the cut-off date + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Assignment name" + And I navigate to "Edit settings" in current page administration + And I follow "Expand all" + # Set 'Allow submissions from' to 3 days ago. + And I set the field "Allow submissions from" to "##3 days ago##" + # Set 'Due date' to 2 days 5 hours 30 minutes ago. + And I set the field "Due date" to "##2 days 5 hours 30 minutes ago##" + # Set 'Cut-off date' to yesterday at noon. + And I set the field "Cut-off date" to "##yesterday noon##" + And I press "Save and return to course" + And I log out + And I log in as "student1" + And I am on "Course 1" course homepage + When I follow "Assignment name" + Then "Add submission" "button" should not exist + And I log out + And I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Assignment name" + And I should see "0" in the "Submitted" "table_row" + And I navigate to "View all submissions" in current page administration + And I should see "No submission" in the "Student 1" "table_row" + And I should see "Assignment is overdue by: 2 days 5 hours" in the "Student 1" "table_row"