mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
MNT Update behat tests
This commit is contained in:
parent
5049a5e13c
commit
cae9bd51ec
@ -11,9 +11,10 @@ default:
|
|||||||
- SilverStripe\BehatExtension\Context\EmailContext
|
- SilverStripe\BehatExtension\Context\EmailContext
|
||||||
- SilverStripe\CMS\Tests\Behaviour\LoginContext
|
- SilverStripe\CMS\Tests\Behaviour\LoginContext
|
||||||
- SilverStripe\CMS\Tests\Behaviour\ThemeContext
|
- SilverStripe\CMS\Tests\Behaviour\ThemeContext
|
||||||
- SilverStripe\CMS\Tests\Behaviour\FixtureContext:
|
# Using asset-admin for fixture context to get iAttachTheFileToDropzone()
|
||||||
|
- SilverStripe\AssetAdmin\Tests\Behat\Context\FixtureContext:
|
||||||
# Note: double indent for args is intentional
|
# Note: double indent for args is intentional
|
||||||
- '%paths.modules.subsites%/tests/behat/features/files/'
|
- '%paths.modules.subsites%/tests/behat/files/'
|
||||||
|
|
||||||
extensions:
|
extensions:
|
||||||
SilverStripe\BehatExtension\MinkExtension:
|
SilverStripe\BehatExtension\MinkExtension:
|
||||||
|
82
tests/behat/features/operate-subsites.feature
Normal file
82
tests/behat/features/operate-subsites.feature
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
@javascript
|
||||||
|
Feature: Create and select a subsite
|
||||||
|
As a CMS user
|
||||||
|
I want to be able to select a subsite
|
||||||
|
So that I can edit content for a specific subsite
|
||||||
|
|
||||||
|
Background:
|
||||||
|
# There's a bug where you need CMS_ACCESS_CMSMain rather than CMS_ACCESS_LeftAndMain permissions to
|
||||||
|
# use subsites as expected
|
||||||
|
# Given the "group" "EDITOR group" has permissions "CMS_ACCESS_LeftAndMain" and "FILE_EDIT_ALL"
|
||||||
|
Given the "group" "EDITOR group" has permissions "CMS_ACCESS_CMSMain" and "CMS_ACCESS_AssetAdmin" and "FILE_EDIT_ALL"
|
||||||
|
And a "page" "My page" with "URLSegment"="my-page", "Content"="My page content"
|
||||||
|
And an "image" "file1.jpg"
|
||||||
|
And an "image" "file2.jpg"
|
||||||
|
|
||||||
|
Scenario: I can operate subsites
|
||||||
|
|
||||||
|
# Create subsite as Admin
|
||||||
|
Given I am logged in with "ADMIN" permissions
|
||||||
|
Then I go to "admin/subsites"
|
||||||
|
|
||||||
|
# Add subsites button is not a regular button, so click using css selector
|
||||||
|
And I click on the ".btn-toolbar .btn__title" element
|
||||||
|
And I fill in "Subsite Name" with "My subsite"
|
||||||
|
And I press "Create"
|
||||||
|
|
||||||
|
# Add a file to the main site
|
||||||
|
When I go to "admin/assets"
|
||||||
|
And I press the "Add folder" button
|
||||||
|
And I select "Main site" from "SubsitesSelect"
|
||||||
|
# Using a short folder name so that it doesn't get truncated on the frontend
|
||||||
|
And I fill in "Folder name" with "mfol"
|
||||||
|
And I press the "Create" button
|
||||||
|
When I go to "admin/assets"
|
||||||
|
|
||||||
|
And I click on the file named "mfol" in the gallery
|
||||||
|
And I attach the file "file1.jpg" to dropzone "gallery-container"
|
||||||
|
|
||||||
|
# Change to Editor user
|
||||||
|
When I go to "/Security/login"
|
||||||
|
And I press the "Log in as someone else" button
|
||||||
|
When I am logged in with "EDITOR" permissions
|
||||||
|
And I go to "admin/pages"
|
||||||
|
|
||||||
|
# Can see main site page on main site
|
||||||
|
When I go to "admin/pages"
|
||||||
|
Then I should see "My page" in the tree
|
||||||
|
|
||||||
|
# Cannot see main site page on subsite
|
||||||
|
When I select "My subsite" from "SubsitesSelect"
|
||||||
|
And I go to "admin/pages"
|
||||||
|
Then I should not see "My page" in the tree
|
||||||
|
|
||||||
|
# Create a page on the subsite
|
||||||
|
When I press the "Add new" button
|
||||||
|
And I select the "Page" radio button
|
||||||
|
And I press the "Create" button
|
||||||
|
When I fill in "Page name" with "My subsite page"
|
||||||
|
And I press the "Publish" button
|
||||||
|
Then I should see "My subsite page"
|
||||||
|
|
||||||
|
# Can see main site folders/files from subsite
|
||||||
|
When I go to "admin/assets"
|
||||||
|
Then I should see "mfol"
|
||||||
|
When I click on the file named "mfol" in the gallery
|
||||||
|
Then I should see "file1"
|
||||||
|
|
||||||
|
# Add a file to the subsite
|
||||||
|
When I go to "admin/assets"
|
||||||
|
And I select "My subsite" from "SubsitesSelect"
|
||||||
|
And I press the "Add folder" button
|
||||||
|
And I fill in "Folder name" with "sfol"
|
||||||
|
And I press the "Create" button
|
||||||
|
When I go to "admin/assets"
|
||||||
|
And I click on the file named "sfol" in the gallery
|
||||||
|
And I attach the file "file2.jpg" to dropzone "gallery-container"
|
||||||
|
|
||||||
|
# Change back to main subsite - cannot see subsite folders/files
|
||||||
|
When I go to "admin/assets"
|
||||||
|
And I select "Main site" from "SubsitesSelect"
|
||||||
|
Then I should see "mfol"
|
||||||
|
Then I should not see "My subsite page"
|
@ -4,18 +4,19 @@ Feature: Preview navigation
|
|||||||
In order to preview my content
|
In order to preview my content
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given a "subsite" "My subsite"
|
Given a "subsite" "MySubsite"
|
||||||
And a "page" "My page" with "URLSegment"="my-page", "Content"="My page content <a name='aname'>aname</a><a href='other-page'>ahref</a>" and "Subsite"="=>SilverStripe\Subsites\Model\Subsite.My subsite"
|
And a "page" "My page" with "URLSegment"="my-page", "Content"="My page content <a name='aname'>aname</a> <a href='[sitetree_link,id=5]'>ahref</a>" and "SubsiteID"="1"
|
||||||
And a "page" "Other page" with "URLSegment"="other-page", "Content"="Other page content <a href='my-page'>Goto my page></a>" and "Subsite"="=>SilverStripe\Subsites\Model\Subsite.My subsite"
|
And a "page" "Other page" with "URLSegment"="other-page", "Content"="Other page content <a href='[sitetree_link,id=4]'>Goto my page</a>" and "SubsiteID"="1"
|
||||||
Given a "member" "Joe" belonging to "Admin Group" with "Email"="joe@test.com" and "Password"="Password1"
|
|
||||||
And the "group" "Admin Group" has permissions "Full administrative rights"
|
|
||||||
And I log in with "joe@test.com" and "Password1"
|
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: I can navigate the subsite preview
|
Scenario: I can navigate the subsite preview
|
||||||
When I go to "admin"
|
Given I am logged in with "ADMIN" permissions
|
||||||
And I select "My subsite" from "SubsitesSelect"
|
When I go to "/admin/pages"
|
||||||
And I go to "admin/pages"
|
And I select "MySubsite" from "SubsitesSelect"
|
||||||
|
And I click on "My page" in the tree
|
||||||
|
And I press the "Publish" button
|
||||||
|
And I click on "Other page" in the tree
|
||||||
|
And I press the "Publish" button
|
||||||
And I click on "My page" in the tree
|
And I click on "My page" in the tree
|
||||||
And I set the CMS mode to "Preview mode"
|
And I set the CMS mode to "Preview mode"
|
||||||
And I follow "ahref" in preview
|
And I follow "ahref" in preview
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
@javascript
|
|
||||||
Feature: Select a subsite
|
|
||||||
As a CMS user
|
|
||||||
I want to be able to select a subsite
|
|
||||||
So that I can edit content for a specific subsite
|
|
||||||
|
|
||||||
Background:
|
|
||||||
Given a "subsite" "Subsite B"
|
|
||||||
And a "page" "My page" with "URLSegment"="my-page", "Content"="My page content"
|
|
||||||
And I am logged in with "ADMIN" permissions
|
|
||||||
Then I go to "admin/pages"
|
|
||||||
|
|
||||||
Scenario: Default site contains default pages
|
|
||||||
When I select "Main site" from "SubsitesSelect"
|
|
||||||
And I go to "admin/pages"
|
|
||||||
Then I should see "My page" in the tree
|
|
||||||
|
|
||||||
Scenario: I can switch to another subsite
|
|
||||||
When I select "Subsite B" from "SubsitesSelect"
|
|
||||||
And I go to "admin/pages"
|
|
||||||
Then I should not see "My page" in the tree
|
|
BIN
tests/behat/files/file1.jpg
Normal file
BIN
tests/behat/files/file1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
tests/behat/files/file2.jpg
Normal file
BIN
tests/behat/files/file2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
Loading…
Reference in New Issue
Block a user