From a2c3dc489d20a712f21ad340794d3a8b0eeeda8f Mon Sep 17 00:00:00 2001 From: Sabina Talipova Date: Wed, 31 Aug 2022 14:19:27 +1200 Subject: [PATCH] ENH Replace ADMIN permissions with less permissions in Behat test --- tests/behat/features/change-sort-order.feature | 3 ++- tests/behat/features/file-details.feature | 4 ++-- tests/behat/features/file-history.feature | 3 ++- tests/behat/features/file-status-icons.feature | 3 ++- tests/behat/features/file-upload-state.feature | 3 ++- tests/behat/features/insert-an-image.feature | 3 ++- tests/behat/features/manage-file-permissions.feature | 8 ++++---- tests/behat/features/manage-files.feature | 3 ++- tests/behat/features/multi-file-upload-field.feature | 3 ++- tests/behat/features/replace-file.feature | 4 +++- tests/behat/features/single-file-upload-field.feature | 6 ++++-- tests/behat/features/table-view.feature | 3 ++- 12 files changed, 29 insertions(+), 17 deletions(-) diff --git a/tests/behat/features/change-sort-order.feature b/tests/behat/features/change-sort-order.feature index a66bc1a73..a9f61dd1b 100644 --- a/tests/behat/features/change-sort-order.feature +++ b/tests/behat/features/change-sort-order.feature @@ -60,7 +60,8 @@ Feature: Change view for asset admin # subfolder names must start with a letter greater than "t" And a "image" "folder1/xsubfolder1/testfile.jpg" And a "image" "folder1/zsubfolder2/testfile.jpg" - And I am logged in with "ADMIN" permissions + And the "group" "EDITOR" has permissions "Access to 'Files' section" and "FILE_EDIT_ALL" + And I am logged in as a member of "EDITOR" group And I go to "/admin/assets" Scenario: I can switch the sorting order in table view diff --git a/tests/behat/features/file-details.feature b/tests/behat/features/file-details.feature index 575c779ff..cc5c6f48b 100644 --- a/tests/behat/features/file-details.feature +++ b/tests/behat/features/file-details.feature @@ -5,10 +5,10 @@ Feature: File details Background: - Given the "group" "EDITOR group" has permissions "CMS_ACCESS_LeftAndMain" and "FILE_EDIT_ALL" + Given the "group" "EDITOR" has permissions "Access to 'Files' section" and "FILE_EDIT_ALL" And a "image" "assets/file1.jpg" And a "page" "My page" has the "Content" "

[image id=1]

