Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / permissions_by_term / tests / src / Behat / Features / access.feature
1 @api @drupal
2 Feature: Access
3   Several automated tests for the Permissions by Term Drupal 8 module.
4
5   Background:
6     Given restricted "tags" terms:
7       | name          | access_user   | access_role                             |
8       | Tag one       |               | administrator                           |
9       | Tag two       |               | authenticated                           |
10       | Tag three     |               |                                         |
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             |
23     Given users:
24       | name          | mail            | pass     |
25       | Joe           | joe@example.com | password |
26     Given Node access records are rebuild.
27
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"
31
32   Scenario: Anonymous users can see allowed node with term with multiple user role relation in view
33     Given I am on "/"
34     And the cache has been cleared
35     Then I should see text matching "Anonymous user can access"
36
37   Scenario: Users access nodes by view
38     Given I am logged in as a user with the "administrator" role
39     Then I am on "/"
40     And I should see text matching "Only admin can access"
41     Given I am logged in as "Joe"
42     Then I am on "/"
43     And I should not see text matching "Only admin can access"
44
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"
49     Then I click "Edit"
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"
54     Then I am on "/"
55     And I should not see the text "Node with tag without perm"
56
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"
60     And I click "Edit"
61     Then I should not see the text "The website encountered an unexpected error. Please try again later."