MDL-50426 behat: Update non-contacts feature naming
[moodle.git] / message / tests / behat / block_noncontacts.feature
CommitLineData
ceb689b9 1@core @core_message
82467e58
DP
2Feature: Block non contacts from contacting me
3 In order to reduce unsolicited messages
ceb689b9 4 As a user
82467e58 5 I need to prevent non-contacts from sending me messages
ceb689b9
RW
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | user1 | User | One | one@example.com |
11 | user2 | User | Two | two@example.com |
12 And the following "courses" exist:
13 | fullname | shortname | category |
14 | Course 1 | C1 | 0 |
15 And the following "course enrolments" exist:
16 | user | course | role |
17 | user1 | C1 | student |
18 | user2 | C1 | student |
19 And I log in as "user1"
20 And I follow "Preferences" in the user menu
21 And I follow "Messaging"
22 And I set the field "blocknoncontacts" to "1"
23 And I press "Save changes"
24 And I log out
25
26 @javascript
27 Scenario: Block non-contacts warning on messages page
28 Given I log in as "user1"
29 And I follow "Messages" in the user menu
30 And I set the field "Search people and messages" to "User Two"
31 And I press "Search people and messages"
32 When I follow "Send message to User Two"
33 Then I should see "User Two will not be able to reply as you have blocked non-contacts"
34
35 @javascript
36 Scenario: Non-contact can't send message
37 Given I log in as "user2"
38 And I follow "Messages" in the user menu
39 And I set the field "Search people and messages" to "User One"
40 And I press "Search people and messages"
41 When I follow "Send message to User One"
42 Then I should see "User One only accepts messages from their contacts."
43 And I follow "Picture of User One"
44 And I press "Message"
45 And I should see "User One only accepts messages from their contacts."