" - And I am logged in with "EDITOR" permissions + And I am logged in as a member of "EDITOR" group Scenario: Operate file details diff --git a/tests/behat/features/file-history.feature b/tests/behat/features/file-history.feature index 4dfcb3767..183073fda 100644 --- a/tests/behat/features/file-history.feature +++ b/tests/behat/features/file-history.feature @@ -7,7 +7,8 @@ Feature: View File History Background: Given a "image" "folder1/file1.jpg" And a "image" "folder1/file2.jpg" - And I am logged in with "ADMIN" permissions + And the "group" "EDITOR" has permissions "Access to 'Files' section" and "FILE_EDIT_ALL" + And I am logged in as a member of "EDITOR" group And I have a config file "history.yml" And I go to "/admin/assets" And I select the file named "folder1" in the gallery diff --git a/tests/behat/features/file-status-icons.feature b/tests/behat/features/file-status-icons.feature index a861fc876..6f7a30c49 100644 --- a/tests/behat/features/file-status-icons.feature +++ b/tests/behat/features/file-status-icons.feature @@ -7,7 +7,8 @@ Feature: Manage file permissions Background: Given a "image" "assets/file1.jpg" was created "2010-01-01 12:00:00" And a "image" "assets/folder1/file2.jpg" was created "2010-01-01 12:00:00" - And I am logged in with "ADMIN" permissions + And the "group" "EDITOR" has permissions "Access to 'Files' section" and "FILE_EDIT_ALL" + And I am logged in as a member of "EDITOR" group And I go to "/admin/assets" Scenario: I see a restricted access icon diff --git a/tests/behat/features/file-upload-state.feature b/tests/behat/features/file-upload-state.feature index 565ff4db5..d98b2e474 100644 --- a/tests/behat/features/file-upload-state.feature +++ b/tests/behat/features/file-upload-state.feature @@ -7,7 +7,8 @@ Feature: Upload file state Background: Given a "image" "file1.jpg" And a "image" "folder1/file2.jpg" - And I am logged in with "ADMIN" permissions + And the "group" "EDITOR" has permissions "Access to 'Files' section" and "FILE_EDIT_ALL" + And I am logged in as a member of "EDITOR" group And I go to "/admin/assets" Scenario: There are no ghost files when navigating folder after uploading a file diff --git a/tests/behat/features/insert-an-image.feature b/tests/behat/features/insert-an-image.feature index 47900b6fa..3c2868346 100644 --- a/tests/behat/features/insert-an-image.feature +++ b/tests/behat/features/insert-an-image.feature @@ -9,7 +9,8 @@ Feature: Insert an image into a page And a "image" "folder1/file1.jpg" And a "image" "folder1/file2.jpg" And a "folder" "folder1/folder1-1" - And I am logged in with "ADMIN" permissions + And the "group" "EDITOR" has permissions "Access to 'Files' section" and "Access to 'Pages' section" and "FILE_EDIT_ALL" + 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 diff --git a/tests/behat/features/manage-file-permissions.feature b/tests/behat/features/manage-file-permissions.feature index 21fc49881..0673b16c8 100644 --- a/tests/behat/features/manage-file-permissions.feature +++ b/tests/behat/features/manage-file-permissions.feature @@ -8,7 +8,7 @@ Feature: Manage file permissions Given a "image" "assets/folder1/file1.jpg" was created "2012-01-01 12:00:00" And a "image" "assets/folder1/folder1-1/file2.jpg" was created "2010-01-01 12:00:00" And a "folder" "assets/folder2" - And the "group" "EDITOR group" has permissions "Access to all CMS sections" + And the "group" "EDITOR" has permissions "Access to 'Files' section" And a page "Gallery" containing an image "assets/folder3/file1.jpg" And I am logged in with "ADMIN" permissions And I go to "/admin/assets" @@ -24,7 +24,7 @@ Feature: Manage file permissions And I select "ADMIN group" in the "#Form_fileEditForm_EditorGroups_Holder" tree dropdown And I press the "Save" button And I am not logged in - And I am logged in with "EDITOR" permissions + And I am logged in as a member of "EDITOR" group And I go to "/admin/assets" And I click on the folder named "folder1" in the gallery And I click on the file named "file1" in the gallery @@ -42,10 +42,10 @@ Feature: Manage file permissions Then I should see the "Form_fileEditForm" form When I click "Permissions" in the "#Editor .nav-tabs" element And I select "Only these groups (choose from list)" from "Who can edit this file?" input group - And I select "EDITOR group" in the "#Form_fileEditForm_EditorGroups_Holder" tree dropdown + And I select "EDITOR" in the "#Form_fileEditForm_EditorGroups_Holder" tree dropdown And I press the "Save" button And I am not logged in - And I am logged in with "EDITOR" permissions + And I am logged in as a member of "EDITOR" group And I go to "/admin/assets" And I wait for 1 second And I click on the folder named "folder1" in the gallery diff --git a/tests/behat/features/manage-files.feature b/tests/behat/features/manage-files.feature index fd70270ab..b7e0b93ab 100644 --- a/tests/behat/features/manage-files.feature +++ b/tests/behat/features/manage-files.feature @@ -9,7 +9,8 @@ Feature: Manage files And a "image" "assets/folder1/folder1-1/file2.jpg" was created "2010-01-01 12:00:00" And a "folder" "assets/folder2" And a page "Gallery" containing an image "assets/folder3/file1.jpg" - And I am logged in with "ADMIN" permissions + And the "group" "EDITOR" has permissions "Access to 'Files' section" and "FILE_EDIT_ALL" + And I am logged in as a member of "EDITOR" group And I go to "/admin/assets" @modal diff --git a/tests/behat/features/multi-file-upload-field.feature b/tests/behat/features/multi-file-upload-field.feature index 9b9e9f6d3..5b312e30b 100644 --- a/tests/behat/features/multi-file-upload-field.feature +++ b/tests/behat/features/multi-file-upload-field.feature @@ -8,7 +8,8 @@ Feature: Multi file Upload field And a "image" "folder1/file1.jpg" And a "image" "folder1/file2.jpg" And a "company" "ACME inc" - And I am logged in with "ADMIN" permissions + And the "group" "EDITOR" has permissions "VIEW_DRAFT_CONTENT" and "Access to 'Test ModelAdmin' section" and "TEST_DATAOBJECT_EDIT" and "Access to 'Files' section" and "FILE_EDIT_ALL" + And I am logged in as a member of "EDITOR" group And I go to "/admin/test/" And I click "ACME inc" in the "#Form_EditForm_SilverStripe-FrameworkTest-Model-Company" element And I should see an ".uploadfield" element diff --git a/tests/behat/features/replace-file.feature b/tests/behat/features/replace-file.feature index b4b78911c..0fe5e20f0 100644 --- a/tests/behat/features/replace-file.feature +++ b/tests/behat/features/replace-file.feature @@ -7,10 +7,12 @@ Feature: Replace a file with a new file Given a "image" "folder1/file1.jpg" And a "file" "folder1/document.pdf" And a "image" "folder1/file2.jpg" - And I am logged in with "ADMIN" permissions + And the "group" "EDITOR" has permissions "Access to 'Files' section" and "FILE_EDIT_ALL" + And I am logged in as a member of "EDITOR" group And I go to "/admin/assets" And I select the file named "folder1" in the gallery And I click on the file named "file1" in the gallery + And I wait for 5 second Then I should see an "#Form_fileEditForm" element @javascript diff --git a/tests/behat/features/single-file-upload-field.feature b/tests/behat/features/single-file-upload-field.feature index f49fd3e5b..7587be417 100644 --- a/tests/behat/features/single-file-upload-field.feature +++ b/tests/behat/features/single-file-upload-field.feature @@ -8,8 +8,10 @@ Feature: Single file Upload field And a "image" "folder1/file1.jpg" And a "image" "folder1/file2.jpg" And a "folder" "folder1/folder1-1" - And a "employee" "Allen" - And I am logged in with "ADMIN" permissions + And the "Company" "ACME inc" with "Category"="Other" + And the "Employee" "Allen" with "Company"="1" + And the "group" "EDITOR" has permissions "VIEW_DRAFT_CONTENT" and "Access to 'Files' section" and "FILE_EDIT_ALL" and "Access to 'Test ModelAdmin' section" and "TEST_DATAOBJECT_EDIT" + And I am logged in as a member of "EDITOR" group And I go to "/admin/test/SilverStripe-FrameworkTest-Model-Employee" And I click "Allen" in the "#Form_EditForm_SilverStripe-FrameworkTest-Model-Employee" element And I should see an ".uploadfield" element diff --git a/tests/behat/features/table-view.feature b/tests/behat/features/table-view.feature index 735b61cba..a1e109163 100644 --- a/tests/behat/features/table-view.feature +++ b/tests/behat/features/table-view.feature @@ -6,7 +6,8 @@ Feature: Change view for asset admin Background: Given a "image" "folder1/file1.jpg" And a "image" "folder1/file2.jpg" - And I am logged in with "ADMIN" permissions + And the "group" "EDITOR" has permissions "Access to 'Files' section" and "FILE_EDIT_ALL" + And I am logged in as a member of "EDITOR" group And I go to "/admin/assets" @assets