11758beffb4348b334fb3836b8c743b0359f1b92
[moodle.git] / tag / tests / behat / flag_tags.feature
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 "Participants" link not accessible without navigation block.
29     And I add the "Navigation" block if not present
30     And I navigate to "Participants" node in "Site pages"
31     And I follow "User 1"
32     And I follow "Badtag"
33     And I follow "Flag as inappropriate"
34     And I should see "The person responsible will be notified"
35     And I am on homepage
36     And I navigate to "Participants" node in "Site pages"
37     And I follow "User 1"
38     And I follow "Sweartag"
39     And I follow "Flag as inappropriate"
40     And I should see "The person responsible will be notified"
41     And I log out
42     And I log in as "user3"
43     And I press "Customise this page"
44     # TODO MDL-57120 site "Participants" link not accessible without navigation block.
45     And I add the "Navigation" block if not present
46     And I navigate to "Participants" node in "Site pages"
47     And I follow "User 1"
48     And I follow "Sweartag"
49     And I follow "Flag as inappropriate"
50     And I should see "The person responsible will be notified"
51     And I log out
53   @javascript
54   Scenario: Managing tag flags
55     When I log in as "manager1"
56     And I navigate to "Manage tags" node in "Site administration > Appearance"
57     And I follow "Default collection"
58     Then "Sweartag" "link" should appear before "Badtag" "link"
59     And "Badtag" "link" should appear before "Nicetag" "link"
60     And "(2)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
61     And "(1)" "text" should exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
62     And "(" "text" should not exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
63     And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
64     And I click on "Reset flag" "link" in the "Sweartag" "table_row"
65     And I click on "Reset flag" "link" in the "Badtag" "table_row"
66     And I wait until "//tr[contains(.,'Sweartag')]//a[contains(@title,'Flag as inappropriate')]" "xpath_element" exists
67     And I click on "Flag as inappropriate" "link" in the "Sweartag" "table_row"
68     And I click on "Flag as inappropriate" "link" in the "Nicetag" "table_row"
69     And "(1)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
70     And "(1)" "text" should exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
71     And "(" "text" should not exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
72     And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
73     And I follow "Default collection"
74     And "Nicetag" "link" should appear before "Sweartag" "link"
75     And "Sweartag" "link" should appear before "Badtag" "link"
76     And "(1)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
77     And "(1)" "text" should exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
78     And "(" "text" should not exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
79     And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
80     And I log out