diff --git a/admin/tool/monitor/tests/behat/subscription.feature b/admin/tool/monitor/tests/behat/subscription.feature index 496d709486a..304a3faacb4 100644 --- a/admin/tool/monitor/tests/behat/subscription.feature +++ b/admin/tool/monitor/tests/behat/subscription.feature @@ -101,9 +101,9 @@ Feature: tool_monitor_subscriptions Scenario: Receiving notification on site level Given I log in as "admin" And I follow "Preferences" in the user menu - And I follow "Messaging" - And I click on "input[name^=tool_monitor_notification_loggedin]" "css_element" - And I press "Save changes" + And I click on "Notification preferences" "link" in the "#page-content" "css_element" + And I click on ".preference-state" "css_element" in the "Notifications of rule subscriptions" "table_row" + And I wait until the page is ready And I follow "Preferences" in the user menu And I follow "Event monitoring" And I set the field "Select a course" to "Acceptance test site" @@ -113,16 +113,17 @@ Feature: tool_monitor_subscriptions And I am on site homepage And I trigger cron And I am on site homepage - When I follow "Messages" in the user menu - And I follow "Do not reply to this email (1)" - Then I should see "The course was viewed." + When I click on ".popover-region-notifications" "css_element" + And I click on "View more" "link" in the ".popover-region-notifications" "css_element" + Then I should see "New rule site level" + And I should see "The course was viewed" Scenario: Receiving notification on course level Given I log in as "teacher1" And I follow "Preferences" in the user menu - And I follow "Messaging" - And I click on "input[name^=tool_monitor_notification_loggedin]" "css_element" - And I press "Save changes" + And I click on "Notification preferences" "link" in the "#page-content" "css_element" + And I click on ".preference-state" "css_element" in the "Notifications of rule subscriptions" "table_row" + And I wait until the page is ready And I follow "Preferences" in the user menu And I follow "Event monitoring" And I set the field "Select a course" to "Course 1" @@ -133,9 +134,10 @@ Feature: tool_monitor_subscriptions And I follow "Course 1" And I trigger cron And I am on site homepage - When I follow "Messages" in the user menu - And I follow "Do not reply to this email (1)" - Then I should see "The course was viewed." + When I click on ".popover-region-notifications" "css_element" + And I click on "View more" "link" in the ".popover-region-notifications" "css_element" + Then I should see "New rule course level" + And I should see "The course was viewed" Scenario: Navigating via quick link to rules Given I log in as "admin" diff --git a/blocks/course_overview/tests/behat/block_course_overview.feature b/blocks/course_overview/tests/behat/block_course_overview.feature index 2758c82c029..bb86bdbdbe2 100644 --- a/blocks/course_overview/tests/behat/block_course_overview.feature +++ b/blocks/course_overview/tests/behat/block_course_overview.feature @@ -98,8 +98,9 @@ Feature: View the course overview block on the dashboard and test it's functiona Then I should see "Welcome Student" in the "Course overview" "block" And I should see "You have no unread messages" in the "Course overview" "block" And I follow "messages" - And I should see "Contact list empty" + And I should see "No messages" + @javascript Scenario: View the block by a user with the welcome area and the user having messages. Given the following config values are set as admin: | showwelcomearea | 1 | block_course_overview | diff --git a/blocks/messages/tests/behat/block_messages_course.feature b/blocks/messages/tests/behat/block_messages_course.feature index 068b0e0dd66..ed18707c9f4 100644 --- a/blocks/messages/tests/behat/block_messages_course.feature +++ b/blocks/messages/tests/behat/block_messages_course.feature @@ -33,6 +33,7 @@ Feature: The messages block allows users to list new messages an a course And I add the "Messages" block Then I should see "No messages waiting" in the "Messages" "block" + @javascript Scenario: View the block by a user who has messages. Given I log in as "student1" And I follow "Messages" in the user menu @@ -45,12 +46,13 @@ Feature: The messages block allows users to list new messages an a course And I add the "Messages" block Then I should see "Student 1" in the "Messages" "block" + @javascript Scenario: Use the block to send a message to a user. Given I log in as "teacher1" And I follow "Course 1" And I turn editing mode on And I add the "Messages" block - And I follow "Messages" + And I click on "//a[normalize-space(.) = 'Messages']" "xpath_element" in the "Messages" "block" And I send "This is message 1" message to "Student 1" user And I log out When I log in as "student1" diff --git a/blocks/messages/tests/behat/block_messages_dashboard.feature b/blocks/messages/tests/behat/block_messages_dashboard.feature index 8eb19186a89..f3fc262569f 100644 --- a/blocks/messages/tests/behat/block_messages_dashboard.feature +++ b/blocks/messages/tests/behat/block_messages_dashboard.feature @@ -24,6 +24,7 @@ Feature: The messages block allows users to list new messages on the dashboard When I add the "Messages" block Then I should see "No messages waiting" in the "Messages" "block" + @javascript Scenario: View the block by a user who has messages. Given I log in as "student1" And I follow "Messages" in the user menu @@ -35,11 +36,12 @@ Feature: The messages block allows users to list new messages on the dashboard And I add the "Messages" block Then I should see "Student 1" in the "Messages" "block" + @javascript Scenario: Use the block to send a message to a user. Given I log in as "teacher1" And I press "Customise this page" And I add the "Messages" block - And I follow "Messages" + And I click on "//a[normalize-space(.) = 'Messages']" "xpath_element" in the "Messages" "block" And I send "This is message 1" message to "Student 1" user And I log out When I log in as "student1" diff --git a/blocks/messages/tests/behat/block_messages_frontpage.feature b/blocks/messages/tests/behat/block_messages_frontpage.feature index df009914525..4f4796eed75 100644 --- a/blocks/messages/tests/behat/block_messages_frontpage.feature +++ b/blocks/messages/tests/behat/block_messages_frontpage.feature @@ -35,6 +35,7 @@ Feature: The messages block allows users to list new messages on the frontpage When I am on site homepage Then I should not see "Messages" + @javascript Scenario: View the block by a user who has messages. Given I log in as "student1" And I follow "Messages" in the user menu @@ -45,10 +46,11 @@ Feature: The messages block allows users to list new messages on the frontpage And I am on site homepage Then I should see "Student 1" in the "Messages" "block" + @javascript Scenario: Use the block to send a message to a user. Given I log in as "teacher1" And I am on site homepage - And I follow "Messages" + And I click on "//a[normalize-space(.) = 'Messages']" "xpath_element" in the "Messages" "block" And I send "This is message 1" message to "Student 1" user And I log out When I log in as "student1" diff --git a/blocks/participants/tests/behat/block_participants_course.feature b/blocks/participants/tests/behat/block_participants_course.feature index de4aed62ed9..b50286e7734 100644 --- a/blocks/participants/tests/behat/block_participants_course.feature +++ b/blocks/participants/tests/behat/block_participants_course.feature @@ -31,7 +31,7 @@ Feature: People Block used in a course When I log in as "student1" And I follow "Course 1" And I click on "Participants" "link" in the "People" "block" - Then I should see "All participants" in the "h3" "css_element" + Then I should see "All participants" in the "#page-content" "css_element" And the "My courses" select box should contain "C101" Scenario: Student without permission can not view participants link diff --git a/course/tests/behat/course_category_management_listing.feature b/course/tests/behat/course_category_management_listing.feature index 78c85b331ee..26f28630b78 100644 --- a/course/tests/behat/course_category_management_listing.feature +++ b/course/tests/behat/course_category_management_listing.feature @@ -13,7 +13,7 @@ Feature: Course category management interface performs as expected And I go to the courses management page And I should see "Course and category management" in the "h2" "css_element" And I should see "Course categories" in the ".view-mode-selector" "css_element" - And I should see "Course categories" in the "h3" "css_element" + And I should see "Course categories" in the "#page-content" "css_element" And I should see the "Course categories and courses" management page @javascript diff --git a/message/tests/behat/behat_message.php b/message/tests/behat/behat_message.php index ecdecf085d6..e4e26f27a4b 100644 --- a/message/tests/behat/behat_message.php +++ b/message/tests/behat/behat_message.php @@ -27,8 +27,6 @@ require_once(__DIR__ . '/../../../lib/behat/behat_base.php'); -use Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException; - /** * Messaging system steps definitions. * @@ -39,6 +37,34 @@ use Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException; */ class behat_message extends behat_base { + /** + * Sends a message to the specified user from the logged user. The user full name should contain the first and last names. + * + * @Given /^I view the message profile for "(?P(?:[^"]|\\")*)" user$/ + * @param string $userfullname + */ + public function i_view_users_message_profile($userfullname) { + // Visit home page and follow messages. + $this->execute("behat_general::i_am_on_homepage"); + + $this->execute("behat_navigation::i_follow_in_the_user_menu", get_string('messages', 'message')); + + $this->execute('behat_general::i_click_on', array("[data-action='contacts-view']", 'css_element')); + + $this->execute('behat_general::wait_until_the_page_is_ready'); + + $this->execute('behat_forms::i_set_the_field_to', + array(get_string('searchforuserorcourse', 'message'), $this->escape($userfullname)) + ); + + $this->execute('behat_general::wait_until_the_page_is_ready'); + + $this->execute('behat_general::i_click_on', array("//div[@data-action='view-contact-profile'] + [./div[contains(normalize-space(.), '" . $this->escape($userfullname) . "')]]", 'xpath_element')); + + $this->execute('behat_general::wait_until_the_page_is_ready'); + } + /** * Sends a message to the specified user from the logged user. The user full name should contain the first and last names. * @@ -47,28 +73,16 @@ class behat_message extends behat_base { * @param string $userfullname */ public function i_send_message_to_user($messagecontent, $userfullname) { + $this->i_view_users_message_profile($userfullname); - // Visit home page and follow messages. - $this->execute("behat_general::i_am_on_homepage"); + $this->execute("behat_general::i_click_on", array("[data-action='profile-send-message']", 'css_element')); - if ($this->running_javascript()) { - $this->execute("behat_navigation::i_follow_in_the_user_menu", get_string('messages', 'message')); - } else { - $this->execute("behat_general::click_link", get_string('messages', 'message')); - } + $this->execute('behat_general::wait_until_the_page_is_ready'); - $this->execute('behat_forms::i_set_the_field_to', - array(get_string('searchcombined', 'message'), $this->escape($userfullname)) - ); - $this->execute("behat_forms::press_button", get_string('searchcombined', 'message')); - - $this->execute("behat_general::click_link", $this->escape(get_string('sendmessageto', 'message', $userfullname))); - - $this->execute('behat_forms::i_set_the_field_to', - array("id_message", $this->escape($messagecontent)) + $this->execute('behat_forms::i_set_the_field_with_xpath_to', + array("//textarea[@data-region='send-message-txt']", $this->escape($messagecontent)) ); - $this->execute("behat_forms::press_button", get_string('sendmessage', 'message')); + $this->execute("behat_forms::press_button", get_string('send', 'message')); } - } diff --git a/message/tests/behat/block_noncontacts.feature b/message/tests/behat/block_noncontacts.feature deleted file mode 100644 index 5e4f955d10c..00000000000 --- a/message/tests/behat/block_noncontacts.feature +++ /dev/null @@ -1,45 +0,0 @@ -@core @core_message -Feature: Block non contacts from contacting me - In order to reduce unsolicited messages - As a user - I need to prevent non-contacts from sending me messages - - Background: - Given the following "users" exist: - | username | firstname | lastname | email | - | user1 | User | One | one@example.com | - | user2 | User | Two | two@example.com | - And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | - And the following "course enrolments" exist: - | user | course | role | - | user1 | C1 | student | - | user2 | C1 | student | - And I log in as "user1" - And I follow "Preferences" in the user menu - And I follow "Messaging" - And I set the field "blocknoncontacts" to "1" - And I press "Save changes" - And I log out - - @javascript - Scenario: Block non-contacts warning on messages page - Given I log in as "user1" - And I follow "Messages" in the user menu - And I set the field "Search people and messages" to "User Two" - And I press "Search people and messages" - When I follow "Send message to User Two" - Then I should see "User Two will not be able to reply as you have blocked non-contacts" - - @javascript - Scenario: Non-contact can't send message - Given I log in as "user2" - And I follow "Messages" in the user menu - And I set the field "Search people and messages" to "User One" - And I press "Search people and messages" - When I follow "Send message to User One" - Then I should see "User One only accepts messages from their contacts." - And I follow "Picture of User One" - And I press "Message" - And I should see "User One only accepts messages from their contacts." diff --git a/message/tests/behat/block_users.feature b/message/tests/behat/block_users.feature deleted file mode 100644 index 3d039135bfa..00000000000 --- a/message/tests/behat/block_users.feature +++ /dev/null @@ -1,44 +0,0 @@ -@core @core_message -Feature: Block users from contacting me - In order to block other users - As a user - I need to prevent specific users to sending me messages - - Background: - Given the following "users" exist: - | username | firstname | lastname | email | - | user1 | User | One | one@example.com | - | user2 | User | Two | two@example.com | - And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | - And the following "course enrolments" exist: - | user | course | role | - | user1 | C1 | student | - | user2 | C1 | student | - And I log in as "user1" - And I follow "Messages" in the user menu - And I set the field "Search people and messages" to "User Two" - And I press "Search people and messages" - And I click on "Block contact" "link" in the "User Two" "table_row" - And I log out - - @javascript - Scenario: Block users display in message navigation - Given I log in as "user1" - When I follow "Messages" in the user menu - Then the "Message navigation:" select box should contain "Blocked users (1)" - And I set the field "Message navigation:" to "Blocked users (1)" - And I should see "User Two" - - @javascript - Scenario: Block users from contacting me - Given I log in as "user2" - And I follow "Messages" in the user menu - And I set the field "Search people and messages" to "User One" - And I press "Search people and messages" - When I follow "Send message to User One" - Then I should see "This user has blocked you from sending messages to them" - And I follow "Picture of User One" - And I press "Message" - And I should see "This user has blocked you from sending messages to them" diff --git a/message/tests/behat/delete_messages.feature b/message/tests/behat/delete_messages.feature deleted file mode 100644 index 745618d3eef..00000000000 --- a/message/tests/behat/delete_messages.feature +++ /dev/null @@ -1,124 +0,0 @@ -@core @core_message -Feature: Check that messages can be deleted - In order to check a user can delete a message - As a user - I can delete a message - - Background: - Given the following "users" exist: - | username | firstname | lastname | email | - | user1 | User | 1 | user1@asd.com | - | user2 | User | 2 | user2@asd.com | - And I log in as "admin" - And I set the following administration settings values: - | forceloginforprofiles | 0 | - And I log out - - @javascript - Scenario: Test basic functionality of deleting a message - # Send two messages from User 1 to User 2. - And I log in as "user1" - And I send "Hey bud, what's happening?" message to "User 2" user - And I set the field with xpath "//textarea[@id='id_message']" to "Whoops, forgot to mention that I drank all your beers. Lol." - And I press "Send message" - # Confirm that there is a delete link next to each message. - And "Delete" "link" should exist in the "#message_1" "css_element" - And "Delete" "link" should exist in the "#message_2" "css_element" - # Confirm that there is a confirmation box before deleting, and that when we cancel the messages remain. - And I click on "#message_2" "css_element" - And I click on "Delete" "link" in the "#message_2" "css_element" - And I press "Cancel" - And I should see "Hey bud, what's happening?" - And I should see "Whoops, forgot to mention that I drank all your beers. Lol." - # Confirm we can delete a message and then can no longer see it. - And I click on "#message_2" "css_element" - And I click on "Delete" "link" in the "#message_2" "css_element" - And I press "Delete" - And I should see "Hey bud, what's happening?" - And I should not see "Whoops, forgot to mention that I drank all your beers. Lol." - # Check that when we do a search for the keywords in the message we deleted nothing is returned. - And I follow "Messages" in the user menu - And I set the field "Search people and messages" to "beers" - And I press "Search people and messages" - And I should see "Messages found: 0" - # Check that we can still search the message that we did not delete. - And I follow "Messages" in the user menu - And I set the field "Search people and messages" to "bud" - And I press "Search people and messages" - And I should see "Messages found: 1" - # Check that the message we deleted does not show up on the recent conversation. - And I set the field "Message navigation:" to "Recent conversations" - And I should see "Hey bud, what's happening?" - And I log out - # Log in as User 2 and send two replies. - And I log in as "user2" - And I follow "Messages" in the user menu - And I follow "User 1 (2)" - And I set the field with xpath "//textarea[@id='id_message']" to "Not much brah, just writing a behat test and communicating to myself." - And I press "Send message" - And I set the field with xpath "//textarea[@id='id_message']" to "Oh man, I was looking forward to those tonight!" - And I press "Send message" - # Confirm that we can see all messages. - And I should see "Hey bud, what's happening?" - And I should see "Whoops, forgot to mention that I drank all your beers. Lol." - And I should see "Not much brah, just writing a behat test and communicating to myself." - And I should see "Oh man, I was looking forward to those tonight!" - # Confirm that there is a delete link next to each message. - And "Delete" "link" should exist in the "#message_1" "css_element" - And "Delete" "link" should exist in the "#message_2" "css_element" - And "Delete" "link" should exist in the "#message_3" "css_element" - And "Delete" "link" should exist in the "#message_4" "css_element" - # Now, delete one of the messages that User 1 sent and one by User 2. - And I click on "#message_1" "css_element" - And I click on "Delete" "link" in the "#message_1" "css_element" - And I press "Delete" - And I click on "#message_2" "css_element" - And I click on "Delete" "link" in the "#message_2" "css_element" - And I press "Delete" - # Confirm that the messages are no longer listed. - And I should not see "Hey bud, what's happening?" - And I should see "Whoops, forgot to mention that I drank all your beers. Lol." - And I should not see "Not much brah, just writing a behat test and communicating to myself." - And I should see "Oh man, I was looking forward to those tonight!" - # Check that when we do a search for the keywords in the messages we deleted nothing is returned. - And I follow "Messages" in the user menu - And I set the field "Search people and messages" to "bud" - And I press "Search people and messages" - And I should see "Messages found: 0" - And I set the field "Search people and messages" to "brah" - And I press "Search people and messages" - And I should see "Messages found: 0" - # Check that we can still search the message that we did not delete. - And I follow "Messages" in the user menu - And I set the field "Search people and messages" to "Whoops" - And I press "Search people and messages" - And I should see "Messages found: 1" - And I set the field "Search people and messages" to "tonight" - And I press "Search people and messages" - And I should see "Messages found: 1" - # Check that the messages we deleted do not show up on the recent conversation. - And I set the field "Message navigation:" to "Recent conversations" - And I should see "Oh man, I was looking forward to those tonight!" - And I log out - - @javascript - Scenario: Check that we can prevent some users from deleting messages - # Prevent the ability to delete messages. - Given I log in as "admin" - And I set the following system permissions of "Authenticated user" role: - | capability | permission | - | moodle/site:deleteownmessage | Prevent | - # Send a message from the admin to User 1 - And I send "Hey there, this is the all-powerful administrator. Obey my commands." message to "User 1" user - # Check the admin is still able to delete messages. - And I click on "#message_1" "css_element" - And I click on "Delete" "link" in the "#message_1" "css_element" - And I press "Delete" - And I should not see "Hey there, this is the all-powerful administrator. Obey my commands." - And I log out - # Check that User 1 is unable to delete the message the admin sent. - And I log in as "user1" - And I follow "Messages" in the user menu - And I follow "Admin User (1)" - And I should see "Hey there, this is the all-powerful administrator. Obey my commands." - And "Delete" "link" should not exist in the "#message_1" "css_element" diff --git a/message/tests/behat/display_history.feature b/message/tests/behat/display_history.feature deleted file mode 100644 index 62b0766f9a7..00000000000 --- a/message/tests/behat/display_history.feature +++ /dev/null @@ -1,46 +0,0 @@ -@core @core_message -Feature: Message history displays correctly - In order to read messages between two users - As a user - I need to view the conversation with another user - - Background: - Given the following "users" exist: - | username | firstname | lastname | email | - | user1 | User | One | one@example.com | - | user2 | User | Two | two@example.com | - And I log in as "user1" - And I send "Message 1 from user1 to user2" message to "User Two" user - And I wait "1" seconds - And I send "Message 2 from user1 to user2" message to "User Two" user - And I send "Message 3 from user1 to user2" message to "User Two" user - And I send "Message 4 from user1 to user2" message to "User Two" user - And I send "Message 5 from user1 to user2" message to "User Two" user - And I send "Message 6 from user1 to user2" message to "User Two" user - And I send "Message 7 from user1 to user2" message to "User Two" user - And I send "Message 8 from user1 to user2" message to "User Two" user - And I send "Message 9 from user1 to user2" message to "User Two" user - And I wait "1" seconds - And I send "Message 10 from user1 to user2" message to "User Two" user - - Scenario: View sent messages - When I follow "Messages" in the user menu - And I set the field "Search people and messages" to "User Two" - And I press "Search people and messages" - And I click on "Message history" "link" in the "User Two" "table_row" - # The message history link shows all messages. - Then I should see "Message 1 from user1 to user2" - And I should see "Message 10 from user1 to user2" - # Only the last eight messages. - And I follow "Recent messages" - And I should see "Message 10 from user1 to user2" - And I should not see "Message 1 from user1 to user2" - - Scenario: View received messages - When I log out - And I log in as "user2" - And I follow "Messages" in the user menu - And I follow "User One (10)" - # Should show all of the user's unread messages. - Then I should see "Message 1 from user1 to user2" - And I should see "Message 10 from user1 to user2" diff --git a/message/tests/behat/manage_contacts.feature b/message/tests/behat/manage_contacts.feature deleted file mode 100644 index 951461845f0..00000000000 --- a/message/tests/behat/manage_contacts.feature +++ /dev/null @@ -1,32 +0,0 @@ -@core @core_message -Feature: Manage contacts - In order to easily access the users I interact more with - As a user - I need to add and remove users to/from my contacts list - - Background: - Given the following "users" exist: - | username | firstname | lastname | email | - | user1 | User | One | one@example.com | - | user2 | User | Two | two@example.com | - And I log in as "user1" - And I send "Message 1 from user1 to user2" message to "User Two" user - And I send "Message 2 from user1 to user2" message to "User Two" user - And I follow "Messages" in the user menu - And I set the field "Search people and messages" to "User Two" - And I press "Search people and messages" - When I click on "Add contact" "link" in the "User Two" "table_row" - Then I should see "Message 1 from user1 to user2" - And I should see "Message 2 from user1 to user2" - And I should see "User Two" in the ".contactselector" "css_element" - And I follow "Remove contact" - And I should not see "User Two" in the ".contactselector" "css_element" - And I should not see "Remove contact" - And I should see "Add contact" - And I follow "Add contact" - And I should see "User Two" in the ".contactselector" "css_element" - - @javascript - Scenario: Adding and removing contacts with Javascript enabled - -# Scenario: Adding and removing contacts with Javascript disabled diff --git a/message/tests/behat/message_participants.feature b/message/tests/behat/message_participants.feature deleted file mode 100644 index 9a578da6675..00000000000 --- a/message/tests/behat/message_participants.feature +++ /dev/null @@ -1,68 +0,0 @@ -@core @core_message -Feature: An user can message course participants - In order to communicate efficiently with my students - As a teacher - I need to message them all - - Scenario: An user can message multiple course participants including him/her self - Given 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 | - And the following "courses" exist: - | fullname | shortname | format | - | Course 1 | C1 | topics | - And the following "course enrolments" exist: - | user | course | role | - | teacher1 | C1 | editingteacher | - | student1 | C1 | student | - And I log in as "teacher1" - And I follow "Course 1" - And I follow "Participants" - When I set the field with xpath "//tr[contains(normalize-space(.), 'Teacher 1')]//input[@type='checkbox']" to "1" - And I set the field with xpath "//tr[contains(normalize-space(.), 'Student 1')]//input[@type='checkbox']" to "1" - And I set the field "With selected users..." to "Send a message" - And I press "OK" - And I set the following fields to these values: - | messagebody | Here it is, the message content | - And I press "Preview" - And I press "Send message" - And I follow "Messages" in the user menu - And I select "Recent conversations" from the "Message navigation:" singleselect - Then I should see "Here it is, the message content" - And I should see "Student 1" - And I click on "this conversation" "link" in the "//div[@class='singlemessage'][contains(., 'Teacher 1')]" "xpath_element" - And I should see "Here it is, the message content" - - Scenario: An user can message multiple course participants including him/her self - Given 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 | - And the following "courses" exist: - | fullname | shortname | format | - | Course 1 | C1 | topics | - And the following "course enrolments" exist: - | user | course | role | - | teacher1 | C1 | editingteacher | - | student1 | C1 | student | - And I log in as "teacher1" - And I follow "Course 1" - And I follow "Participants" - When I set the field with xpath "//tr[contains(normalize-space(.), 'Teacher 1')]//input[@type='checkbox']" to "1" - And I set the field with xpath "//tr[contains(normalize-space(.), 'Student 1')]//input[@type='checkbox']" to "1" - And I set the field "With selected users..." to "Send a message" - And I press "OK" - And I set the following fields to these values: - | messagebody | Here it is, the message content | - And I press "Send message" - And I follow "Messages" in the user menu - And I select "Recent conversations" from the "Message navigation:" singleselect - Then I should see "Here it is, the message content" - And I should see "Student 1" - And I click on "this conversation" "link" in the "//div[@class='singlemessage'][contains(., 'Teacher 1')]" "xpath_element" - And I should see "Here it is, the message content" \ No newline at end of file diff --git a/message/tests/behat/recent_conversations.feature b/message/tests/behat/recent_conversations.feature deleted file mode 100644 index a6b3533cb4f..00000000000 --- a/message/tests/behat/recent_conversations.feature +++ /dev/null @@ -1,36 +0,0 @@ -@core @core_message -Feature: Recent conversations contains my recent conversations - In order to view my recent conversations - As a user - I have the option to filter messages by recent conversations - - Background: - Given the following "users" exist: - | username | firstname | lastname | email | - | user1 | User | One | one@example.com | - | user2 | User | Two | two@example.com | - | user3 | User | Three | three@example.com | - - Scenario: View that I don't have recent conversations - Given I log in as "user1" - And I follow "Messages" in the user menu - When I select "Recent conversations" from the "Message navigation:" singleselect - Then I should not see "User Two" - And I should not see "User Three" - - Scenario: View my recent conversations - Given I log in as "user1" - And I send "Message from user1 to user2" message to "User Two" user - And I send "Message from user1 to user3" message to "User Three" user - And I follow "Messages" in the user menu - When I select "Recent conversations" from the "Message navigation:" singleselect - Then I should see "User Two" - And I should see "User Three" - And I should see "Message from user1 to user2" - And I should see "Message from user1 to user3" - And I log out - And I log in as "user2" - And I follow "Messages" in the user menu - And I select "Recent conversations" from the "Message navigation:" singleselect - And I should see "Message from user1 to user2" - And I should not see "Message from user1 to user3" diff --git a/message/tests/behat/search_history.feature b/message/tests/behat/search_history.feature deleted file mode 100644 index 0a5e681c2ec..00000000000 --- a/message/tests/behat/search_history.feature +++ /dev/null @@ -1,24 +0,0 @@ -@core @core_message -Feature: Users can search their message history - In order to read old messages - As a user - I need to search in my messages history - - Background: - Given the following "users" exist: - | username | firstname | lastname | email | - | user1 | User | One | one@example.com | - | user2 | User | Two | two@example.com | - And I log in as "user1" - When I send "Give me your biscuits" message to "User Two" user - And I follow "Messages" in the user menu - And I set the field "Search people and messages" to "your biscuits" - And I press "Search people and messages" - Then I should see "User Two" - And I click on "context" "link" in the "User Two" "table_row" - And I should see "Give me your biscuits" - - @javascript - Scenario: Search message history with Javascript enabled - - Scenario: Search message history with Javascript disabled diff --git a/mod/lesson/tests/behat/completion_condition_end_reached.feature b/mod/lesson/tests/behat/completion_condition_end_reached.feature index e926a9a41be..55aafb048c1 100644 --- a/mod/lesson/tests/behat/completion_condition_end_reached.feature +++ b/mod/lesson/tests/behat/completion_condition_end_reached.feature @@ -57,7 +57,7 @@ Feature: Set end of lesson reached as a completion condition for a lesson And I follow "Test lesson" And I should see "You have seen more than one page of this lesson already." And I should see "Do you want to start at the last page you saw?" - And I follow "No" + And I click on "No" "link" in the "#page-content" "css_element" And I press "Next page" And I press "Next page" And I follow "Course 1" diff --git a/mod/lesson/tests/behat/lesson_question_attempts.feature b/mod/lesson/tests/behat/lesson_question_attempts.feature index 9b6ecd91279..970e7a17003 100644 --- a/mod/lesson/tests/behat/lesson_question_attempts.feature +++ b/mod/lesson/tests/behat/lesson_question_attempts.feature @@ -106,7 +106,7 @@ Feature: In a lesson activity, students can not re-attempt a question more than And I follow "Course 1" And I follow "Test lesson name" And I should see "Do you want to start at the last page you saw?" - And I follow "No" + And I click on "No" "link" in the "#page-content" "css_element" And I should see "First page contents" And I press "Next page" And I should see "The earth is round" diff --git a/user/tests/behat/user_grade_navigation.feature b/user/tests/behat/user_grade_navigation.feature index 392f3d61855..4c25bc416c0 100644 --- a/user/tests/behat/user_grade_navigation.feature +++ b/user/tests/behat/user_grade_navigation.feature @@ -84,7 +84,7 @@ Feature: The student can navigate to their grades page and user grade report. And I follow "Assign roles relative to this user" And I follow "Parent" And I set the field "Potential users" to "Parent 1 (parent1@example.com)" - And I click on "Add" "button" + And I click on "Add" "button" in the "#page-content" "css_element" And I log out And I log in as "parent1" And I am on site homepage diff --git a/user/tests/behat/view_full_profile.feature b/user/tests/behat/view_full_profile.feature index 43dd15c0f03..5fc34177491 100644 --- a/user/tests/behat/view_full_profile.feature +++ b/user/tests/behat/view_full_profile.feature @@ -83,11 +83,8 @@ Feature: Access to full profiles of users And I press "Add" And I log out When I log in as "student1" - And I follow "Messages" in the user menu - And I set the following fields to these values: - | Search people and messages | Student 3 | - And I press "Search people and messages" - And I follow "Picture of Student 3" + And I view the message profile for "Student 3" user + And I follow "View profile" Then I should see "First access to site" @javascript @@ -102,11 +99,8 @@ Feature: Access to full profiles of users And I press "Save and display" And I log out When I log in as "student1" - And I follow "Messages" in the user menu - And I set the following fields to these values: - | Search people and messages | Student 2 | - And I press "Search people and messages" - And I follow "Picture of Student 2" + And I view the message profile for "Student 2" user + And I follow "View profile" And I should not see "First access to site" And I should see "The details of this user are not available to you" And I log out @@ -123,9 +117,6 @@ Feature: Access to full profiles of users And I add "Student 2 (student2@example.com)" user to "Group 1" group members And I log out And I log in as "student1" - And I follow "Messages" in the user menu - And I set the following fields to these values: - | Search people and messages | Student 2 | - And I press "Search people and messages" - And I follow "Picture of Student 2" + And I view the message profile for "Student 2" user + And I follow "View profile" Then I should see "First access to site" diff --git a/user/tests/behat/view_preferences_page.feature b/user/tests/behat/view_preferences_page.feature index cf233acd86a..526331c7658 100644 --- a/user/tests/behat/view_preferences_page.feature +++ b/user/tests/behat/view_preferences_page.feature @@ -76,7 +76,7 @@ Feature: Access to preferences page And I follow "Assign roles relative to this user" And I follow "Parent" And I set the field "Potential users" to "Parent 1 (parent1@example.com)" - And I click on "Add" "button" + And I click on "Add" "button" in the "#page-content" "css_element" And I log out And I log in as "parent" And I am on site homepage