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: | |
21 | | name | tagtype | | |
22 | | Neverusedtag | official | | |
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" | |
810805da MG |
34 | And I navigate to "Participants" node in "Site pages" |
35 | And I follow "User 1" | |
8e355853 MG |
36 | And I follow "Cat" |
37 | And I follow "Edit this tag" | |
38 | And I should not see "Tag name" | |
39 | And I should not see "Official" | |
40 | And I set the following fields to these values: | |
41 | | Description | Description of tag 1 | | |
42 | | Related tags | Dog, Turtle,Fish | | |
43 | And I press "Update" | |
44 | Then "Cat" "text" should exist in the ".breadcrumb-nav" "css_element" | |
45 | And "Description of tag 1" "text" should exist in the "#tag-description" "css_element" | |
46 | And I should see "Related tags: Dog, Turtle, Fish" | |
47 | And I log out | |
48 | ||
a27c42ee | 49 | @javascript |
8e355853 MG |
50 | Scenario: Manager can change tag description, related tags and rename the tag from tag view page |
51 | When I log in as "manager1" | |
810805da MG |
52 | And I navigate to "Participants" node in "Site pages" |
53 | And I follow "User 1" | |
8e355853 MG |
54 | And I follow "Cat" |
55 | And I follow "Edit this tag" | |
56 | And I set the following fields to these values: | |
57 | | Tag name | Kitten | | |
58 | | Description | Description of tag 1 | | |
59 | | Related tags | Dog, Turtle,Fish | | |
60 | | Official | 0 | | |
61 | And I press "Update" | |
62 | Then "Kitten" "text" should exist in the ".breadcrumb-nav" "css_element" | |
63 | And "Description of tag 1" "text" should exist in the "#tag-description" "css_element" | |
64 | And I should see "Related tags: Dog, Turtle, Fish" | |
65 | And I follow "Edit this tag" | |
a27c42ee | 66 | And I click on "× Dog" "text" |
8e355853 MG |
67 | And I press "Update" |
68 | Then "Kitten" "text" should exist in the ".breadcrumb-nav" "css_element" | |
69 | And "Description of tag 1" "text" should exist in the "#tag-description" "css_element" | |
70 | And I should see "Related tags: Turtle, Fish" | |
71 | And I should not see "Dog" | |
72 | And I log out | |
73 | ||
74 | Scenario: Renaming the tag from tag view page | |
75 | When I log in as "manager1" | |
810805da MG |
76 | And I navigate to "Participants" node in "Site pages" |
77 | And I follow "User 1" | |
8e355853 MG |
78 | And I follow "Cat" |
79 | And I follow "Edit this tag" | |
80 | And I set the following fields to these values: | |
81 | | Tag name | DOG | | |
82 | And I press "Update" | |
83 | And I should see "DOG: Tag names already being used" | |
84 | And I set the following fields to these values: | |
85 | | Tag name | Kitten | | |
86 | And I press "Update" | |
87 | Then "Kitten" "text" should exist in the ".breadcrumb-nav" "css_element" | |
88 | And I follow "Edit this tag" | |
89 | And I set the following fields to these values: | |
90 | | Tag name | KITTEN | | |
91 | And I press "Update" | |
92 | And "KITTEN" "text" should exist in the ".breadcrumb-nav" "css_element" | |
93 | And I log out | |
94 | ||
a27c42ee | 95 | @javascript |
8e355853 MG |
96 | Scenario: Manager can change tag description and rename the tag from tag manage page |
97 | When I log in as "manager1" | |
98 | And I navigate to "Manage tags" node in "Site administration > Appearance" | |
99 | And I click on "Edit this tag" "link" in the "Cat" "table_row" | |
100 | And I set the following fields to these values: | |
101 | | Tag name | Kitten | | |
102 | | Description | Description of tag 1 | | |
103 | | Related tags | Dog, Turtle,Fish | | |
104 | | Official | 0 | | |
105 | And I press "Update" | |
106 | Then "Manage tags" "link" should exist in the ".breadcrumb-nav" "css_element" | |
107 | And I follow "Kitten" | |
108 | And "Description of tag 1" "text" should exist in the "#tag-description" "css_element" | |
109 | And I should see "Related tags: Dog, Turtle, Fish" | |
110 | And I log out | |
111 | ||
112 | Scenario: Renaming the tag in edit tag form from tag manage page | |
113 | When I log in as "manager1" | |
114 | And I navigate to "Manage tags" node in "Site administration > Appearance" | |
115 | And I click on "Edit this tag" "link" in the "Cat" "table_row" | |
116 | And I set the following fields to these values: | |
117 | | Tag name | DOG | | |
118 | And I press "Update" | |
119 | And I should see "DOG: Tag names already being used" | |
120 | And I set the following fields to these values: | |
121 | | Tag name | Kitten | | |
122 | And I press "Update" | |
123 | Then "Manage tags" "text" should exist in the ".breadcrumb-nav" "css_element" | |
124 | And I click on "Edit this tag" "link" in the "Kitten" "table_row" | |
125 | And I set the following fields to these values: | |
126 | | Tag name | KITTEN | | |
127 | And I press "Update" | |
128 | And "Manage tags" "text" should exist in the ".breadcrumb-nav" "css_element" | |
129 | And I should see "KITTEN" | |
130 | And I should not see "Kitten" | |
131 | And I log out | |
132 | ||
133 | @javascript | |
134 | Scenario: Renaming the tag using quick edit field on tag manage page | |
135 | When I log in as "manager1" | |
136 | And I navigate to "Manage tags" node in "Site administration > Appearance" | |
137 | # Renaming tag to a valid name | |
138 | And I click on "Edit tag name" "link" in the "Cat" "table_row" | |
139 | And I set the field "New name for tag Cat" to "Kitten" | |
140 | And I press key "13" in the field "New name for tag Cat" | |
141 | Then I should not see "Cat" | |
142 | And "New name for tag" "field" should not be visible | |
143 | And I wait until "Kitten" "link" exists | |
144 | And I follow "Manage tags" | |
145 | And I should see "Kitten" | |
146 | And I should not see "Cat" | |
147 | # Renaming tag to an invalid name | |
148 | And I click on "Edit tag name" "link" in the "Turtle" "table_row" | |
149 | And I set the field "New name for tag Turtle" to "DOG" | |
150 | And I press key "13" in the field "New name for tag Turtle" | |
151 | And I should see "Tag names already being used" | |
152 | And I press "Ok" | |
153 | And "New name for tag" "field" should not be visible | |
154 | And I should see "Turtle" | |
155 | And I should see "Dog" | |
156 | And I should not see "DOG" | |
157 | And I follow "Manage tags" | |
158 | And I should see "Turtle" | |
159 | And I should see "Dog" | |
160 | And I should not see "DOG" | |
161 | # Cancel tag renaming | |
162 | And I click on "Edit tag name" "link" in the "Dog" "table_row" | |
163 | And I set the field "New name for tag Dog" to "Penguin" | |
164 | And I press key "27" in the field "New name for tag Dog" | |
165 | And "New name for tag" "field" should not be visible | |
166 | And I should see "Turtle" | |
167 | And I should not see "Penguin" | |
168 | And I follow "Manage tags" | |
169 | And I should see "Turtle" | |
170 | And I should not see "Penguin" | |
171 | And I log out |