3 Several automated tests for the Permissions by Term Drupal 8 module.
6 Given restricted "tags" terms:
7 | name | access_user | access_role |
8 | Tag one | | administrator |
9 | Tag two | | authenticated |
11 | Tag admin | admin | |
12 | Tag anonymous | | anonymous, administrator, authenticated |
13 Given article content:
14 | title | author | status | created | field_tags | alias |
15 | Only admin can access | Admin | 1 | 2014-10-17 8:00am | Tag one | only-admin-can-access |
16 | Everybody can access | Admin | 1 | 2014-10-17 8:00am | | no-term |
17 | Term accessible | Admin | 1 | 2014-10-17 8:00am | Tag three | term-no-restriction |
18 | Unpublished node | Admin | 0 | 2014-10-17 8:00am | | unpublished |
19 | Only admin user can edit | Admin | 0 | 2014-10-17 8:00am | Tag admin | unpublished |
20 | Authenticated user can access | Admin | 0 | 2014-10-17 8:00am | Tag two | unpublished |
21 | Anonymous user can access | Admin | 1 | 2014-10-17 8:00am | Tag anonymous | anonymous |
22 | Node with tag without perm | Admin | 1 | 2014-10-17 8:00am | Tag three | anonymous |
24 | name | mail | pass |
25 | Joe | joe@example.com | password |
26 Given Node access records are rebuild.
28 Scenario: Anonymous users cannot see restricted node
29 Given I open node view by node title "Authenticated user can access"
30 Then I should see text matching "Access denied"
32 Scenario: Anonymous users can see allowed node with term with multiple user role relation in view
34 And the cache has been cleared
35 Then I should see text matching "Anonymous user can access"
37 Scenario: Users access nodes by view
38 Given I am logged in as a user with the "administrator" role
40 And I should see text matching "Only admin can access"
41 Given I am logged in as "Joe"
43 And I should not see text matching "Only admin can access"
45 Scenario: Users cannot visit node after term permission is being added to a term without permissions
46 Given I am logged in as a user with the "administrator" role
47 Then I open node view by node title "Node with tag without perm"
48 And I click "Tag three"
50 And I click by selector "#fieldset_term_access summary" via JavaScript
51 And I check checkbox with id "edit-access-role-administrator"
52 Then I click by selector "#edit-submit" via JavaScript
53 And I am on "/user/logout"
55 And I should not see the text "Node with tag without perm"
57 Scenario: I do not see any error or warning when I want to edit an node
58 Given I am logged in as a user with the "administrator" role
59 Then I open node view by node title "Node with tag without perm"
61 Then I should not see the text "The website encountered an unexpected error. Please try again later."