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 "Participants" link not accessible without navigation block.
36 And I add the "Navigation" block if not present
37 And I navigate to "Participants" node in "Site pages"
40 And I follow "Edit this tag"
41 And I should not see "Tag name"
42 And I should not see "Standard"
43 And I set the following fields to these values:
44 | Description | Description of tag 1 |
45 | Related tags | Dog, Turtle,Fish |
47 Then "Cat" "text" should exist in the ".breadcrumb-nav" "css_element"
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"
56 Scenario: Manager can change tag description, related tags and rename the tag from tag view page
57 When I log in as "manager1"
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
61 And I navigate to "Participants" node in "Site pages"
64 And I follow "Edit this tag"
65 And I set the following fields to these values:
67 | Description | Description of tag 1 |
68 | Related tags | Dog, Turtle,Fish |
71 Then "Kitten" "text" should exist in the ".breadcrumb-nav" "css_element"
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"
77 And I follow "Edit this tag"
78 And I click on "× Dog" "text"
80 Then "Kitten" "text" should exist in the ".breadcrumb-nav" "css_element"
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"
85 And I should not see "Dog"
88 Scenario: Renaming the tag from tag view page
89 When I log in as "manager1"
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
93 And I navigate to "Participants" node in "Site pages"
96 And I follow "Edit this tag"
97 And I set the following fields to these values:
100 And I should see "Tag names already being used"
101 And I set the following fields to these values:
102 | Tag name | Kitten |
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 |
109 And "KITTEN" "text" should exist in the ".breadcrumb-nav" "css_element"
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"
116 And I follow "Default collection"
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 |
124 Then "Default collection" "link" should exist in the ".breadcrumb-nav" "css_element"
125 And I follow "Kitten"
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"
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"
136 And I follow "Default collection"
137 And I click on "Edit this tag" "link" in the "Cat" "table_row"
138 And I set the following fields to these values:
141 And I should see "Tag names already being used"
142 And I set the following fields to these values:
143 | Tag name | Kitten |
145 Then "Default collection" "text" should exist in the ".breadcrumb-nav" "css_element"
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 |
150 And "Default collection" "text" should exist in the ".breadcrumb-nav" "css_element"
151 And I should see "KITTEN"
152 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 "Manage tags" node in "Site administration > Appearance"
159 And I follow "Default collection"
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"
165 And "New name for tag" "field" should not exist
166 And I wait until "Kitten" "link" exists
167 And I follow "Default collection"
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"
174 And I should see "The tag name is already in use. Do you want to combine these tags?"
176 And "New name for tag" "field" should not exist
177 And I should see "Turtle"
178 And I should see "Dog"
179 And I should not see "DOG"
180 And I follow "Default collection"
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"
188 And "New name for tag" "field" should not exist
189 And I should see "Turtle"
190 And I should not see "Penguin"
191 And I follow "Default collection"
192 And I should see "Turtle"
193 And I should not see "Penguin"
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"
204 And I should see "The tag name is already in use. Do you want to combine these tags?"
206 Then I should not see "Turtle"
207 And I should not see "DOG"
208 And I should see "Dog"
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"
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"
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"