2 Feature: Users can edit tags to add description or rename
5 I need to be able to edit tags
8 Given the following "users" exist:
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 | |
13 Given the following "roles" exist:
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:
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:
28 | capability | permission |
29 | moodle/tag:edit | Allow |
30 | moodle/site:viewparticipants | Allow |
31 | moodle/user:viewdetails | Allow |
33 When I log in as "editor1"
34 And I press "Customise this page"
35 # TODO MDL-57120 site "Tags" link not accessible without navigation block.
36 And I add the "Navigation" block if not present
37 And I click on "Site pages" "list_item" in the "Navigation" "block"
38 And I click on "Tags" "link" in the "Navigation" "block"
42 And I follow "Edit this tag"
43 And I should not see "Tag name"
44 And I should not see "Standard"
45 And I set the following fields to these values:
46 | Description | Description of tag 1 |
47 | Related tags | Dog, Turtle,Fish |
49 Then "Cat" "text" should exist in the ".breadcrumb" "css_element"
50 And "Description of tag 1" "text" should exist in the ".tag-description" "css_element"
51 And I should see "Related tags:" in the ".tag_list" "css_element"
52 And I should see "Dog" in the ".tag_list" "css_element"
53 And I should see "Turtle" in the ".tag_list" "css_element"
54 And I should see "Fish" in the ".tag_list" "css_element"
58 Scenario: Manager can change tag description, related tags and rename the tag from tag view page
59 When I log in as "manager1"
60 And I press "Customise this page"
61 # TODO MDL-57120 site "Tags" link not accessible without navigation block.
62 And I add the "Navigation" block if not present
63 And I click on "Site pages" "list_item" in the "Navigation" "block"
64 And I click on "Tags" "link" in the "Navigation" "block"
68 And I follow "Edit this tag"
69 And I set the following fields to these values:
71 | Description | Description of tag 1 |
72 | Related tags | Dog, Turtle,Fish |
75 Then "Kitten" "text" should exist in the ".breadcrumb" "css_element"
76 And "Description of tag 1" "text" should exist in the ".tag-description" "css_element"
77 And I should see "Related tags:" in the ".tag_list" "css_element"
78 And I should see "Dog" in the ".tag_list" "css_element"
79 And I should see "Turtle" in the ".tag_list" "css_element"
80 And I should see "Fish" in the ".tag_list" "css_element"
81 And I follow "Edit this tag"
82 And I click on "× Dog" "text"
84 Then "Kitten" "text" should exist in the ".breadcrumb" "css_element"
85 And "Description of tag 1" "text" should exist in the ".tag-description" "css_element"
86 And I should see "Related tags:" in the ".tag_list" "css_element"
87 And I should see "Turtle" in the ".tag_list" "css_element"
88 And I should see "Fish" in the ".tag_list" "css_element"
89 And I should not see "Dog"
92 Scenario: Renaming the tag from tag view page
93 When I log in as "manager1"
94 And I press "Customise this page"
95 # TODO MDL-57120 site "Tags" link not accessible without navigation block.
96 And I add the "Navigation" block if not present
97 And I click on "Tags" "link" in the "Navigation" "block"
101 And I follow "Edit this tag"
102 And I set the following fields to these values:
105 And I should see "Tag names already being used"
106 And I set the following fields to these values:
107 | Tag name | Kitten |
109 Then "Kitten" "text" should exist in the ".breadcrumb" "css_element"
110 And I follow "Edit this tag"
111 And I set the following fields to these values:
112 | Tag name | KITTEN |
114 And "KITTEN" "text" should exist in the ".breadcrumb" "css_element"
118 Scenario: Manager can change tag description and rename the tag from tag manage page
119 When I log in as "manager1"
120 And I navigate to "Appearance > Manage tags" in site administration
121 And I follow "Default collection"
122 And I click on "Edit this tag" "link" in the "Cat" "table_row"
123 And I set the following fields to these values:
124 | Tag name | Kitten |
125 | Description | Description of tag 1 |
126 | Related tags | Dog, Turtle,Fish |
129 Then "Default collection" "link" should exist in the ".breadcrumb" "css_element"
130 And I follow "Kitten"
131 And "Description of tag 1" "text" should exist in the ".tag-description" "css_element"
132 And I should see "Related tags:" in the ".tag_list" "css_element"
133 And I should see "Dog" in the ".tag_list" "css_element"
134 And I should see "Turtle" in the ".tag_list" "css_element"
135 And I should see "Fish" in the ".tag_list" "css_element"
138 Scenario: Renaming the tag in edit tag form from tag manage page
139 When I log in as "manager1"
140 And I navigate to "Appearance > Manage tags" in site administration
141 And I follow "Default collection"
142 And I click on "Edit this tag" "link" in the "Cat" "table_row"
143 And I set the following fields to these values:
146 And I should see "Tag names already being used"
147 And I set the following fields to these values:
148 | Tag name | Kitten |
150 Then "Default collection" "text" should exist in the ".breadcrumb" "css_element"
151 And I click on "Edit this tag" "link" in the "Kitten" "table_row"
152 And I set the following fields to these values:
153 | Tag name | KITTEN |
155 And "Default collection" "text" should exist in the ".breadcrumb" "css_element"
156 And I should see "KITTEN"
157 And I should not see "Kitten"
161 Scenario: Renaming the tag using quick edit field on tag manage page
162 When I log in as "manager1"
163 And I navigate to "Appearance > Manage tags" in site administration
164 And I follow "Default collection"
165 # Renaming tag to a valid name
166 And I click on "Edit tag name" "link" in the "Cat" "table_row"
167 And I set the field "New name for tag Cat" to "Kitten"
168 And I press key "13" in the field "New name for tag Cat"
169 Then I should not see "Cat"
170 And "New name for tag" "field" should not exist
171 And I wait until "Kitten" "link" exists
172 And I follow "Default collection"
173 And I should see "Kitten"
174 And I should not see "Cat"
175 # Renaming tag to an invalid name
176 And I click on "Edit tag name" "link" in the "Turtle" "table_row"
177 And I set the field "New name for tag Turtle" to "DOG"
178 And I press key "13" in the field "New name for tag Turtle"
179 And I should see "The tag name is already in use. Do you want to combine these tags?"
181 And "New name for tag" "field" should not exist
182 And I should see "Turtle"
183 And I should see "Dog"
184 And I should not see "DOG"
185 And I follow "Default collection"
186 And I should see "Turtle"
187 And I should see "Dog"
188 And I should not see "DOG"
189 # Cancel tag renaming
190 And I click on "Edit tag name" "link" in the "Dog" "table_row"
191 And I set the field "New name for tag Dog" to "Penguin"
192 And I press key "27" in the field "New name for tag Dog"
193 And "New name for tag" "field" should not exist
194 And I should see "Turtle"
195 And I should not see "Penguin"
196 And I follow "Default collection"
197 And I should see "Turtle"
198 And I should not see "Penguin"
202 Scenario: Combining tags when renaming
203 When I log in as "manager1"
204 And I navigate to "Appearance > Manage tags" in site administration
205 And I follow "Default collection"
206 And I click on "Edit tag name" "link" in the "Turtle" "table_row"
207 And I set the field "New name for tag Turtle" to "DOG"
208 And I press key "13" in the field "New name for tag Turtle"
209 And I should see "The tag name is already in use. Do you want to combine these tags?"
211 Then I should not see "Turtle"
212 And I should not see "DOG"
213 And I should see "Dog"
217 Scenario: Combining multiple tags
218 When I log in as "manager1"
219 And I navigate to "Appearance > Manage tags" in site administration
220 And I follow "Default collection"
221 And I set the following fields to these values:
222 | Select tag Dog | 1 |
223 | Select tag Neverusedtag | 1 |
224 | Select tag Turtle | 1 |
225 And I press "Combine selected"
226 And I should see "Select the tag that will be used after combining"
227 And I click on "Turtle" "radio" in the "#combinetags_form" "css_element"
228 And I press "Continue"
229 Then I should see "Tags are combined"
230 And I should not see "Dog"
231 And I should not see "Neverusedtag"
232 And I should see "Turtle"
233 # Even though Turtle was not standard but at least one of combined tags was (Neverusedtag). Now Turtle is also standard.
234 And "Remove from standard tags" "link" should exist in the "Turtle" "table_row"
237 Scenario: Filtering tags
238 When I log in as "manager1"
239 And I navigate to "Appearance > Manage tags" in site administration
240 And I follow "Default collection"
241 And I should not see "Reset filter"
242 And I set the field "Search" to "t"
244 Then the field "Search" matches value "t"
245 And I should not see "Dog"
246 And I should see "Cat"
247 And I should see "Turtle"
248 And I follow "Reset filter"
249 And I should see "Dog"
250 And I should see "Cat"
251 And I should see "Turtle"