Merge branch 'MDL-73827-311' of https://github.com/sarjona/moodle into MOODLE_311_STABLE
[moodle.git] / tag / tests / behat / flag_tags.feature
blob7eda63891ebc3e2e218458901cd571085bec5d34
1 @core @core_tag
2 Feature: Users can flag tags and manager can reset flags
3   In order to use tags
4   As a user
5   I need to be able to flag the tag as inappropriate
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email                | interests                 |
10       | manager1 | Manager   | 1        | manager1@example.com |                           |
11       | user1    | User      | 1        | user1@example.com    | Nicetag, Badtag, Sweartag |
12       | user2    | User      | 2        | user2@example.com    |                           |
13       | user3    | User      | 3        | user3@example.com    |                           |
14     And the following "system role assigns" exist:
15       | user     | course               | role    |
16       | manager1 | Acceptance test site | manager |
17     And the following "tags" exist:
18       | name         | isstandard |
19       | Neverusedtag | 1          |
20     And I log in as "admin"
21     And I set the following system permissions of "Authenticated user" role:
22       | capability                   | permission |
23       | moodle/site:viewparticipants | Allow      |
24       | moodle/user:viewdetails      | Allow      |
25     And I log out
26     And I log in as "user2"
27     And I press "Customise this page"
28     # TODO MDL-57120 site "Tags" link not accessible without navigation block.
29     And I add the "Navigation" block if not present
30     And I click on "Site pages" "list_item" in the "Navigation" "block"
31     And I click on "Tags" "link" in the "Navigation" "block"
32     And I follow "Nicetag"
33     And I follow "User 1"
34     And I follow "Badtag"
35     And I follow "Flag as inappropriate"
36     And I should see "The person responsible will be notified"
37     And I am on homepage
38     # TODO MDL-57120 site "Tags" link not accessible without navigation block.
39     And I add the "Navigation" block if not present
40     And I click on "Site pages" "list_item" in the "Navigation" "block"
41     And I click on "Tags" "link" in the "Navigation" "block"
42     And I follow "Nicetag"
43     And I follow "User 1"
44     And I follow "Sweartag"
45     And I follow "Flag as inappropriate"
46     And I should see "The person responsible will be notified"
47     And I log out
48     And I log in as "user3"
49     And I press "Customise this page"
50     # TODO MDL-57120 site "Tags" link not accessible without navigation block.
51     And I add the "Navigation" block if not present
52     And I click on "Site pages" "list_item" in the "Navigation" "block"
53     And I click on "Tags" "link" in the "Navigation" "block"
54     And I follow "Nicetag"
55     And I follow "User 1"
56     And I follow "Sweartag"
57     And I follow "Flag as inappropriate"
58     And I should see "The person responsible will be notified"
59     And I log out
61   @javascript
62   Scenario: Managing tag flags
63     When I log in as "manager1"
64     And I navigate to "Appearance > Manage tags" in site administration
65     And I follow "Default collection"
66     Then "Sweartag" "link" should appear before "Badtag" "link"
67     And "Badtag" "link" should appear before "Nicetag" "link"
68     And "(2)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
69     And "(1)" "text" should exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
70     And "(" "text" should not exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
71     And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
72     And I click on "Reset flag" "link" in the "Sweartag" "table_row"
73     And I click on "Reset flag" "link" in the "Badtag" "table_row"
74     And I wait until "//tr[contains(.,'Sweartag')]//a[contains(@title,'Flag as inappropriate')]" "xpath_element" exists
75     And I click on "Flag as inappropriate" "link" in the "Sweartag" "table_row"
76     And I click on "Flag as inappropriate" "link" in the "Nicetag" "table_row"
77     And "(1)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
78     And "(1)" "text" should exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
79     And "(" "text" should not exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
80     And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
81     And I follow "Default collection"
82     And "Nicetag" "link" should appear before "Sweartag" "link"
83     And "Sweartag" "link" should appear before "Badtag" "link"
84     And "(1)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
85     And "(1)" "text" should exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
86     And "(" "text" should not exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
87     And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
88     And I log out