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"
57 Scenario: Manager can change tag description, related tags and rename the tag from tag view page
58 When I log in as "manager1"
59 And I press "Customise this page"
60 # TODO MDL-57120 site "Tags" link not accessible without navigation block.
61 And I add the "Navigation" block if not present
62 And I click on "Site pages" "list_item" in the "Navigation" "block"
63 And I click on "Tags" "link" in the "Navigation" "block"
67 And I follow "Edit this tag"
68 And I set the following fields to these values:
70 | Description | Description of tag 1 |
71 | Related tags | Dog, Turtle,Fish |
74 Then "Kitten" "text" should exist in the ".breadcrumb" "css_element"
75 And "Description of tag 1" "text" should exist in the ".tag-description" "css_element"
76 And I should see "Related tags:" in the ".tag_list" "css_element"
77 And I should see "Dog" in the ".tag_list" "css_element"
78 And I should see "Turtle" in the ".tag_list" "css_element"
79 And I should see "Fish" in the ".tag_list" "css_element"
80 And I follow "Edit this tag"
81 And I click on "× Dog" "text"
83 Then "Kitten" "text" should exist in the ".breadcrumb" "css_element"
84 And "Description of tag 1" "text" should exist in the ".tag-description" "css_element"
85 And I should see "Related tags:" in the ".tag_list" "css_element"
86 And I should see "Turtle" in the ".tag_list" "css_element"
87 And I should see "Fish" in the ".tag_list" "css_element"
88 And I should not see "Dog"
90 Scenario: Renaming the tag from tag view page
91 When I log in as "manager1"
92 And I press "Customise this page"
93 # TODO MDL-57120 site "Tags" link not accessible without navigation block.
94 And I add the "Navigation" block if not present
95 And I click on "Tags" "link" in the "Navigation" "block"
99 And I follow "Edit this tag"
100 And I set the following fields to these values:
103 And I should see "Tag names already being used"
104 And I set the following fields to these values:
105 | Tag name | Kitten |
107 Then "Kitten" "text" should exist in the ".breadcrumb" "css_element"
108 And I follow "Edit this tag"
109 And I set the following fields to these values:
110 | Tag name | KITTEN |
112 And "KITTEN" "text" should exist in the ".breadcrumb" "css_element"
115 Scenario: Manager can change tag description and rename the tag from tag manage page
116 When I log in as "manager1"
117 And I navigate to "Appearance > Manage tags" in site administration
118 And I follow "Default collection"
119 And I click on "Edit this tag" "link" in the "Cat" "table_row"
120 And I set the following fields to these values:
121 | Tag name | Kitten |
122 | Description | Description of tag 1 |
123 | Related tags | Dog, Turtle,Fish |
126 Then "Default collection" "link" should exist in the ".breadcrumb" "css_element"
127 And I follow "Kitten"
128 And "Description of tag 1" "text" should exist in the ".tag-description" "css_element"
129 And I should see "Related tags:" in the ".tag_list" "css_element"
130 And I should see "Dog" in the ".tag_list" "css_element"
131 And I should see "Turtle" in the ".tag_list" "css_element"
132 And I should see "Fish" in the ".tag_list" "css_element"
134 Scenario: Renaming the tag in edit tag form from tag manage page
135 When I log in as "manager1"
136 And I navigate to "Appearance > Manage tags" in site administration
137 And I follow "Default collection"
138 And I click on "Edit this tag" "link" in the "Cat" "table_row"
139 And I set the following fields to these values:
142 And I should see "Tag names already being used"
143 And I set the following fields to these values:
144 | Tag name | Kitten |
146 Then "Default collection" "text" should exist in the ".breadcrumb" "css_element"
147 And I click on "Edit this tag" "link" in the "Kitten" "table_row"
148 And I set the following fields to these values:
149 | Tag name | KITTEN |
151 And "Default collection" "text" should exist in the ".breadcrumb" "css_element"
152 And I should see "KITTEN"
153 And I should not see "Kitten"
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 "Appearance > Manage tags" in site administration
159 And I follow "Default collection"
160 # Renaming tag to a valid name
161 And I set the field "Edit tag name" in the "Cat" "table_row" to "Kitten"
162 Then I should not see "Cat"
163 And "New name for tag" "field" should not exist
164 And I follow "Default collection"
165 And I should see "Kitten"
166 And I should not see "Cat"
167 # Renaming tag to an invalid name
168 And I set the field "Edit tag name" in the "Turtle" "table_row" to "DOG"
169 And I should see "The tag name is already in use. Do you want to combine these tags?"
170 And I click on "Cancel" "button" in the "Confirm" "dialogue"
171 And "New name for tag" "field" should not exist
172 And I should see "Turtle"
173 And I should see "Dog"
174 And I should not see "DOG"
175 And I follow "Default collection"
176 And I should see "Turtle"
177 And I should see "Dog"
178 And I should not see "DOG"
179 # Cancel tag renaming
180 And I click on "Edit tag name" "link" in the "Dog" "table_row"
182 And I press the escape key
183 And "New name for tag" "field" should not exist
184 And I should see "Turtle"
185 And I should not see "Penguin"
186 And I follow "Default collection"
187 And I should see "Turtle"
188 And I should not see "Penguin"
191 Scenario: Combining tags when renaming
192 When I log in as "manager1"
193 And I navigate to "Appearance > Manage tags" in site administration
194 And I follow "Default collection"
195 And I set the field "Edit tag name" in the "Turtle" "table_row" to "DOG"
196 And I should see "The tag name is already in use. Do you want to combine these tags?"
198 Then I should not see "Turtle"
199 And I should not see "DOG"
200 And I should see "Dog"
203 Scenario: Combining multiple tags
204 When I log in as "manager1"
205 And I navigate to "Appearance > Manage tags" in site administration
206 And I follow "Default collection"
207 And I set the following fields to these values:
208 | Select tag Dog | 1 |
209 | Select tag Neverusedtag | 1 |
210 | Select tag Turtle | 1 |
211 And I press "Combine selected"
212 And I should see "Select the tag that will be used after combining"
213 And I click on "Turtle" "radio" in the "#combinetags_form" "css_element"
214 And I press "Continue"
215 Then I should see "Tags are combined"
216 And I should not see "Dog"
217 And I should not see "Neverusedtag"
218 And I should see "Turtle"
219 # Even though Turtle was not standard but at least one of combined tags was (Neverusedtag). Now Turtle is also standard.
220 And "Remove from standard tags" "link" should exist in the "Turtle" "table_row"
222 Scenario: Filtering tags
223 When I log in as "manager1"
224 And I navigate to "Appearance > Manage tags" in site administration
225 And I follow "Default collection"
226 And I should not see "Reset filter"
227 And I set the field "Search" to "t"
229 Then the field "Search" matches value "t"
230 And I should not see "Dog"
231 And I should see "Cat"
232 And I should see "Turtle"
233 And I follow "Reset filter"
234 And I should see "Dog"
235 And I should see "Cat"
236 And I should see "Turtle"