Merge branch 'MDL-44613-310-1' of git://github.com/mihailges/moodle into MOODLE_310_STABLE

This commit is contained in:
Sara Arjona
2021-03-15 15:53:58 +01:00
9 changed files with 186 additions and 23 deletions
@@ -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
+2 -2
View File
@@ -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 {
+5
View File
@@ -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.
+6 -6
View File
@@ -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"
@@ -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:
@@ -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
@@ -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"
+1 -1
View File
@@ -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"
@@ -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"