ENH Replace ADMIN permissions with less permissions in Behat test

This commit is contained in:
Sabina Talipova 2022-09-06 08:44:46 +12:00
parent 2b8bee7970
commit 19e9dc4920
13 changed files with 54 additions and 39 deletions

View File

@ -5,7 +5,8 @@ Feature: Apply rich formatting to content
Background: Background:
Given a "page" "About Us" has the "Content" "<h1>My awesome headline</h1><p>Some amazing content</p>" 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" And I go to "/admin/pages"
Then I click on "About Us" in the tree Then I click on "About Us" in the tree

View File

@ -6,12 +6,12 @@ Feature: Create a page
Background: Background:
Given a "page" "MyPage" Given a "page" "MyPage"
And a "virtual page" "MyVirtualPage" And a "virtual page" "MyVirtualPage"
And a "group" "AUTHOR group" has permissions "Access to 'Pages' section" And the "group" "EDITOR" has permissions "Access to 'Pages' section"
And I am logged in with "ADMIN" permissions
@javascript @javascript
Scenario: I can create a page from the pages section 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 Then I should see "MyPage" in the tree
And I should see a "Add new" button in CMS Content Toolbar And I should see a "Add new" button in CMS Content Toolbar
When I press the "Add new" button When I press the "Add new" button
@ -21,7 +21,8 @@ Feature: Create a page
@javascript @javascript
Scenario: I can create a page under another page 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 Then I should see "MyPage" in the tree
And I should see a "Add new" button in CMS Content Toolbar And I should see a "Add new" button in CMS Content Toolbar
When I press the "Add new" button When I press the "Add new" button
@ -39,12 +40,13 @@ Feature: Create a page
Then I should see an edit page form Then I should see an edit page form
Scenario: I cannot add root level pages without permission 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 the "Access" CMS tab
And I click on the "#Form_EditForm_CanCreateTopLevelType_OnlyTheseUsers" element And I click on the "#Form_EditForm_CanCreateTopLevelType_OnlyTheseUsers" element
And I press the "Save" button And I press the "Save" button
And I click on the ".cms-login-status__logout-link" element 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 And I press the "Add new" button
Then I see the "Top level" radio button "disabled" attribute equals "1" 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" And I see the "Under another page" radio button "checked" attribute equals "1"

View File

@ -4,8 +4,9 @@ Feature: Duplicate a page
So that I can grow my website So that I can grow my website
Background: Background:
Given I am logged in with "ADMIN" permissions Given the "group" "EDITOR" has permissions "Access to 'Pages' section"
Given a "page" "Page1" 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" "Page1a" is a child of the "page" "Page1"
And the "page" "Page1b" 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" And the "page" "Page1b1" is a child of the "page" "Page1b"

View File

@ -7,7 +7,9 @@ Feature: Edit a page
Given a "page" "About Us" has the "Content" "<p>My content</p>" Given a "page" "About Us" has the "Content" "<p>My content</p>"
And a "image" "assets/file1.jpg" And a "image" "assets/file1.jpg"
#And a file "assets/file1.jpg" with changes "image"="assets/folder1/file2.jpg" and "page"="About Us" #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" And I go to "/admin/pages"
Then I should see "About Us" in the tree Then I should see "About Us" in the tree
@ -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" 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 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 When I click on "About Us" in the tree
And I click the "Settings" CMS tab And I click the "Settings" CMS tab
And I select the "Form_EditForm_CanViewType_LoggedInUsers" radio button And I select the "Form_EditForm_CanViewType_LoggedInUsers" radio button

View File

@ -8,7 +8,8 @@ So that I can link to a external website or a page on my site
Given a "page" "Home" Given a "page" "Home"
And a "page" "About Us" has the "Content" "<p>My awesome content</p>" And a "page" "About Us" has the "Content" "<p>My awesome content</p>"
And a "file" "file1.jpg" 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 go to "/admin/pages"
And I click on "About Us" in the tree And I click on "About Us" in the tree

View File

@ -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" "Home"
And a "page" "About Us" has the "Content" "<p>My awesome content</p>" 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 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 go to "/admin/pages"
And I click on "About Us" in the tree And I click on "About Us" in the tree

View File

@ -5,8 +5,8 @@ Feature: Manage page permissions
Background: Background:
Given a "page" "Home" with "Content"="<p>Welcome</p>" Given a "page" "Home" with "Content"="<p>Welcome</p>"
And a "group" "AUTHOR group" has permissions "Access to 'Pages' section" And a "group" "EDITOR" has permissions "Access to 'Pages' section"
And a "group" "SECURITY group" has permissions "Access to 'Security' section" And a "group" "SECURITY" has permissions "Access to 'Security' section"
And I am logged in with "ADMIN" permissions And I am logged in with "ADMIN" permissions
And I go to "/admin/pages" And I go to "/admin/pages"
And I click on "Home" in the tree And I click on "Home" in the tree
@ -20,42 +20,44 @@ Feature: Manage page permissions
# When I am not logged in # When I am not logged in
# And I go to the homepage # And I go to the homepage
# Then I should see "Welcome" # Then I should see "Welcome"
Scenario: I can limit page view permissions to logged-in users 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 Given I select "Logged-in users" from "Who can view this page?" input group
And I press the "Publish" button And I press the "Publish" button
When I am not logged in When I am not logged in
And I go to the homepage And I go to the homepage
Then I should see a log-in form 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 And I go to the homepage
Then I should see "Welcome" Then I should see "Welcome"
Scenario: I can limit page view permissions to certain groups 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 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 And I press the "Publish" button
When I am not logged in When I am not logged in
And I go to the homepage And I go to the homepage
Then I should see a log-in form 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 And I go to the homepage
Then I will see a "warning" log-in message Then I will see a "warning" log-in message
When I am not logged in 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 And I go to the homepage
Then I should see "Welcome" Then I should see "Welcome"
Scenario: I can limit page edit permissions to logged-in users 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 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" And pages should be editable by "ADMIN"
Scenario: I can limit page edit permissions to certain groups 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 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 select "ADMIN group" in the "#Form_EditForm_EditorGroups_Holder" tree dropdown
And I press the "Publish" button 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" But pages should be editable by "ADMIN"

