From 90feafd4bb37b4887aaa3792d52aef7cbc73f3fa Mon Sep 17 00:00:00 2001 From: Sabina Talipova Date: Mon, 29 Aug 2022 13:28:23 +1200 Subject: [PATCH] ENH Run Behat test with less than ADMIN permissions --- .../add-block-element-to-data-object.feature | 3 ++- tests/Behat/features/add-block-element.feature | 3 ++- tests/Behat/features/add-link-to-anchor.feature | 3 ++- tests/Behat/features/archive-block-element.feature | 3 ++- tests/Behat/features/broken-element.feature | 3 ++- .../features/content-blocks-in-use-report.feature | 3 ++- tests/Behat/features/edit-block-element.feature | 3 ++- tests/Behat/features/element-editor.feature | 14 +++++++------- tests/Behat/features/elemental-reports.feature | 3 ++- tests/Behat/features/empty-element-list.feature | 3 ++- tests/Behat/features/preview-a-block.feature | 3 ++- tests/Behat/features/publish-block-element.feature | 3 ++- .../Behat/features/unpublish-block-element.feature | 3 ++- 13 files changed, 31 insertions(+), 19 deletions(-) diff --git a/tests/Behat/features/add-block-element-to-data-object.feature b/tests/Behat/features/add-block-element-to-data-object.feature index 17521635..34168cc2 100644 --- a/tests/Behat/features/add-block-element-to-data-object.feature +++ b/tests/Behat/features/add-block-element-to-data-object.feature @@ -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/" diff --git a/tests/Behat/features/add-block-element.feature b/tests/Behat/features/add-block-element.feature index f3e44924..af7f40b9 100644 --- a/tests/Behat/features/add-block-element.feature +++ b/tests/Behat/features/add-block-element.feature @@ -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" diff --git a/tests/Behat/features/add-link-to-anchor.feature b/tests/Behat/features/add-link-to-anchor.feature index 66ddf10e..7ec702bd 100644 --- a/tests/Behat/features/add-link-to-anchor.feature +++ b/tests/Behat/features/add-link-to-anchor.feature @@ -7,7 +7,8 @@ So that I can direct users directly to the relevant information Given a "page" "No Blocks" has the "Content" "

My awesome content

" And a "BasicElementalPage" "Elemental" with a "Anchor Test Block" content element with "

My awesomer content

" content And the "BasicElementalPage" "Elemental" has a "Same Page Anchor Block" content element with "

" 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 diff --git a/tests/Behat/features/archive-block-element.feature b/tests/Behat/features/archive-block-element.feature index 2fe0d859..ff017bd8 100644 --- a/tests/Behat/features/archive-block-element.feature +++ b/tests/Behat/features/archive-block-element.feature @@ -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" diff --git a/tests/Behat/features/broken-element.feature b/tests/Behat/features/broken-element.feature index 66352b35..676a030e 100644 --- a/tests/Behat/features/broken-element.feature +++ b/tests/Behat/features/broken-element.feature @@ -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 diff --git a/tests/Behat/features/content-blocks-in-use-report.feature b/tests/Behat/features/content-blocks-in-use-report.feature index eaeec4fe..711a8d2b 100644 --- a/tests/Behat/features/content-blocks-in-use-report.feature +++ b/tests/Behat/features/content-blocks-in-use-report.feature @@ -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" diff --git a/tests/Behat/features/edit-block-element.feature b/tests/Behat/features/edit-block-element.feature index 75ad6afa..2ef8f71d 100644 --- a/tests/Behat/features/edit-block-element.feature +++ b/tests/Behat/features/edit-block-element.feature @@ -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" diff --git a/tests/Behat/features/element-editor.feature b/tests/Behat/features/element-editor.feature index dc72b3f0..aec8c9c5 100644 --- a/tests/Behat/features/element-editor.feature +++ b/tests/Behat/features/element-editor.feature @@ -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 "" 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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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" diff --git a/tests/Behat/features/elemental-reports.feature b/tests/Behat/features/elemental-reports.feature index 49b8b291..058c72ff 100644 --- a/tests/Behat/features/elemental-reports.feature +++ b/tests/Behat/features/elemental-reports.feature @@ -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 diff --git a/tests/Behat/features/empty-element-list.feature b/tests/Behat/features/empty-element-list.feature index 0ab51229..877cd84f 100644 --- a/tests/Behat/features/empty-element-list.feature +++ b/tests/Behat/features/empty-element-list.feature @@ -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 diff --git a/tests/Behat/features/preview-a-block.feature b/tests/Behat/features/preview-a-block.feature index 43d9dcba..25c5e4a9 100644 --- a/tests/Behat/features/preview-a-block.feature +++ b/tests/Behat/features/preview-a-block.feature @@ -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" diff --git a/tests/Behat/features/publish-block-element.feature b/tests/Behat/features/publish-block-element.feature index ecc3463d..3f19a118 100644 --- a/tests/Behat/features/publish-block-element.feature +++ b/tests/Behat/features/publish-block-element.feature @@ -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" diff --git a/tests/Behat/features/unpublish-block-element.feature b/tests/Behat/features/unpublish-block-element.feature index e0aeea41..b2163d46 100644 --- a/tests/Behat/features/unpublish-block-element.feature +++ b/tests/Behat/features/unpublish-block-element.feature @@ -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"