MDL-59437 behat: avoid using participants page for tag tests
[moodle.git] / tag / tests / behat / flag_tags.feature
CommitLineData
8e355853
MG
1@core @core_tag
2Feature: 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
6
7 Background:
8 Given the following "users" exist:
810805da
MG
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 | |
8e355853
MG
14 And the following "system role assigns" exist:
15 | user | course | role |
16 | manager1 | Acceptance test site | manager |
17 And the following "tags" exist:
e11d7380
MG
18 | name | isstandard |
19 | Neverusedtag | 1 |
810805da
MG
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 |
8e355853
MG
25 And I log out
26 And I log in as "user2"
7a12a02d 27 And I press "Customise this page"
d131489e 28 # TODO MDL-57120 site "Tags" link not accessible without navigation block.
7a12a02d 29 And I add the "Navigation" block if not present
d131489e
EL
30 And I navigate to "Tags" node in "Site pages"
31 And I follow "Nicetag"
810805da 32 And I follow "User 1"
8e355853
MG
33 And I follow "Badtag"
34 And I follow "Flag as inappropriate"
35 And I should see "The person responsible will be notified"
7a12a02d 36 And I am on homepage
d131489e
EL
37 And I navigate to "Tags" node in "Site pages"
38 And I follow "Nicetag"
810805da 39 And I follow "User 1"
8e355853
MG
40 And I follow "Sweartag"
41 And I follow "Flag as inappropriate"
42 And I should see "The person responsible will be notified"
8e355853
MG
43 And I log out
44 And I log in as "user3"
7a12a02d 45 And I press "Customise this page"
d131489e 46 # TODO MDL-57120 site "Tags" link not accessible without navigation block.
7a12a02d 47 And I add the "Navigation" block if not present
d131489e
EL
48 And I navigate to "Tags" node in "Site pages"
49 And I follow "Nicetag"
810805da 50 And I follow "User 1"
8e355853
MG
51 And I follow "Sweartag"
52 And I follow "Flag as inappropriate"
53 And I should see "The person responsible will be notified"
8e355853
MG
54 And I log out
55
8e355853 56 @javascript
21d9596c 57 Scenario: Managing tag flags
8e355853
MG
58 When I log in as "manager1"
59 And I navigate to "Manage tags" node in "Site administration > Appearance"
c026a28d 60 And I follow "Default collection"
8e355853
MG
61 Then "Sweartag" "link" should appear before "Badtag" "link"
62 And "Badtag" "link" should appear before "Nicetag" "link"
63 And "(2)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
64 And "(1)" "text" should exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
65 And "(" "text" should not exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
66 And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
67 And I click on "Reset flag" "link" in the "Sweartag" "table_row"
68 And I click on "Reset flag" "link" in the "Badtag" "table_row"
69 And I wait until "//tr[contains(.,'Sweartag')]//a[contains(@title,'Flag as inappropriate')]" "xpath_element" exists
70 And I click on "Flag as inappropriate" "link" in the "Sweartag" "table_row"
71 And I click on "Flag as inappropriate" "link" in the "Nicetag" "table_row"
72 And "(1)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
73 And "(1)" "text" should exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
74 And "(" "text" should not exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
75 And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
c026a28d 76 And I follow "Default collection"
8e355853
MG
77 And "Nicetag" "link" should appear before "Sweartag" "link"
78 And "Sweartag" "link" should appear before "Badtag" "link"
79 And "(1)" "text" should exist in the "//tr[contains(.,'Sweartag')]//td[contains(@class,'col-flag')]" "xpath_element"
80 And "(1)" "text" should exist in the "//tr[contains(.,'Nicetag')]//td[contains(@class,'col-flag')]" "xpath_element"
81 And "(" "text" should not exist in the "//tr[contains(.,'Badtag')]//td[contains(@class,'col-flag')]" "xpath_element"
82 And "(" "text" should not exist in the "//tr[contains(.,'Neverusedtag')]//td[contains(@class,'col-flag')]" "xpath_element"
83 And I log out