1 |
efrain |
1 |
@core @core_message @javascript
|
|
|
2 |
Feature: To be able to block users that we are able to or to see a message if we can not
|
|
|
3 |
In order to attempt to block a user
|
|
|
4 |
As a user
|
|
|
5 |
I need to be able to block a user or to see a message if we can not
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | category |
|
|
|
10 |
| Course 1 | C1 | 0 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| teacher1 | Teacher | 1 | teacher1@emample.com |
|
|
|
14 |
| student1 | Student | 1 | student1@example.com |
|
|
|
15 |
| student2 | Student | 2 | student2@example.com |
|
|
|
16 |
And the following "course enrolments" exist:
|
|
|
17 |
| user | course | role |
|
|
|
18 |
| teacher1 | C1 | teacher |
|
|
|
19 |
| student1 | C1 | student |
|
|
|
20 |
| student2 | C1 | student |
|
|
|
21 |
And the following config values are set as admin:
|
|
|
22 |
| messaging | 1 |
|
|
|
23 |
|
|
|
24 |
Scenario: Block a user
|
|
|
25 |
Given I log in as "student1"
|
|
|
26 |
And I select "Student 2" user in messaging
|
|
|
27 |
And I open contact menu
|
|
|
28 |
And I click on "Block" "link" in the "[data-region='header-container']" "css_element"
|
|
|
29 |
And I should see "Are you sure you want to block Student 2?"
|
|
|
30 |
And I click on "Block" "button" in the "[data-region='confirm-dialogue']" "css_element"
|
|
|
31 |
And I should see "You have blocked this user."
|
|
|
32 |
And I log out
|
|
|
33 |
When I log in as "student2"
|
|
|
34 |
And I open messaging
|
|
|
35 |
And I select "Student 1" user in messaging
|
|
|
36 |
Then I should see "You are unable to message this user"
|
|
|
37 |
|
|
|
38 |
Scenario: Unable to block a user
|
|
|
39 |
Given I log in as "student1"
|
|
|
40 |
And I select "Teacher 1" user in messaging
|
|
|
41 |
And I open contact menu
|
|
|
42 |
When I click on "Block" "link" in the "[data-region='header-container']" "css_element"
|
|
|
43 |
Then I should see "You can't block Teacher 1"
|
|
|
44 |
|
|
|
45 |
Scenario: Block a user who then gets an elevated role
|
|
|
46 |
Given I log in as "student1"
|
|
|
47 |
And I select "Student 2" user in messaging
|
|
|
48 |
And I open contact menu
|
|
|
49 |
And I click on "Block" "link" in the "[data-region='header-container']" "css_element"
|
|
|
50 |
And I click on "Block" "button" in the "[data-region='confirm-dialogue']" "css_element"
|
|
|
51 |
And I log out
|
|
|
52 |
And I log in as "admin"
|
|
|
53 |
And I am on "Course 1" course homepage
|
|
|
54 |
And I navigate to course participants
|
|
|
55 |
And I click on "Unenrol" "icon" in the "student2" "table_row"
|
|
|
56 |
And I click on "Unenrol" "button" in the "Unenrol" "dialogue"
|
|
|
57 |
And I enrol "Student 2" user as "Teacher"
|
|
|
58 |
And I log out
|
|
|
59 |
And I log in as "student2"
|
|
|
60 |
And I select "Student 1" user in messaging
|
|
|
61 |
And I should not see "You are unable to message this user"
|
|
|
62 |
And I log out
|
|
|
63 |
And I log in as "student1"
|
|
|
64 |
And I select "Student 2" user in messaging
|
|
|
65 |
And I open contact menu
|
|
|
66 |
When I click on "Block" "link" in the "[data-region='header-container']" "css_element"
|
|
|
67 |
Then I should see "You can't block Student 2"
|