Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Replace ADMIN permissions with less permissions in Behat test #2777

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/behat/features/apply-formatting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Feature: Apply rich formatting to content

Background:
Given a "page" "About Us" has the "Content" "<h1>My awesome headline</h1><p>Some amazing content</p>"
And I am logged in with "ADMIN" permissions
Given the "group" "EDITOR" has permissions "Access to 'Pages' section"
And I am logged in as a member of "EDITOR" group
And I go to "/admin/pages"
Then I click on "About Us" in the tree

Expand Down
14 changes: 8 additions & 6 deletions tests/behat/features/create-a-page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Feature: Create a page
Background:
Given a "page" "MyPage"
And a "virtual page" "MyVirtualPage"
And a "group" "AUTHOR group" has permissions "Access to 'Pages' section"
And I am logged in with "ADMIN" permissions
And the "group" "EDITOR" has permissions "Access to 'Pages' section"

@javascript
Scenario: I can create a page from the pages section
When I go to "/admin/pages"
When I am logged in as a member of "EDITOR" group
And I go to "/admin/pages"
Then I should see "MyPage" in the tree
And I should see a "Add new" button in CMS Content Toolbar
When I press the "Add new" button
Expand All @@ -21,7 +21,8 @@ Feature: Create a page

@javascript
Scenario: I can create a page under another page
When I go to "/admin/pages"
When I am logged in as a member of "EDITOR" group
And I go to "/admin/pages"
Then I should see "MyPage" in the tree
And I should see a "Add new" button in CMS Content Toolbar
When I press the "Add new" button
Expand All @@ -39,12 +40,13 @@ Feature: Create a page
Then I should see an edit page form

Scenario: I cannot add root level pages without permission
When I go to "/admin/settings"
When I am logged in with "ADMIN" permissions
And I go to "/admin/settings"
And I click the "Access" CMS tab
And I click on the "#Form_EditForm_CanCreateTopLevelType_OnlyTheseUsers" element
And I press the "Save" button
And I click on the ".cms-login-status__logout-link" element
When I am logged in with "AUTHOR" permissions
When I am logged in as a member of "EDITOR" group
And I press the "Add new" button
Then I see the "Top level" radio button "disabled" attribute equals "1"
And I see the "Under another page" radio button "checked" attribute equals "1"
5 changes: 3 additions & 2 deletions tests/behat/features/duplicate-a-page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Feature: Duplicate a page
So that I can grow my website

Background:
Given I am logged in with "ADMIN" permissions
Given a "page" "Page1"
Given the "group" "EDITOR" has permissions "Access to 'Pages' section"
And I am logged in as a member of "EDITOR" group
And a "page" "Page1"
And the "page" "Page1a" is a child of the "page" "Page1"
And the "page" "Page1b" is a child of the "page" "Page1"
And the "page" "Page1b1" is a child of the "page" "Page1b"
Expand Down
8 changes: 7 additions & 1 deletion tests/behat/features/edit-a-page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Feature: Edit a page
Given a "page" "About Us" has the "Content" "<p>My content</p>"
And a "image" "assets/file1.jpg"
#And a file "assets/file1.jpg" with changes "image"="assets/folder1/file2.jpg" and "page"="About Us"
And I am logged in with "ADMIN" permissions
And the "group" "AUTHOR" has permissions "Access to 'Pages' section"
And the "group" "EDITOR" has permissions "Access to 'Pages' section" and "SITETREE_GRANT_ACCESS"
And I am logged in as a member of "AUTHOR" group
And I go to "/admin/pages"
Then I should see "About Us" in the tree

Expand Down Expand Up @@ -115,6 +117,10 @@ Feature: Edit a page
Then I should see "Please choose a linked page in the main content fields in order to publish"

