MDL-50919 tags: new UI for managing tags
[moodle.git] / mod / wiki / tests / behat / edit_tags.feature
CommitLineData
8e355853 1@mod @mod_wiki @core_tag
a790c7f3
EL
2Feature: Edited wiki pages handle tags correctly
3 In order to get wiki pages properly labelled
4 As a user
5 I need to introduce the tags while editing
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
0fe86bbd
RT
10 | teacher1 | Teacher | 1 | teacher1@example.com |
11 | student1 | Student | 1 | student1@example.com |
a790c7f3
EL
12 And the following "courses" exist:
13 | fullname | shortname | category |
14 | Course 1 | C1 | 0 |
15 And the following "course enrolments" exist:
16 | user | course | role |
17 | teacher1 | C1 | editingteacher |
18 | student1 | C1 | student |
19 And I log in as "teacher1"
20 And I follow "Course 1"
21 And I turn editing mode on
22 And I add a "Wiki" to section "1" and I fill the form with:
23 | Wiki name | Test wiki name |
24 | Description | Test wiki description |
25 | First page name | First page |
26 | Wiki mode | Collaborative wiki |
27 And I log out
28
29 Scenario: Wiki page edition of custom tags works as expected
30 Given I log in as "student1"
31 And I follow "Course 1"
32 And I follow "Test wiki name"
33 And I press "Create page"
34 When I set the following fields to these values:
35 | HTML format | Student page contents to be tagged |
36 | Other tags (enter tags separated by commas) | Example, Page, Cool |
37 And I press "Save"
38 Then I should see "Example" in the ".wiki-tags" "css_element"
39 And I should see "Page" in the ".wiki-tags" "css_element"
40 And I should see "Cool" in the ".wiki-tags" "css_element"
41 And I follow "Edit"
42 And the field "Other tags (enter tags separated by commas)" matches value "Example, Page, Cool"
43 And I press "Cancel"
44
45 Scenario: Wiki page edition of official tags works as expected
46 Given I log in as "admin"
47 And I expand "Site administration" node
48 And I expand "Appearance" node
49 And I follow "Manage tags"
50 And I set the field "otagsadd" to "OT1, OT2, OT3"
51 And I press "Add official tags"
52 And I log out
53 And I log in as "student1"
54 And I follow "Course 1"
55 And I follow "Test wiki name"
56 And I press "Create page"
57 And the "tags[officialtags][]" select box should contain "OT1"
58 And the "tags[officialtags][]" select box should contain "OT2"
59 And the "tags[officialtags][]" select box should contain "OT3"
60 When I set the following fields to these values:
61 | HTML format | Student page contents to be tagged |
62 | tags[officialtags][] | OT1, OT3 |
63 And I press "Save"
64 Then I should see "OT1" in the ".wiki-tags" "css_element"
65 And I should see "OT3" in the ".wiki-tags" "css_element"
66 And I should not see "OT2" in the ".wiki-tags" "css_element"
67 And I follow "Edit"
68 And the field "tags[officialtags][]" matches value "OT1, OT3"
69 And the field "tags[officialtags][]" does not match value "OT2"
70 And I press "Cancel"