1 |
efrain |
1 |
@communication
|
|
|
2 |
Feature: Access the communication configuration page
|
|
|
3 |
As an editing teacher
|
|
|
4 |
See dynamic form fields based on selected provider
|
|
|
5 |
|
|
|
6 |
Background: Set up teachers and course for the communication confifiguration page
|
|
|
7 |
Given I enable communication experimental feature
|
|
|
8 |
And the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category | selectedcommunication |
|
|
|
14 |
| Test course | Test course | 0 | none |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | Test course | editingteacher |
|
|
|
18 |
| teacher2 | Test course | teacher |
|
|
|
19 |
|
|
|
20 |
Scenario: A teacher with the correct capability can access the communication configuration page
|
|
|
21 |
Given I am on the "Test course" "Course" page logged in as "teacher1"
|
|
|
22 |
When I navigate to "Communication" in current page administration
|
|
|
23 |
Then I should see "Communication"
|
|
|
24 |
|
|
|
25 |
Scenario: A teacher without the correct capability cannot access the communication configuration page
|
|
|
26 |
Given I am on the "Test course" "Course" page logged in as "teacher2"
|
|
|
27 |
Then "Communication" "link" should not exist in current page administration
|
|
|
28 |
|
|
|
29 |
Scenario: I cannot see the communication link when communication provider is disabled
|
|
|
30 |
Given I disable communication experimental feature
|
|
|
31 |
And I am on the "Test course" "Course" page logged in as "teacher1"
|
|
|
32 |
Then "Communication" "link" should not exist in current page administration
|
|
|
33 |
|
|
|
34 |
@javascript
|
|
|
35 |
Scenario: The communication form fields toggle dynamically when valid provider is set
|
|
|
36 |
Given a Matrix mock server is configured
|
|
|
37 |
And I am on the "Test course" "Course" page logged in as "teacher1"
|
|
|
38 |
When I navigate to "Communication" in current page administration
|
|
|
39 |
And I set the following fields to these values:
|
|
|
40 |
| selectedcommunication | communication_matrix |
|
11 |
efrain |
41 |
And I wait to be redirected
|
1 |
efrain |
42 |
Then I should see "Room name"
|
|
|
43 |
And I should see "Room topic"
|
11 |
efrain |
44 |
|
|
|
45 |
@javascript
|
|
|
46 |
Scenario: Changing the communication provider in the form fetches the correct data
|
|
|
47 |
Given a Matrix mock server is configured
|
|
|
48 |
And I am on the "Test course" "Course" page logged in as "teacher1"
|
|
|
49 |
When I navigate to "Communication" in current page administration
|
|
|
50 |
And I set the following fields to these values:
|
|
|
51 |
| selectedcommunication | communication_matrix |
|
|
|
52 |
And I wait to be redirected
|
|
|
53 |
And I should see "Room name"
|
|
|
54 |
And I should see "Room topic"
|
|
|
55 |
And I set the following fields to these values:
|
|
|
56 |
| communication_matrixroomname | Matrix room |
|
|
|
57 |
| matrixroomtopic | Matrix topic |
|
|
|
58 |
And I click on "Save changes" "button"
|
|
|
59 |
And I navigate to "Communication" in current page administration
|
|
|
60 |
Then the field "Room name" matches value "Matrix room"
|
|
|
61 |
And the field "Room topic" matches value "Matrix topic"
|
|
|
62 |
And I set the following fields to these values:
|
|
|
63 |
| selectedcommunication | communication_customlink |
|
|
|
64 |
And I wait to be redirected
|
|
|
65 |
And I should see "Room name"
|
|
|
66 |
And I should not see "Room topic"
|
|
|
67 |
And I should see "Custom link URL"
|
|
|
68 |
And I set the following fields to these values:
|
|
|
69 |
| communication_customlinkroomname | Custom link room |
|
|
|
70 |
| customlinkurl | https://moodle.org |
|
|
|
71 |
And I click on "Save changes" "button"
|
|
|
72 |
And I navigate to "Communication" in current page administration
|
|
|
73 |
And the field "Room name" matches value "Custom link room"
|
|
|
74 |
And the field "Custom link URL" matches value "https://moodle.org"
|
|
|
75 |
And I set the following fields to these values:
|
|
|
76 |
| selectedcommunication | communication_matrix |
|
|
|
77 |
And I wait to be redirected
|
|
|
78 |
And I should see "Room name"
|
|
|
79 |
And I should see "Room topic"
|
|
|
80 |
And the field "Room name" matches value "Matrix room"
|
|
|
81 |
And the field "Room topic" matches value "Matrix topic"
|
|
|
82 |
And I should not see "Custom link URL"
|
|
|
83 |
And I set the following fields to these values:
|
|
|
84 |
| selectedcommunication | communication_customlink |
|
|
|
85 |
And I wait to be redirected
|
|
|
86 |
And I should see "Room name"
|
|
|
87 |
And I should see "Custom link URL"
|
|
|
88 |
And the field "Room name" matches value "Custom link room"
|
|
|
89 |
And the field "Custom link URL" matches value "https://moodle.org"
|
|
|
90 |
And I should not see "Room topic"
|
|
|
91 |
And I set the following fields to these values:
|
|
|
92 |
| selectedcommunication | communication_matrix |
|
|
|
93 |
And I wait to be redirected
|
|
|
94 |
And I click on "Save changes" "button"
|
|
|
95 |
And I am on "Test course" course homepage with editing mode on
|
|
|
96 |
And I navigate to "Settings" in current page administration
|
|
|
97 |
And I set the following fields to these values:
|
|
|
98 |
| Group mode | Separate groups |
|
|
|
99 |
And I press "Save and display"
|
|
|
100 |
And I navigate to "Communication" in current page administration
|
|
|
101 |
And the field "Room name" matches value "Matrix room"
|
|
|
102 |
And the field "Room topic" matches value "Matrix topic"
|
|
|
103 |
And I press "Cancel"
|
|
|
104 |
And I navigate to "Settings" in current page administration
|
|
|
105 |
And I set the following fields to these values:
|
|
|
106 |
| Group mode | Visible groups |
|
|
|
107 |
And I navigate to "Communication" in current page administration
|
|
|
108 |
And the field "Room name" matches value "Matrix room"
|
|
|
109 |
And the field "Room topic" matches value "Matrix topic"
|