Skip to content

Commit

Permalink
Merge pull request #1292 from creative-commoners/pulls/1/review-behat…
Browse files Browse the repository at this point in the history
…-tests

ENH Replace ADMIN permissions with less permissions in Behat test
  • Loading branch information
GuySartorelli authored Sep 15, 2022
2 parents d1777b0 + a2c3dc4 commit b90b60f
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 17 deletions.
3 changes: 2 additions & 1 deletion tests/behat/features/change-sort-order.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/behat/features/file-details.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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" "<p>[image id=1]</p>"
And I am logged in with "EDITOR" permissions
And I am logged in as a member of "EDITOR" group

Scenario: Operate file details

Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/file-history.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/file-status-icons.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/file-upload-state.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/insert-an-image.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions tests/behat/features/manage-file-permissions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/manage-files.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/multi-file-upload-field.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tests/behat/features/replace-file.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions tests/behat/features/single-file-upload-field.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/behat/features/table-view.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b90b60f

Please sign in to comment.