Commit | Line | Data |
---|---|---|
8e355853 MG |
1 | @core @core_tag |
2 | Feature: 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 | 34 | And I press "Customise this page" |
d131489e | 35 | # TODO MDL-57120 site "Tags" link not accessible without navigation block. |
7a12a02d | 36 | And I add the "Navigation" block if not present |
02fda279 VDF |
37 | And I click on "Site pages" "list_item" in the "Navigation" "block" |
38 | And I click on "Tags" "link" in the "Navigation" "block" | |
d131489e | 39 | And I follow "Turtle" |
810805da | 40 | And I follow "User 1" |
8e355853 MG |
41 | And I follow "Cat" |
42 | And I follow "Edit this tag" | |
43 | And I should not see "Tag name" | |
e11d7380 | 44 | And I should not see "Standard" |
8e355853 MG |
45 | And I set the following fields to these values: |
46 | | Description | Description of tag 1 | | |
47 | | Related tags | Dog, Turtle,Fish | | |
48 | And I press "Update" | |
3ec69c2e | 49 | Then "Cat" "text" should exist in the ".breadcrumb" "css_element" |
c026a28d MG |
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" | |
8e355853 MG |
55 | And I log out |
56 | ||
a27c42ee | 57 | @javascript |
8e355853 MG |
58 | Scenario: Manager can change tag description, related tags and rename the tag from tag view page |
59 | When I log in as "manager1" | |
7a12a02d | 60 | And I press "Customise this page" |
d131489e | 61 | # TODO MDL-57120 site "Tags" link not accessible without navigation block. |
7a12a02d | 62 | And I add the "Navigation" block if not present |
02fda279 VDF |
63 | And I click on "Site pages" "list_item" in the "Navigation" "block" |
64 | And I click on "Tags" "link" in the "Navigation" "block" | |
d131489e | 65 | And I follow "Turtle" |
810805da | 66 | And I follow "User 1" |
8e355853 MG |
67 | And I follow "Cat" |
68 | And I follow "Edit this tag" | |
69 | And I set the following fields to these values: | |
70 | | Tag name | Kitten | | |
71 | | Description | Description of tag 1 | | |
72 | | Related tags | Dog, Turtle,Fish | | |
e11d7380 | 73 | | Standard | 0 | |
8e355853 | 74 | And I press "Update" |
3ec69c2e | 75 | Then "Kitten" "text" should exist in the ".breadcrumb" "css_element" |
c026a28d MG |
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" | |
8e355853 | 81 | And I follow "Edit this tag" |
a27c42ee | 82 | And I click on "× Dog" "text" |
8e355853 | 83 | And I press "Update" |
3ec69c2e | 84 | Then "Kitten" "text" should exist in the ".breadcrumb" "css_element" |
c026a28d MG |
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" | |
8e355853 MG |
89 | And I should not see "Dog" |
90 | And I log out | |
91 | ||
92 | Scenario: Renaming the tag from tag view page | |
93 | When I log in as "manager1" | |
7a12a02d | 94 | And I press "Customise this page" |
d131489e | 95 | # TODO MDL-57120 site "Tags" link not accessible without navigation block. |
7a12a02d | 96 | And I add the "Navigation" block if not present |
02fda279 | 97 | And I click on "Tags" "link" in the "Navigation" "block" |
d131489e | 98 | And I follow "Turtle" |
810805da | 99 | And I follow "User 1" |
8e355853 MG |
100 | And I follow "Cat" |
101 | And I follow "Edit this tag" | |
102 | And I set the following fields to these values: | |
103 | | Tag name | DOG | | |
104 | And I press "Update" | |
c026a28d | 105 | And I should see "Tag names already being used" |
8e355853 MG |
106 | And I set the following fields to these values: |
107 | | Tag name | Kitten | | |
108 | And I press "Update" | |
3ec69c2e | 109 | Then "Kitten" "text" should exist in the ".breadcrumb" "css_element" |
8e355853 MG |
110 | And I follow "Edit this tag" |
111 | And I set the following fields to these values: | |
112 | | Tag name | KITTEN | | |
113 | And I press "Update" | |
3ec69c2e | 114 | And "KITTEN" "text" should exist in the ".breadcrumb" "css_element" |
8e355853 MG |
115 | And I log out |
116 | ||
a27c42ee | 117 | @javascript |
8e355853 MG |
118 | Scenario: Manager can change tag description and rename the tag from tag manage page |
119 | When I log in as "manager1" | |
02fda279 | 120 | And I navigate to "Appearance > Manage tags" in site administration |
c026a28d | 121 | And I follow "Default collection" |
8e355853 MG |
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 | | |
e11d7380 | 127 | | Standard | 0 | |
8e355853 | 128 | And I press "Update" |
3ec69c2e | 129 | Then "Default collection" "link" should exist in the ".breadcrumb" "css_element" |
8e355853 | 130 | And I follow "Kitten" |
c026a28d MG |
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" | |
8e355853 MG |
136 | And I log out |
137 | ||
138 | Scenario: Renaming the tag in edit tag form from tag manage page | |
139 | When I log in as "manager1" | |
02fda279 | 140 | And I navigate to "Appearance > Manage tags" in site administration |
c026a28d | 141 | And I follow "Default collection" |
8e355853 MG |
142 | And I click on "Edit this tag" "link" in the "Cat" "table_row" |
143 | And I set the following fields to these values: | |
144 | | Tag name | DOG | | |
145 | And I press "Update" | |
c026a28d | 146 | And I should see "Tag names already being used" |
8e355853 MG |
147 | And I set the following fields to these values: |
148 | | Tag name | Kitten | | |
149 | And I press "Update" | |
3ec69c2e | 150 | Then "Default collection" "text" should exist in the ".breadcrumb" "css_element" |
8e355853 MG |
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 | | |
154 | And I press "Update" | |
3ec69c2e | 155 | And "Default collection" "text" should exist in the ".breadcrumb" "css_element" |
8e355853 MG |
156 | And I should see "KITTEN" |
157 | And I should not see "Kitten" | |
158 | And I log out | |
159 | ||
160 | @javascript | |
161 | Scenario: Renaming the tag using quick edit field on tag manage page | |
162 | When I log in as "manager1" | |
02fda279 | 163 | And I navigate to "Appearance > Manage tags" in site administration |
c026a28d | 164 | And I follow "Default collection" |
8e355853 MG |
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" | |
cdc5f978 | 170 | And "New name for tag" "field" should not exist |
8e355853 | 171 | And I wait until "Kitten" "link" exists |
c026a28d | 172 | And I follow "Default collection" |
8e355853 MG |
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" | |
c1d44340 | 179 | And I should see "The tag name is already in use. Do you want to combine these tags?" |
0d202789 | 180 | And I press "Cancel" |
cdc5f978 | 181 | And "New name for tag" "field" should not exist |
8e355853 MG |
182 | And I should see "Turtle" |
183 | And I should see "Dog" | |
184 | And I should not see "DOG" | |
c026a28d | 185 | And I follow "Default collection" |
8e355853 MG |
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" | |
cdc5f978 | 193 | And "New name for tag" "field" should not exist |
8e355853 MG |
194 | And I should see "Turtle" |
195 | And I should not see "Penguin" | |
c026a28d | 196 | And I follow "Default collection" |
8e355853 MG |
197 | And I should see "Turtle" |
198 | And I should not see "Penguin" | |
199 | And I log out | |
0d202789 MG |
200 | |
201 | @javascript | |
202 | Scenario: Combining tags when renaming | |
203 | When I log in as "manager1" | |
02fda279 | 204 | And I navigate to "Appearance > Manage tags" in site administration |
0d202789 MG |
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" | |
c1d44340 | 209 | And I should see "The tag name is already in use. Do you want to combine these tags?" |
0d202789 MG |
210 | And I press "Yes" |
211 | Then I should not see "Turtle" | |
212 | And I should not see "DOG" | |
213 | And I should see "Dog" | |
214 | And I log out | |
215 | ||
216 | @javascript | |
217 | Scenario: Combining multiple tags | |
218 | When I log in as "manager1" | |
02fda279 | 219 | And I navigate to "Appearance > Manage tags" in site administration |
0d202789 MG |
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" | |
65cac800 | 227 | And I click on "Turtle" "radio" in the "#combinetags_form" "css_element" |
0d202789 MG |
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" | |
235 | And I log out | |
1e34257e MG |
236 | |
237 | Scenario: Filtering tags | |
238 | When I log in as "manager1" | |
02fda279 | 239 | And I navigate to "Appearance > Manage tags" in site administration |
1e34257e MG |
240 | And I follow "Default collection" |
241 | And I should not see "Reset filter" | |
242 | And I set the field "Search" to "t" | |
243 | And I press "Search" | |
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" | |
252 | And I log out |