1 |
efrain |
1 |
@core @core_message @javascript
|
|
|
2 |
Feature: Manage contacts
|
|
|
3 |
In order to communicate with fellow users
|
|
|
4 |
As a user
|
|
|
5 |
I need to be able to add, decline and remove users
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| student1 | Student | 1 | student1@example.com |
|
|
|
11 |
| student2 | Student | 2 | student2@example.com |
|
|
|
12 |
| student3 | Student | 3 | student3@example.com |
|
|
|
13 |
| student4 | Student | 4 | student4@example.com |
|
|
|
14 |
And the following "courses" exist:
|
|
|
15 |
| fullname | shortname |
|
|
|
16 |
| course1 | C1 |
|
|
|
17 |
And the following "course enrolments" exist:
|
|
|
18 |
| user | course | role |
|
|
|
19 |
| student1 | C1 | student |
|
|
|
20 |
| student2 | C1 | student |
|
|
|
21 |
| student3 | C1 | student |
|
|
|
22 |
| student4 | C1 | student |
|
|
|
23 |
And the following "message contacts" exist:
|
|
|
24 |
| user | contact |
|
|
|
25 |
| student1 | student2 |
|
|
|
26 |
And the following config values are set as admin:
|
|
|
27 |
| messaging | 1 |
|
|
|
28 |
| messagingallusers | 1 |
|
|
|
29 |
| messagingminpoll | 1 |
|
|
|
30 |
|
|
|
31 |
Scenario: Send a 'contact request' to someone to add a contact
|
|
|
32 |
Given I log in as "student1"
|
|
|
33 |
Then I open messaging
|
|
|
34 |
And I select "Student 4" user in messaging
|
|
|
35 |
And I open contact menu
|
|
|
36 |
And I click on "Add to contacts" "link"
|
|
|
37 |
And I click on "Add" "button"
|
|
|
38 |
And I log out
|
|
|
39 |
And I log in as "student3"
|
|
|
40 |
And I select "Student 4" user in messaging
|
|
|
41 |
And I open contact menu
|
|
|
42 |
And I click on "Add to contacts" "link"
|
|
|
43 |
And I click on "Add" "button"
|
|
|
44 |
And I should see "Contact request sent"
|
|
|
45 |
And I log out
|
|
|
46 |
And I log in as "student4"
|
|
|
47 |
Then I should see "2" in the "//div[@data-region='popover-region-messages']//*[@data-region='count-container']" "xpath_element"
|
|
|
48 |
And I open messaging
|
|
|
49 |
And I click on "Contacts" "link"
|
|
|
50 |
Then I should see "2" in the "//div[@data-region='view-contacts']//*[@data-region='contact-request-count']" "xpath_element"
|
|
|
51 |
And I click on "Requests" "link_or_button"
|
|
|
52 |
And I click on "Student 1 Would like to contact you" "link"
|
|
|
53 |
Then I should see "Accept and add to contacts"
|
|
|
54 |
And I click on "Accept and add to contacts" "link_or_button"
|
|
|
55 |
And I should not see "Accept and add to contacts"
|
|
|
56 |
And I log out
|
|
|
57 |
And I log in as "student1"
|
|
|
58 |
And I open messaging
|
|
|
59 |
And I click on "Contacts" "link"
|
|
|
60 |
And I should see "Student 4" in the "//*[@data-section='contacts']" "xpath_element"
|
|
|
61 |
|
11 |
efrain |
62 |
Scenario: Send a 'contact request' to someone to add a contact in the profile page
|
|
|
63 |
Given I am on the "student4" "user > profile" page logged in as student3
|
|
|
64 |
And I should see "Add to contacts"
|
|
|
65 |
When I click on "Add to contacts" "link"
|
|
|
66 |
Then I should see "Contact request sent"
|
|
|
67 |
And I log out
|
|
|
68 |
And I am on the "student3" "user > profile" page logged in as student4
|
|
|
69 |
And I should see "Waiting to be added as contact"
|
|
|
70 |
And I open messaging
|
|
|
71 |
And I click on "Contacts" "link"
|
|
|
72 |
And I click on "Requests" "link_or_button"
|
|
|
73 |
And I click on "Student 3 Would like to contact you" "link"
|
|
|
74 |
And I should see "Accept and add to contacts"
|
|
|
75 |
And I click on "Accept and add to contacts" "link_or_button"
|
|
|
76 |
And I should not see "Accept and add to contacts"
|
|
|
77 |
And I log out
|
|
|
78 |
And I am on the "student4" "user > profile" page logged in as student3
|
|
|
79 |
And I should see "Remove from contacts"
|
|
|
80 |
|
1 |
efrain |
81 |
Scenario: Decline a 'contact request' from someone
|
|
|
82 |
Given I log in as "student1"
|
|
|
83 |
Then I open messaging
|
|
|
84 |
And I select "Student 3" user in messaging
|
|
|
85 |
And I open contact menu
|
|
|
86 |
And I click on "Add to contacts" "link"
|
|
|
87 |
And I click on "Add" "button"
|
|
|
88 |
And I should see "Contact request sent"
|
|
|
89 |
And I log out
|
|
|
90 |
And I log in as "student3"
|
|
|
91 |
Then I should see "1" in the "//div[@data-region='popover-region-messages']//*[@data-region='count-container']" "xpath_element"
|
|
|
92 |
And I open messaging
|
|
|
93 |
And I click on "Contacts" "link"
|
|
|
94 |
Then I should see "1" in the "//div[@data-region='view-contacts']//*[@data-region='contact-request-count']" "xpath_element"
|
|
|
95 |
And I click on "Requests" "link_or_button"
|
|
|
96 |
And I click on "Student 1 Would like to contact you" "link"
|
|
|
97 |
Then I should see "Accept and add to contacts"
|
|
|
98 |
And I click on "Decline" "link_or_button"
|
|
|
99 |
And I should not see "Accept and add to contacts"
|
|
|
100 |
And I open contact menu
|
|
|
101 |
Then I should see "Add to contacts" in the "//div[@data-region='header-container']" "xpath_element"
|
|
|
102 |
|
|
|
103 |
Scenario: Remove existing contact
|
|
|
104 |
Given I log in as "student1"
|
|
|
105 |
Then I open messaging
|
|
|
106 |
And I click on "Contacts" "link"
|
|
|
107 |
And I click on "Student 2" "link" in the "//*[@data-section='contacts']" "xpath_element"
|
|
|
108 |
And I open contact menu
|
|
|
109 |
And I click on "Remove from contacts" "link"
|
|
|
110 |
And I click on "Remove" "button"
|
|
|
111 |
And I go back in "view-conversation" message drawer
|
|
|
112 |
And I should see "No contacts" in the "//*[@data-region='empty-message-container']" "xpath_element"
|