From a790c7f317f6ee2305265f2aded26923fd4cda46 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Mon, 13 Jan 2014 22:03:55 +0100 Subject: [PATCH] MDL-43673 wiki: verify page tags work as expected This covers MDL-43109, verifying that saved tags are available on re-edition of a page, without any warning/error. Also official tags are verified to be working ok. With support for multiple options added by MDL-43713 and MDL-43738. --- mod/wiki/tests/behat/edit_tags.feature | 70 ++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 mod/wiki/tests/behat/edit_tags.feature diff --git a/mod/wiki/tests/behat/edit_tags.feature b/mod/wiki/tests/behat/edit_tags.feature new file mode 100644 index 00000000000..a3e3dfd0a73 --- /dev/null +++ b/mod/wiki/tests/behat/edit_tags.feature @@ -0,0 +1,70 @@ +@mod @mod_wiki +Feature: Edited wiki pages handle tags correctly + In order to get wiki pages properly labelled + As a user + I need to introduce the tags while editing + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | Teacher | 1 | teacher1@asd.com | + | student1 | Student | 1 | student1@asd.com | + And the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + And I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I add a "Wiki" to section "1" and I fill the form with: + | Wiki name | Test wiki name | + | Description | Test wiki description | + | First page name | First page | + | Wiki mode | Collaborative wiki | + And I log out + + Scenario: Wiki page edition of custom tags works as expected + Given I log in as "student1" + And I follow "Course 1" + And I follow "Test wiki name" + And I press "Create page" + When I set the following fields to these values: + | HTML format | Student page contents to be tagged | + | Other tags (enter tags separated by commas) | Example, Page, Cool | + And I press "Save" + Then I should see "Example" in the ".wiki-tags" "css_element" + And I should see "Page" in the ".wiki-tags" "css_element" + And I should see "Cool" in the ".wiki-tags" "css_element" + And I follow "Edit" + And the field "Other tags (enter tags separated by commas)" matches value "Example, Page, Cool" + And I press "Cancel" + + Scenario: Wiki page edition of official tags works as expected + Given I log in as "admin" + And I expand "Site administration" node + And I expand "Appearance" node + And I follow "Manage tags" + And I set the field "otagsadd" to "OT1, OT2, OT3" + And I press "Add official tags" + And I log out + And I log in as "student1" + And I follow "Course 1" + And I follow "Test wiki name" + And I press "Create page" + And the "tags[officialtags][]" select box should contain "OT1" + And the "tags[officialtags][]" select box should contain "OT2" + And the "tags[officialtags][]" select box should contain "OT3" + When I set the following fields to these values: + | HTML format | Student page contents to be tagged | + | tags[officialtags][] | OT1, OT3 | + And I press "Save" + Then I should see "OT1" in the ".wiki-tags" "css_element" + And I should see "OT3" in the ".wiki-tags" "css_element" + And I should not see "OT2" in the ".wiki-tags" "css_element" + And I follow "Edit" + And the field "tags[officialtags][]" matches value "OT1, OT3" + And the field "tags[officialtags][]" does not match value "OT2" + And I press "Cancel"