MDL-59437 behat: old "edit" cog to go to enrollments page is gone
[moodle.git] / tag / tests / behat / edit_tag.feature
CommitLineData
8e355853
MG
1@core @core_tag
2Feature: Users can edit tags to add description or rename
3 In order to use tags
4 As a manager
5 I need to be able to edit tags
6
7 Background:
8 Given the following "users" exist:
810805da
MG
9 | username | firstname | lastname | email | interests |
10 | manager1 | Manager | 1 | manager1@example.com | |
11 | user1 | User | 1 | user1@example.com | Cat,Dog,Turtle |
12 | editor1 | Editor | 1 | editor1@example.com | |
8e355853
MG
13 Given the following "roles" exist:
14 | name | shortname |
15 | Tag editor | tageditor |
16 And the following "system role assigns" exist:
17 | user | course | role |
18 | manager1 | Acceptance test site | manager |
19 | editor1 | Acceptance test site | tageditor |
20 And the following "tags" exist:
e11d7380
MG
21 | name | isstandard |
22 | Neverusedtag | 1 |
8e355853 23
a27c42ee 24 @javascript
8e355853
MG
25 Scenario: User with tag editing capability can change tag description
26 Given I log in as "admin"
27 And I set the following system permissions of "Tag editor" role:
810805da
MG
28 | capability | permission |
29 | moodle/tag:edit | Allow |
30 | moodle/site:viewparticipants | Allow |
31 | moodle/user:viewdetails | Allow |
8e355853
MG
32 And I log out
33 When I log in as "editor1"
7a12a02d
MG
34 And I press "Customise this page"
35 # TODO MDL-57120 site "Participants" link not accessible without navigation block.
36 And I add the "Navigation" block if not present
810805da
MG
37 And I navigate to "Participants" node in "Site pages"
38 And I follow "User 1"
8e355853
MG
39 And I follow "Cat"
40 And I follow "Edit this tag"
41 And I should not see "Tag name"
e11d7380 42 And I should not see "Standard"
8e355853
MG
43 And I set the following fields to these values:
44 | Description | Description of tag 1 |
45 | Related tags | Dog, Turtle,Fish |
46 And I press "Update"
47 Then "Cat" "text" should exist in the ".breadcrumb-nav" "css_element"
c026a28d
MG
48 And "Description of tag 1" "text" should exist in the ".tag-description" "css_element"
49 And I should see "Related tags:" in the ".tag_list" "css_element"
50 And I should see "Dog" in the ".tag_list" "css_element"
51 And I should see "Turtle" in the ".tag_list" "css_element"
52 And I should see "Fish" in the ".tag_list" "css_element"
8e355853
MG
53 And I log out
54
a27c42ee 55 @javascript
8e355853
MG
56 Scenario: Manager can change tag description, related tags and rename the tag from tag view page
57 When I log in as "manager1"
7a12a02d
MG
58 And I press "Customise this page"
59 # TODO MDL-57120 site "Participants" link not accessible without navigation block.
60 And I add the "Navigation" block if not present
810805da
MG
61 And I navigate to "Participants" node in "Site pages"
62 And I follow "User 1"
8e355853
MG
63 And I follow "Cat"
64 And I follow "Edit this tag"
65 And I set the following fields to these values:
66 | Tag name | Kitten |
67 | Description | Description of tag 1 |
68 | Related tags | Dog, Turtle,Fish |
e11d7380 69 | Standard | 0 |
8e355853
MG
70 And I press "Update"
71 Then "Kitten" "text" should exist in the ".breadcrumb-nav" "css_element"
c026a28d
MG
72 And "Description of tag 1" "text" should exist in the ".tag-description" "css_element"
73 And I should see "Related tags:" in the ".tag_list" "css_element"
74 And I should see "Dog" in the ".tag_list" "css_element"
75 And I should see "Turtle" in the ".tag_list" "css_element"
76 And I should see "Fish" in the ".tag_list" "css_element"
8e355853 77 And I follow "Edit this tag"
a27c42ee 78 And I click on "× Dog" "text"
8e355853
MG
79 And I press "Update"
80 Then "Kitten" "text" should exist in the ".breadcrumb-nav" "css_element"
c026a28d
MG
81 And "Description of tag 1" "text" should exist in the ".tag-description" "css_element"
82 And I should see "Related tags:" in the ".tag_list" "css_element"
83 And I should see "Turtle" in the ".tag_list" "css_element"
84 And I should see "Fish" in the ".tag_list" "css_element"
8e355853
MG
85 And I should not see "Dog"
86 And I log out
87
88 Scenario: Renaming the tag from tag view page
89 When I log in as "manager1"
7a12a02d
MG
90 And I press "Customise this page"
91 # TODO MDL-57120 site "Participants" link not accessible without navigation block.
92 And I add the "Navigation" block if not present
810805da
MG
93 And I navigate to "Participants" node in "Site pages"
94 And I follow "User 1"
8e355853
MG
95 And I follow "Cat"
96 And I follow "Edit this tag"
97 And I set the following fields to these values:
98 | Tag name | DOG |
99 And I press "Update"
c026a28d 100 And I should see "Tag names already being used"
8e355853
MG
101 And I set the following fields to these values:
102 | Tag name | Kitten |
103 And I press "Update"
104 Then "Kitten" "text" should exist in the ".breadcrumb-nav" "css_element"
105 And I follow "Edit this tag"
106 And I set the following fields to these values:
107 | Tag name | KITTEN |
108 And I press "Update"
109 And "KITTEN" "text" should exist in the ".breadcrumb-nav" "css_element"
110 And I log out
111
a27c42ee 112 @javascript
8e355853
MG
113 Scenario: Manager can change tag description and rename the tag from tag manage page
114 When I log in as "manager1"
115 And I navigate to "Manage tags" node in "Site administration > Appearance"
c026a28d 116 And I follow "Default collection"
8e355853
MG
117 And I click on "Edit this tag" "link" in the "Cat" "table_row"
118 And I set the following fields to these values:
119 | Tag name | Kitten |
120 | Description | Description of tag 1 |
121 | Related tags | Dog, Turtle,Fish |
e11d7380 122 | Standard | 0 |
8e355853 123 And I press "Update"
c026a28d 124 Then "Default collection" "link" should exist in the ".breadcrumb-nav" "css_element"
8e355853 125 And I follow "Kitten"
c026a28d
MG
126 And "Description of tag 1" "text" should exist in the ".tag-description" "css_element"
127 And I should see "Related tags:" in the ".tag_list" "css_element"
128 And I should see "Dog" in the ".tag_list" "css_element"
129 And I should see "Turtle" in the ".tag_list" "css_element"
130 And I should see "Fish" in the ".tag_list" "css_element"
8e355853
MG
131 And I log out
132
133 Scenario: Renaming the tag in edit tag form from tag manage page
134 When I log in as "manager1"
135 And I navigate to "Manage tags" node in "Site administration > Appearance"
c026a28d 136 And I follow "Default collection"
8e355853
MG
137 And I click on "Edit this tag" "link" in the "Cat" "table_row"
138 And I set the following fields to these values:
139 | Tag name | DOG |
140 And I press "Update"
c026a28d 141 And I should see "Tag names already being used"
8e355853
MG
142 And I set the following fields to these values:
143 | Tag name | Kitten |
144 And I press "Update"
c026a28d 145 Then "Default collection" "text" should exist in the ".breadcrumb-nav" "css_element"
8e355853
MG
146 And I click on "Edit this tag" "link" in the "Kitten" "table_row"
147 And I set the following fields to these values:
148 | Tag name | KITTEN |
149 And I press "Update"
c026a28d 150 And "Default collection" "text" should exist in the ".breadcrumb-nav" "css_element"
8e355853
MG
151 And I should see "KITTEN"
152 And I should not see "Kitten"
153 And I log out
154
155 @javascript
156 Scenario: Renaming the tag using quick edit field on tag manage page
157 When I log in as "manager1"
158 And I navigate to "Manage tags" node in "Site administration > Appearance"
c026a28d 159 And I follow "Default collection"
8e355853
MG
160 # Renaming tag to a valid name
161 And I click on "Edit tag name" "link" in the "Cat" "table_row"
162 And I set the field "New name for tag Cat" to "Kitten"
163 And I press key "13" in the field "New name for tag Cat"
164 Then I should not see "Cat"
cdc5f978 165 And "New name for tag" "field" should not exist
8e355853 166 And I wait until "Kitten" "link" exists
c026a28d 167 And I follow "Default collection"
8e355853
MG
168 And I should see "Kitten"
169 And I should not see "Cat"
170 # Renaming tag to an invalid name
171 And I click on "Edit tag name" "link" in the "Turtle" "table_row"
172 And I set the field "New name for tag Turtle" to "DOG"
173 And I press key "13" in the field "New name for tag Turtle"
c1d44340 174 And I should see "The tag name is already in use. Do you want to combine these tags?"
0d202789 175 And I press "Cancel"
cdc5f978 176 And "New name for tag" "field" should not exist
8e355853
MG
177 And I should see "Turtle"
178 And I should see "Dog"
179 And I should not see "DOG"
c026a28d 180 And I follow "Default collection"
8e355853
MG
181 And I should see "Turtle"
182 And I should see "Dog"
183 And I should not see "DOG"
184 # Cancel tag renaming
185 And I click on "Edit tag name" "link" in the "Dog" "table_row"
186 And I set the field "New name for tag Dog" to "Penguin"
187 And I press key "27" in the field "New name for tag Dog"
cdc5f978 188 And "New name for tag" "field" should not exist
8e355853
MG
189 And I should see "Turtle"
190 And I should not see "Penguin"
c026a28d 191 And I follow "Default collection"
8e355853
MG
192 And I should see "Turtle"
193 And I should not see "Penguin"
194 And I log out
0d202789
MG
195
196 @javascript
197 Scenario: Combining tags when renaming
198 When I log in as "manager1"
199 And I navigate to "Manage tags" node in "Site administration > Appearance"
200 And I follow "Default collection"
201 And I click on "Edit tag name" "link" in the "Turtle" "table_row"
202 And I set the field "New name for tag Turtle" to "DOG"
203 And I press key "13" in the field "New name for tag Turtle"
c1d44340 204 And I should see "The tag name is already in use. Do you want to combine these tags?"
0d202789
MG
205 And I press "Yes"
206 Then I should not see "Turtle"
207 And I should not see "DOG"
208 And I should see "Dog"
209 And I log out
210
211 @javascript
212 Scenario: Combining multiple tags
213 When I log in as "manager1"
214 And I navigate to "Manage tags" node in "Site administration > Appearance"
215 And I follow "Default collection"
216 And I set the following fields to these values:
217 | Select tag Dog | 1 |
218 | Select tag Neverusedtag | 1 |
219 | Select tag Turtle | 1 |
220 And I press "Combine selected"
221 And I should see "Select the tag that will be used after combining"
222 And I click on "//form[@id='combinetags_form']//input[@type='radio'][3]" "xpath_element"
223 And I press "Continue"
224 Then I should see "Tags are combined"
225 And I should not see "Dog"
226 And I should not see "Neverusedtag"
227 And I should see "Turtle"
228 # Even though Turtle was not standard but at least one of combined tags was (Neverusedtag). Now Turtle is also standard.
229 And "Remove from standard tags" "link" should exist in the "Turtle" "table_row"
230 And I log out
1e34257e
MG
231
232 Scenario: Filtering tags
233 When I log in as "manager1"
234 And I navigate to "Manage tags" node in "Site administration > Appearance"
235 And I follow "Default collection"
236 And I should not see "Reset filter"
237 And I set the field "Search" to "t"
238 And I press "Search"
239 Then the field "Search" matches value "t"
240 And I should not see "Dog"
241 And I should see "Cat"
242 And I should see "Turtle"
243 And I follow "Reset filter"
244 And I should see "Dog"
245 And I should see "Cat"
246 And I should see "Turtle"
247 And I log out