View File

@ -5,10 +5,11 @@ Feature: Preview a page
Background: Background:
Given a "page" "About Us" 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 @javascript
Scenario: I can show a preview of the current page from the pages section 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" And I go to "/admin/pages"
Then I should see "About Us" in the tree Then I should see "About Us" in the tree
@ -23,7 +24,6 @@ Feature: Preview a page
# - We should continue testing against it after we have fixtures ready # - We should continue testing against it after we have fixtures ready
@javascript @javascript
Scenario: I can see an updated preview when editing content Scenario: I can see an updated preview when editing content
Given I am logged in with "ADMIN" permissions
And I go to "/admin/pages" And I go to "/admin/pages"
Then I should see "About Us" in the tree Then I should see "About Us" in the tree

View File

@ -6,6 +6,8 @@ Feature: Publish a page
Background: Background:
Given a "page" "My Page" with "URLSegment"="my-page" and "Content"="<p>initial content</p>" 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 "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 @javascript
Scenario: I can have a unpublished version of a page that is not publicly available Scenario: I can have a unpublished version of a page that is not publicly available
@ -14,8 +16,7 @@ Feature: Publish a page
@javascript @javascript
Scenario: I can publish a previously never published page Scenario: I can publish a previously never published page
Given I am logged in with "ADMIN" permissions Given I go to "/admin/pages"
And I go to "/admin/pages"
And I should see "My Page" in the tree And I should see "My Page" in the tree
And I click on "My Page" in the tree And I click on "My Page" in the tree
And I press the "Publish" button And I press the "Publish" button
@ -27,8 +28,7 @@ Feature: Publish a page
@javascript @javascript
Scenario: I will get different options depending on the current publish state of the page Scenario: I will get different options depending on the current publish state of the page
Given I am logged in with "ADMIN" permissions Given I go to "/admin/pages"
And I go to "/admin/pages"
And I should see "My Page" in the tree And I should see "My Page" in the tree
And I click on "My Page" in the tree And I click on "My Page" in the tree
@ -58,7 +58,6 @@ Feature: Publish a page
And I go to "/hello" And I go to "/hello"
Then I should see "hello world" Then I should see "hello world"
Given I am logged in with "ADMIN" permissions
And I go to "/admin/pages" And I go to "/admin/pages"
And I should see "Hello" in the tree And I should see "Hello" in the tree
And I click on "Hello" in the tree And I click on "Hello" in the tree
@ -72,8 +71,7 @@ Feature: Publish a page
@javascript @javascript
Scenario: I can delete a page from live and draft stage to completely remove it Scenario: I can delete a page from live and draft stage to completely remove it
Given I am logged in with "ADMIN" permissions Given I go to "/admin/pages"
And I go to "/admin/pages"
And I should see "My Page" in the tree And I should see "My Page" in the tree
And I click on "My Page" in the tree And I click on "My Page" in the tree
And I press the "Publish" button And I press the "Publish" button

View File

@ -8,7 +8,8 @@ Feature: Redirector Pages
Given a "page" "Page 1" Given a "page" "Page 1"
And a "page" "My Redirect" which redirects to a "page" "Page 1" And a "page" "My Redirect" which redirects to a "page" "Page 1"
And a "image" "assets/file1.jpg" 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" And I go to "/admin/pages"
Scenario: Only the appropriate fields are shown Scenario: Only the appropriate fields are shown

View File

@ -8,7 +8,8 @@ Feature: Search for a page
Given a "page" "Home" Given a "page" "Home"
And a "page" "About Us" And a "page" "About Us"
And a "page" "Contact 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 go to "/admin/pages"
And I press the "Filter" button And I press the "Filter" button

View File

@ -4,8 +4,8 @@ Feature: Sitetree
So that I can operate my website So that I can operate my website
Background: Background:
Given the "group" "EDITOR group" has permissions "CMS_ACCESS_LeftAndMain" and "SITETREE_REORGANISE" Given the "group" "EDITOR" has permissions "Access to 'Pages' section" and "SITETREE_REORGANISE"
And I am logged in with "EDITOR" permissions And I am logged in as a member of "EDITOR" group
And a "page" "One" And a "page" "One"
And a "page" "Two" And a "page" "Two"
And a "page" "Three" And a "page" "Three"

View File

@ -6,7 +6,8 @@ Feature: View Reports
Background: Background:
Given a "page" "Empty Page" Given a "page" "Empty Page"
And a "page" "Filled Page" with "Content"="<p>Some Content</p>" 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" And I go to "/admin/reports"
Scenario: I can view the "Pages with no content" report Scenario: I can view the "Pages with no content" report