Skip to content

Commit

Permalink
ENH Run Behat test with less than ADMIN permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabina Talipova committed Sep 6, 2022
1 parent 97a3702 commit 90feafd
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Feature: Add elements in the CMS DataObject
So that I can use multiple elements in a Dataobject

Background:
Given I am logged in with "ADMIN" permissions
Given the "group" "EDITOR" has permissions "CMS_ACCESS_CMSMain"
And I am logged in as a member of "EDITOR" group

Scenario: I can add inline-editable elements to the DataObject
When I go to "/admin/elemental-behat-test-admin/"
Expand Down
3 changes: 2 additions & 1 deletion tests/Behat/features/add-block-element.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Feature: Add elements in the CMS
And a "page" "Blocks Page" with a "Alice's Block" content element with "Some content" content
And the "page" "Blocks Page" has a "Bob's Block" content element with "Some content II" content

Given 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
# Remove with 'And I click "Blocks Page" in the ".breadcrumbs-wrapper" element' once the ElementalArea refreshes,
# See https://github.com/dnadesign/silverstripe-elemental/issues/320
And I go to "/admin/pages"
Expand Down
3 changes: 2 additions & 1 deletion tests/Behat/features/add-link-to-anchor.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ So that I can direct users directly to the relevant information
Given a "page" "No Blocks" has the "Content" "<p>My awesome content<a name="normal-anchor"></a></p>"
And a "BasicElementalPage" "Elemental" with a "Anchor Test Block" content element with "<p>My awesomer content<a name="element-anchor"></a></p>" content
And the "BasicElementalPage" "Elemental" has a "Same Page Anchor Block" content element with "<p><a id="another-anchor"></a></p>" content
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: I can link to anchors in an elemental block from a normal page
Expand Down
3 changes: 2 additions & 1 deletion tests/Behat/features/archive-block-element.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Feature: Archive elements in the CMS
And a "page" "Blocks Page" with a "Alice's Block" content element with "Some content" content
And the "page" "Blocks Page" has a "Bob's Block" content element with "Some content II" content

Given 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
# Remove with 'And I click "Blocks Page" in the ".breadcrumbs-wrapper" element' once the ElementalArea refreshes,
# See https://github.com/dnadesign/silverstripe-elemental/issues/320
And I go to "/admin/pages"
Expand Down
3 changes: 2 additions & 1 deletion tests/Behat/features/broken-element.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Feature: Broken element in CMS
And the "page" "Blocks Page" has a broken element named "This one is broken"
And the "page" "Blocks Page" has a "Bob's Block" content element with "Some content II" content

Given 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 left click on "Blocks Page" in the tree
When I see a list of blocks
Expand Down
3 changes: 2 additions & 1 deletion tests/Behat/features/content-blocks-in-use-report.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Feature: View the report for content blocks in use
Given I add an extension "DNADesign\Elemental\Extensions\ElementalPageExtension" to the "Page" class
And a "page" "Blocks Page" with a "Alice's Block" content element with "Some content" content

And I am logged in with "ADMIN" permissions
And the "group" "EDITOR" has permissions "Access to 'Reports' section" and "Access to 'Pages' section"
And I am logged in as a member of "EDITOR" group
And I go to "/admin/reports"
Then I should see "Content blocks in use"

Expand Down
3 changes: 2 additions & 1 deletion tests/Behat/features/edit-block-element.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Feature: Edit elements in the CMS
And a "page" "Blocks Page" with a "Alice's Block" content element with "Some content" content
And the "page" "Blocks Page" has a "Bob's Block" content element with "Some content II" content

Given 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
# Remove with 'And I click "Blocks Page" in the ".breadcrumbs-wrapper" element' once the ElementalArea refreshes,
# See https://github.com/dnadesign/silverstripe-elemental/issues/312
And I go to "/admin/pages"
Expand Down
14 changes: 7 additions & 7 deletions tests/Behat/features/element-editor.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Feature: View types of elements in an area on a page

Background:
Given I add an extension "DNADesign\Elemental\Extensions\ElementalPageExtension" to the "Page" class
And a "group" "AUTHOR group" has permissions "Access to 'Pages' section"
And a "group" "AUTHOR" has permissions "Access to 'Pages' section"
And a "page" "Blocks Page" with a "Alice's Block" content element with "Some content" content
And the "page" "Blocks Page" has a "Bob's Block" content element with "Some content II" content

