Security update for permissions_by_term
[yaffs-website] / web / modules / contrib / permissions_by_term / tests / src / Behat / Features / entityMetaInfo.feature
1 @api @drupal
2 Feature: Entity Meta Info
3   Several automated tests for the Permissions by Term Drupal 8 module.
4
5   Background:
6     Given users:
7       | name          | mail               | pass     |
8       | Joe           | joe@example.com    | password |
9       | George        | george@example.com | password |
10       | Andy          | andy@example.com   | password |
11       | Tom           | tom@example.com    | password |
12     Given restricted "tags" terms:
13       | name          | access_user   | access_role                             |
14       | Tag one       |               | administrator                           |
15       | Tag two       |               | authenticated                           |
16       | Tag three     |               |                                         |
17       | Tag admin     | admin         |                                         |
18       | Tag anonymous |               | anonymous, administrator, authenticated |
19     Given I create vocabulary with name "tags2" and vid "tags2"
20     Given I create vocabulary with name "tags3" and vid "tags3"
21     Given restricted "tags2" terms:
22       | name              | access_user | access_role                           |
23       | Tag administrator | Joe, George | administrator                         |
24       | Tag authenticated | Andy        | authenticated                         |
25     Given restricted "tags3" terms:
26       | name          | access_user   | access_role                             |
27       | Tag tom       | Tom           | administrator                           |
28     Given article content:
29       | title                          | author     | status | created           | field_tags    | alias                 |
30       | Only admin can access          | Admin      | 1      | 2014-10-17 8:00am | Tag one       | only-admin-can-access |
31       | Everybody can access           | Admin      | 1      | 2014-10-17 8:00am |               | no-term               |
32       | Term accessible                | Admin      | 1      | 2014-10-17 8:00am | Tag three     | term-no-restriction   |
33       | Unpublished node               | Admin      | 0      | 2014-10-17 8:00am |               | unpublished           |
34       | Only admin user can edit       | Admin      | 0      | 2014-10-17 8:00am | Tag admin     | unpublished           |
35       | Authenticated user can access  | Admin      | 0      | 2014-10-17 8:00am | Tag two       | unpublished           |
36       | Anonymous user can access      | Admin      | 1      | 2014-10-17 8:00am | Tag anonymous | anonymous             |
37     Given Node access records are rebuild.
38
39 #@TODO: Test needs to be fixed. Implement a method, which waits for HTML tags. Field ids has changed. Do not rely on fixed id's with numeric suffix.
40 #  Scenario: Users see permissions tab in node edit form
41 #    Given I am on "/"
42 #    Given I am logged in as a user with the "administrator" role
43 #    Then I am on "/admin/structure/types/manage/article/fields/add-field"
44 #    And I select index 15 in dropdown named "new_storage_type"
45 #    And I press "edit-submit"
46 #    Then I fill in "edit-label" with "Tags2"
47 #    Then I fill in "edit-field-name" with "tags2"
48 #    And I press "edit-submit"
49 #    And I select index 1 in dropdown named "cardinality"
50 #    And I press "edit-submit"
51 #    Then I scroll to element with id "edit-submit"
52 #    And I check checkbox with id "edit-settings-handler-settings-target-bundles-tags2" by JavaScript
53 #    And I press "edit-submit"
54 #    Then I am on "/admin/structure/types/manage/article/fields/add-field"
55 #    And I select index 15 in dropdown named "new_storage_type"
56 #    And I press "edit-submit"
57 #    Then I fill in "edit-label" with "Tags3"
58 #    Then I fill in "edit-field-name" with "tags3"
59 #    And I press "edit-submit"
60 #    And I select index 1 in dropdown named "cardinality"
61 #    And I press "edit-submit"
62 #    And I check checkbox with id "edit-settings-handler-settings-target-bundles-tags3" by JavaScript
63 #    And I scroll to element with id "edit-submit"
64 #    And I press "edit-submit"
65 #    Then I am on "/admin/structure/types/manage/article/form-display"
66 #    And I scroll to element with id "edit-submit"
67 #    And I select index 0 in dropdown named "fields[field_tags2][type]"
68 #    And I select index 3 in dropdown named "fields[field_tags3][type]"
69 #    And I press "edit-submit"
70 #    Then I am on "/admin/content"
71 #    And I scroll to element with id "edit-submit"
72 #    And I click "Only admin can access"
73 #    And I click "Edit"
74 #    Then I should see "Permissions by Term" in the "#edit-advanced" element
75 #    And I open open Permissions By Term advanced info
76 #    And I should see "Administrator" in the "#edit-permissions-by-term-info" element
77 #    And I should see "Allowed Users: No user restrictions." in the "#edit-permissions-by-term-info" element
78 #    And I scroll to element with id "edit-field-tags2"
79 #    And I check checkbox with id "edit-field-tags2"
80 #    And I uncheck checkbox with id "edit-field-tags2"
81 #    And I scroll to element with id "edit-permissions-by-term-info"
82 #    Then I should see "Allowed roles: Administrator" in the "#edit-permissions-by-term-info" element
83 #    Then I fill in "edit-field-tags-target-id" with "Tag one (5), Tag two (6)"
84 #    And I should see "Allowed users: Joe, George" in the "#edit-permissions-by-term-info" element
85 #    Then I select "Tag tom" in "edit-field-tags3"
86 #    And I should see "Allowed users: Joe, George, Tom" in the "#edit-permissions-by-term-info" element
87
88 #@TODO: Test needs to be fixed. Implement a method, which waits for HTML tags.
89 #  Scenario: Users see permissions tab in node add form
90 #    Given I am on "/"
91 #    Given I am logged in as a user with the "administrator" role
92 #    Then I am on "/node/add/article"
93 #    And I open open Permissions By Term advanced info
94 #    And I should see "Allowed users: No user restrictions." in the "#edit-permissions-by-term-info" element
95 #    And I should see "Allowed roles: No role restrictions." in the "#edit-permissions-by-term-info" element
96 #    Then I select "Tag tom" in "edit-field-tags3"
97 #    And I should see "Allowed users: Tom" in the "#edit-permissions-by-term-info" element
98 #    Then I check checkbox with id "edit-field-tags2-14"
99 #    And I should see "Allowed users: Tom, Joe, George" in the "#edit-permissions-by-term-info" element
100 #    And I should see "Allowed roles: Administrator" in the "#edit-permissions-by-term-info" element
101 #    Then I uncheck checkbox with id "edit-field-tags2-14"
102 #    And I should see "Allowed users: Tom" in the "#edit-permissions-by-term-info" element