MDL-51283 core_tag: Allow each tag area to set 'showstandard'
[moodle.git] / tag / tests / behat / standard_tags.feature
CommitLineData
e11d7380
MG
1@core @core_tag
2Feature: Manager can add standard tags and change the tag type of existing tags
3 In order to use tags
4 As a manage
5 I need to be able to change tag type
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | manager1 | Manager | 1 | manager1@example.com |
11 | user1 | User | 1 | user1@example.com |
12 And the following "system role assigns" exist:
13 | user | course | role |
14 | manager1 | Acceptance test site | manager |
15 And the following "tags" exist:
16 | name | isstandard |
17 | Tag0 | 0 |
18 | Tag1 | 0 |
19 | Tag2 | 0 |
20 | Tag3 | 1 |
21
22 Scenario: Adding standard tags
23 When I log in as "manager1"
24 And I navigate to "Manage tags" node in "Site administration > Appearance"
25 And I follow "Default collection"
26 Then "Make standard" "link" should exist in the "Tag0" "table_row"
27 And "Make standard" "link" should exist in the "Tag1" "table_row"
28 And "Make standard" "link" should exist in the "Tag2" "table_row"
29 And "Remove from standard tags" "link" should exist in the "Tag3" "table_row"
30 And I set the following fields to these values:
31 | Add standard tags | Tag1,TAG2,Tag3,Tag4,Tag5 |
32 And I press "Add standard tags"
33 And I should see "Standard tag(s) added"
34 # No changes to Tag0
35 And "Make standard" "link" should exist in the "Tag0" "table_row"
36 # Tag1 was already present, now it is standard
37 And "Remove from standard" "link" should exist in the "Tag1" "table_row"
38 # Tag2 was already present, now it is standard. It was not renamed to TAG2
39 And "Remove from standard" "link" should exist in the "Tag2" "table_row"
40 And I should not see "TAG2"
41 # Tag3 was already present and it already was standard
42 And "Remove from standard tags" "link" should exist in the "Tag3" "table_row"
43 # Tag4 and Tag5 were added as standard
44 And "Remove from standard tags" "link" should exist in the "Tag4" "table_row"
45 And "Remove from standard tags" "link" should exist in the "Tag5" "table_row"
46 And I log out
47
48 Scenario: Changing tag type with javascript disabled
49 When I log in as "manager1"
50 And I navigate to "Manage tags" node in "Site administration > Appearance"
51 And I follow "Default collection"
52 And I click on "Make standard" "link" in the "Tag0" "table_row"
53 And I should see "Tag type changed"
54 And I click on "Make standard" "link" in the "Tag1" "table_row"
55 And I should see "Tag type changed"
56 And I click on "Remove from standard tags" "link" in the "Tag0" "table_row"
57 And I should see "Tag type changed"
58 And I click on "Remove from standard tags" "link" in the "Tag3" "table_row"
59 And I should see "Tag type changed"
60 Then "Make standard" "link" should exist in the "Tag0" "table_row"
61 And "Remove from standard tags" "link" should exist in the "Tag1" "table_row"
62 And "Make standard" "link" should exist in the "Tag2" "table_row"
63 And "Make standard" "link" should exist in the "Tag3" "table_row"
64 And I log out
65
66 @javascript
67 Scenario: Changing tag type with javascript enabled
68 When I log in as "manager1"
69 And I navigate to "Manage tags" node in "Site administration > Appearance"
70 And I follow "Default collection"
71 And I click on "Make standard" "link" in the "Tag0" "table_row"
72 And I click on "Make standard" "link" in the "Tag1" "table_row"
73 And I wait until "//tr[contains(.,'Tag0')]//a[contains(@title,'Remove from standard tags')]" "xpath_element" exists
74 And I wait until "//tr[contains(.,'Tag1')]//a[contains(@title,'Remove from standard tags')]" "xpath_element" exists
75 And I click on "Remove from standard tags" "link" in the "Tag0" "table_row"
76 And I click on "Remove from standard tags" "link" in the "Tag3" "table_row"
77 And I wait until "//tr[contains(.,'Tag0')]//a[contains(@title,'Make standard')]" "xpath_element" exists
78 And I wait until "//tr[contains(.,'Tag3')]//a[contains(@title,'Make standard')]" "xpath_element" exists
79 Then "Make standard" "link" should exist in the "Tag0" "table_row"
80 And "Remove from standard tags" "link" should exist in the "Tag1" "table_row"
81 And "Make standard" "link" should exist in the "Tag2" "table_row"
82 And "Make standard" "link" should exist in the "Tag3" "table_row"
83 And I follow "Default collection"
84 And "Make standard" "link" should exist in the "Tag0" "table_row"
85 And "Remove from standard tags" "link" should exist in the "Tag1" "table_row"
86 And "Make standard" "link" should exist in the "Tag2" "table_row"
87 And "Make standard" "link" should exist in the "Tag3" "table_row"
88 And I log out
89
90 Scenario: Changing tag type in edit form
91 When I log in as "manager1"
92 And I navigate to "Manage tags" node in "Site administration > Appearance"
93 And I follow "Default collection"
94 And I click on "Edit this tag" "link" in the "Tag1" "table_row"
95 And I set the following fields to these values:
96 | Standard | 1 |
97 And I press "Update"
98 Then "Remove from standard tags" "link" should exist in the "Tag1" "table_row"
99 And I click on "Edit this tag" "link" in the "Tag1" "table_row"
100 And I set the following fields to these values:
101 | Standard | 0 |
102 And I press "Update"
103 And "Make standard" "link" should exist in the "Tag1" "table_row"
104 And I log out
4be9c7ad
MG
105
106 @javascript
107 Scenario: Changing standard tags property of tag area
108 When I log in as "manager1"
109 And I follow "Profile" in the user menu
110 And I follow "Edit profile"
111 And I expand all fieldsets
112 And I should not see "Manage standard tags"
113 And I set the following fields to these values:
114 | List of interests | Tag3 , Tag2 |
115 And I press "Update profile"
116 And I navigate to "Manage tags" node in "Site administration > Appearance"
117 And the field "Change showing standard tags in area User interests" matches value "Don't suggest"
118 And I set the field "Change showing standard tags in area User interests" to "Suggest"
119 And I follow "Profile" in the user menu
120 And I follow "Edit profile"
121 And I expand all fieldsets
122 And I should see "Manage standard tags"
123 And I navigate to "Manage tags" node in "Site administration > Appearance"
124 And the field "Change showing standard tags in area User interests" matches value "Suggest"
125 And I set the field "Change showing standard tags in area User interests" to "Force"
126 And I follow "Profile" in the user menu
127 And I should see "Tag3"
128 And I should see "Tag2"
129 And I follow "Edit profile"
130 And I expand all fieldsets
131 And I should see "Manage standard tags"
132 And I press "Update profile"
133 # Non-standard tags were automatically removed on form save.
134 And I should see "Tag3"
135 And I should not see "Tag2"
136 And I log out