Scenario Outline: I can see the title and summary of each element
Given I am logged in with "<group>" permissions
Given I am logged in as a member of "AUTHOR" group
When I go to "/admin/pages"
And I left click on "Blocks Page" in the tree
Then I should see a list of blocks
Expand All @@ -26,7 +26,7 @@ Feature: View types of elements in an area on a page
| AUTHOR |

Scenario: Opening the "more actions" menu will not expand a block
Given I am logged in with "ADMIN" permissions
Given I am logged in as a member of "AUTHOR" group
When I go to "/admin/pages"
And I left click on "Blocks Page" in the tree
Then I should see a list of blocks
Expand All @@ -35,7 +35,7 @@ Feature: View types of elements in an area on a page
Then I should not see "Title"

Scenario: I can see the block type when I hover over an element's icon
Given I am logged in with "ADMIN" permissions
Given I am logged in as a member of "AUTHOR" group
When I go to "/admin/pages"
And I left click on "Blocks Page" in the tree

Expand All @@ -45,7 +45,7 @@ Feature: View types of elements in an area on a page

@unsavedChanges
Scenario: I can preview a block and hide the form again
Given I am logged in with "ADMIN" permissions
Given I am logged in as a member of "AUTHOR" group
When I go to "/admin/pages"
And I left click on "Blocks Page" in the tree
When I see a list of blocks
Expand All @@ -69,7 +69,7 @@ Feature: View types of elements in an area on a page
Scenario: I can operate blocks with a mouse
Given a "virtual page" "Virtual Page"

Given I am logged in with "ADMIN" permissions
Given I am logged in as a member of "AUTHOR" group
When I go to "/admin/pages"

# Content blocks are not applied to other page types
Expand Down Expand Up @@ -111,7 +111,7 @@ Feature: View types of elements in an area on a page

@unsavedChanges
Scenario: I can operate blocks with a keyboard
Given I am logged in with "ADMIN" permissions
Given I am logged in as a member of "AUTHOR" group
When I go to "/admin/pages"
And I follow "Blocks Page"

Expand Down
3 changes: 2 additions & 1 deletion tests/Behat/features/elemental-reports.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Feature: View types of elements in a report
And a "page" "My page" with a "My block" content element with "Some content" content

Scenario: I can view the types of elements used
Given I am logged in with "ADMIN" permissions
Given 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"

# View content blocks in use
Expand Down
3 changes: 2 additions & 1 deletion tests/Behat/features/empty-element-list.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Feature: View an elemental area with no blocks on a page
Given I add an extension "DNADesign\Elemental\Extensions\ElementalPageExtension" to the "Page" class
And a "page" "Blocks Page"

Given 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 left click on "Blocks Page" in the tree

Expand Down
3 changes: 2 additions & 1 deletion tests/Behat/features/preview-a-block.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Feature: Preview a non-inline-editable block
And content blocks are not in-line editable
And a "page" "Preview Blocks Page" with a "Alice's Block" content element with "Alice's content" content

Given 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 left click on "Preview Blocks Page" in the tree
And I set the CMS mode to "Edit mode"
Expand Down
3 changes: 2 additions & 1 deletion tests/Behat/features/publish-block-element.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Feature: Publish elements in the CMS
And a "page" "Blocks Page" with a "Block A" content element with "Some content" content
And the "page" "Blocks Page" has a "Block B" content element with "Some content II" content

Given 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
# Remove with 'And I click "Blocks Page" in the ".breadcrumbs-wrapper" element' once the ElementalArea refreshes,
# See https://github.com/dnadesign/silverstripe-elemental/issues/320
And I go to "/admin/pages"
Expand Down
3 changes: 2 additions & 1 deletion tests/Behat/features/unpublish-block-element.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Feature: Unpublish elements in the CMS
And a "page" "Blocks Page" with a "Block A" content element with "Some content" content
And the "page" "Blocks Page" has a "Block B" content element with "Some content II" content

Given 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
# Remove with 'And I click "Blocks Page" in the ".breadcrumbs-wrapper" element' once the ElementalArea refreshes,
# See https://github.com/dnadesign/silverstripe-elemental/issues/320
And I go to "/admin/pages"
Expand Down

0 comments on commit 90feafd

Please sign in to comment.