MDL-57455 mod_data: added 'Manage standard tags' link
[moodle.git] / mod / data / tests / behat / edit_tags.feature
CommitLineData
f4c5328c
AH
1@mod @mod_data @core_tag
2Feature: Edited data entries handle tags correctly
3 In order to get data entries 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 |
10 | student1 | Student | 1 | student1@example.com |
11 | teacher1 | Teacher | 1 | teacher1@example.com |
12 And the following "tags" exist:
13 | name | isstandard |
14 | Tag1 | 1 |
15 And the following "courses" exist:
16 | fullname | shortname | category |
17 | Course 1 | C1 | 0 |
18 And the following "course enrolments" exist:
19 | user | course | role |
20 | teacher1 | C1 | editingteacher |
21 | student1 | C1 | student |
22 And the following "activities" exist:
23 | activity | name | intro | course | idnumber |
24 | data | Test database name | n | C1 | data1 |
25 And I log in as "teacher1"
26 And I am on "Course 1" course homepage
27 And I add a "Text input" field to "Test database name" database and I fill the form with:
28 | Field name | Test field name |
29 | Field description | Test field description |
30 And I add a "Text input" field to "Test database name" database and I fill the form with:
31 | Field name | Test field 2 name |
32 | Field description | Test field 2 description |
33 # To generate the default templates.
34 And I follow "Templates"
35 And I wait until the page is ready
36 And I log out
37
38 @javascript
39 Scenario: Data entry of custom tags works as expected
40 Given I log in as "student1"
41 And I am on "Course 1" course homepage
42 And I add an entry to "Test database name" database with:
43 | Test field name | Student original entry untagged |
44 | Test field 2 name | Student original entry untagged 2 |
45 And I add an entry to "Test database name" database with:
46 | Test field name | Student original entry tagged |
47 | Test field 2 name | Student original entry tagged 2 |
48 And I set the field with xpath "//div[@class='datatagcontrol']//input[@type='text']" to "Tag1"
49 And I click on "[data-value='Tag1']" "css_element"
50 And I press "Save and view"
51 Then I should see "Student original entry"
52 And I should see "Tag1" in the "div.tag_list" "css_element"
53 And I follow "Edit"
54 And I should see "Tag1" in the ".form-autocomplete-selection" "css_element"
55 And I follow "View list"
56 And I should see "Tag1" in the "div.tag_list" "css_element"
57 And I follow "Search"
58 And I set the field with xpath "//div[@class='datatagcontrol']//input[@type='text']" to "Tag1"
59 And I click on "[data-value='Tag1']" "css_element"
60 And I press "Save settings"
61 And I should see "Student original entry tagged"
62 And I should see "Student original entry tagged 2"
63 And I should not see "Student original entry untagged"
64 And I should not see "Student original entry untagged 2"