Scenario: Change permission levels for who can view and edit the page, at an individual page level
Given I am not logged in
And I am logged in as a member of "EDITOR" group
And I go to "/admin/pages"
Then I should see "About Us" in the tree
When I click on "About Us" in the tree
And I click the "Settings" CMS tab
And I select the "Form_EditForm_CanViewType_LoggedInUsers" radio button
Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/insert-a-link.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ So that I can link to a external website or a page on my site
Given a "page" "Home"
And a "page" "About Us" has the "Content" "<p>My awesome content</p>"
And a "file" "file1.jpg"
And I am logged in with "ADMIN" permissions
And the "group" "EDITOR" has permissions "Access to 'Pages' section"
And I am logged in as a member of "EDITOR" group
And I go to "/admin/pages"
And I click on "About Us" in the tree

Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/insert-anchor-link.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ So that I can link to a external website or a page on my site
And a "page" "Home"
And a "page" "About Us" has the "Content" "<p>My awesome content</p>"
And a "page" "Details" has the "Content" "<p>My sub-par content<a name="youranchor"></a></p>"
And I am logged in with "ADMIN" permissions
And the "group" "EDITOR" has permissions "Access to 'Pages' section"
And I am logged in as a member of "EDITOR" group
And I go to "/admin/pages"
And I click on "About Us" in the tree

Expand Down
28 changes: 15 additions & 13 deletions tests/behat/features/manage-page-permissions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Feature: Manage page permissions

Background:
Given a "page" "Home" with "Content"="<p>Welcome</p>"
And a "group" "AUTHOR group" has permissions "Access to 'Pages' section"
And a "group" "SECURITY group" has permissions "Access to 'Security' section"
And a "group" "EDITOR" has permissions "Access to 'Pages' section"
And a "group" "SECURITY" has permissions "Access to 'Security' section"
And I am logged in with "ADMIN" permissions
And I go to "/admin/pages"
And I click on "Home" in the tree
Expand All @@ -20,42 +20,44 @@ Feature: Manage page permissions
# When I am not logged in
# And I go to the homepage
# Then I should see "Welcome"

Scenario: I can limit page view permissions to logged-in users
Given I select "Logged-in users" from "Who can view this page?" input group
And I press the "Publish" button
When I am not logged in
And I go to the homepage
Then I should see a log-in form
When I am logged in with "AUTHOR" permissions
When I am logged in as a member of "EDITOR" group
And I go to the homepage
Then I should see "Welcome"

Scenario: I can limit page view permissions to certain groups
Given I select "Only these groups (choose from list)" from "Who can view this page?" input group
And I select "AUTHOR group" in the "#Form_EditForm_ViewerGroups_Holder" tree dropdown
And I select "EDITOR" in the "#Form_EditForm_ViewerGroups_Holder" tree dropdown
And I press the "Publish" button
When I am not logged in
And I go to the homepage
Then I should see a log-in form
When I am logged in with "SECURITY" permissions
When I am logged in as a member of "SECURITY" group
And I go to the homepage
Then I will see a "warning" log-in message
When I am not logged in
And I am logged in with "AUTHOR" permissions
And I am logged in as a member of "EDITOR" group
And I go to the homepage
Then I should see "Welcome"

Scenario: I can limit page edit permissions to logged-in users
Given I select "Logged-in users" from "Who can edit this page?" input group
Given I am not logged in
And I am logged in as a member of "EDITOR" group
And I go to "/admin/pages"
And I click on "Home" in the tree
Then I should see an edit page form
And I click the "Settings" CMS tab
And I select "Logged-in users" from "Who can edit this page?" input group
And I press the "Publish" button
Then pages should be editable by "AUTHOR"
Then pages should be editable by "EDITOR"
And pages should be editable by "ADMIN"

Scenario: I can limit page edit permissions to certain groups
Given I select "Only these groups (choose from list)" from "Who can edit this page?" input group
And I select "ADMIN group" in the "#Form_EditForm_EditorGroups_Holder" tree dropdown
And I press the "Publish" button
Then pages should not be editable by "AUTHOR"
Then pages should not be editable by "EDITOR"
But pages should be editable by "ADMIN"

4 changes: 2 additions & 2 deletions tests/behat/features/preview-a-page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ Feature: Preview a page

Background:
Given a "page" "About Us"
And the "group" "EDITOR" has permissions "Access to 'Pages' section"
And I am logged in as a member of "EDITOR" group

@javascript
Scenario: I can show a preview of the current page from the pages section
Given I am logged in with "ADMIN" permissions
And I go to "/admin/pages"
Then I should see "About Us" in the tree

Expand All @@ -23,7 +24,6 @@ Feature: Preview a page
# - We should continue testing against it after we have fixtures ready
@javascript
Scenario: I can see an updated preview when editing content
Given I am logged in with "ADMIN" permissions
And I go to "/admin/pages"
Then I should see "About Us" in the tree

Expand Down
12 changes: 5 additions & 7 deletions tests/behat/features/publish-a-page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Feature: Publish a page
Background:
Given a "page" "My Page" with "URLSegment"="my-page" and "Content"="<p>initial content</p>"
And the "page" "My Page" is not published
And the "group" "EDITOR" has permissions "Access to 'Pages' section"
And I am logged in as a member of "EDITOR" group

@javascript
Scenario: I can have a unpublished version of a page that is not publicly available
Expand All @@ -14,8 +16,7 @@ Feature: Publish a page

@javascript
Scenario: I can publish a previously never published page
Given I am logged in with "ADMIN" permissions
And I go to "/admin/pages"
Given I go to "/admin/pages"
And I should see "My Page" in the tree
And I click on "My Page" in the tree
And I press the "Publish" button
Expand All @@ -27,8 +28,7 @@ Feature: Publish a page

@javascript
Scenario: I will get different options depending on the current publish state of the page
Given I am logged in with "ADMIN" permissions
And I go to "/admin/pages"
Given I go to "/admin/pages"
And I should see "My Page" in the tree
And I click on "My Page" in the tree

Expand Down Expand Up @@ -58,7 +58,6 @@ Feature: Publish a page
And I go to "/hello"
Then I should see "hello world"

Given I am logged in with "ADMIN" permissions
And I go to "/admin/pages"
And I should see "Hello" in the tree
And I click on "Hello" in the tree
Expand All @@ -72,8 +71,7 @@ Feature: Publish a page

@javascript
Scenario: I can delete a page from live and draft stage to completely remove it
Given I am logged in with "ADMIN" permissions
And I go to "/admin/pages"
Given I go to "/admin/pages"
And I should see "My Page" in the tree
And I click on "My Page" in the tree
And I press the "Publish" button
Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/redirector-page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Feature: Redirector Pages
Given a "page" "Page 1"
And a "page" "My Redirect" which redirects to a "page" "Page 1"
And a "image" "assets/file1.jpg"
And I am logged in with "ADMIN" permissions
And the "group" "EDITOR" has permissions "Access to 'Pages' section"
And I am logged in as a member of "EDITOR" group
And I go to "/admin/pages"

Scenario: Only the appropriate fields are shown
Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/search-for-a-page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Feature: Search for a page
Given a "page" "Home"
And a "page" "About Us"
And a "page" "Contact Us"
And I am logged in with "ADMIN" permissions
And the "group" "EDITOR" has permissions "Access to 'Pages' section"
And I am logged in as a member of "EDITOR" group
And I go to "/admin/pages"
And I press the "Filter" button

Expand Down
4 changes: 2 additions & 2 deletions tests/behat/features/sitetree.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Feature: Sitetree
So that I can operate my website

Background:
Given the "group" "EDITOR group" has permissions "CMS_ACCESS_LeftAndMain" and "SITETREE_REORGANISE"
And I am logged in with "EDITOR" permissions
Given the "group" "EDITOR" has permissions "Access to 'Pages' section" and "SITETREE_REORGANISE"
And I am logged in as a member of "EDITOR" group
And a "page" "One"
And a "page" "Two"
And a "page" "Three"
Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/view-reports.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Feature: View Reports
Background:
Given a "page" "Empty Page"
And a "page" "Filled Page" with "Content"="<p>Some Content</p>"
And I am logged in with "ADMIN" permissions
And the "group" "EDITOR" has permissions "Access to 'Pages' section" and "Access to 'Reports' section"
And I am logged in as a member of "EDITOR" group
And I go to "/admin/reports"

Scenario: I can view the "Pages with no content" report
Expand Down