mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Shift behat test from framework to admin (#8172)
This commit is contained in:
parent
1c5876acf0
commit
7eeb91880a
33
.travis.yml
33
.travis.yml
@ -2,10 +2,6 @@ language: php
|
|||||||
|
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
|
||||||
before_install:
|
|
||||||
- sudo apt-get update
|
|
||||||
- sudo apt-get install chromium-chromedriver
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.composer/cache/files
|
- $HOME/.composer/cache/files
|
||||||
@ -14,15 +10,10 @@ addons:
|
|||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- tidy
|
- tidy
|
||||||
firefox: "31.0"
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- COMPOSER_ROOT_VERSION=4.2.x-dev
|
- COMPOSER_ROOT_VERSION=4.2.x-dev
|
||||||
- DISPLAY=":99"
|
|
||||||
- XVFBARGS=":99 -ac -screen 0 1024x768x16"
|
|
||||||
- SS_BASE_URL="http://localhost:8080/"
|
|
||||||
- SS_ENVIRONMENT_TYPE="dev"
|
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
@ -52,18 +43,10 @@ matrix:
|
|||||||
- DB=MYSQL
|
- DB=MYSQL
|
||||||
- PDO=1
|
- PDO=1
|
||||||
- PHPUNIT_TEST=framework
|
- PHPUNIT_TEST=framework
|
||||||
- php: 7.0
|
|
||||||
env:
|
|
||||||
- DB=MYSQL
|
|
||||||
- BEHAT_TEST=framework
|
|
||||||
- php: 7.0
|
- php: 7.0
|
||||||
env:
|
env:
|
||||||
- DB=MYSQL
|
- DB=MYSQL
|
||||||
- PHPUNIT_TEST=cms
|
- PHPUNIT_TEST=cms
|
||||||
- php: 7.0
|
|
||||||
env:
|
|
||||||
- DB=MYSQL
|
|
||||||
- BEHAT_TEST=cms
|
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- php: nightly
|
- php: nightly
|
||||||
env:
|
env:
|
||||||
@ -74,7 +57,6 @@ matrix:
|
|||||||
before_script:
|
before_script:
|
||||||
# Extra $PATH
|
# Extra $PATH
|
||||||
- export PATH=~/.composer/vendor/bin:$PATH
|
- export PATH=~/.composer/vendor/bin:$PATH
|
||||||
- export PATH=/usr/lib/chromium-browser/:$PATH
|
|
||||||
|
|
||||||
# Init PHP
|
# Init PHP
|
||||||
- pecl channel-update pecl.php.net
|
- pecl channel-update pecl.php.net
|
||||||
@ -88,26 +70,17 @@ before_script:
|
|||||||
- if [[ $DB == PGSQL ]]; then composer require silverstripe/postgresql:2.0.x-dev --no-update; fi
|
- if [[ $DB == PGSQL ]]; then composer require silverstripe/postgresql:2.0.x-dev --no-update; fi
|
||||||
- if [[ $DB == SQLITE ]]; then composer require silverstripe/sqlite3:2.0.x-dev --no-update; fi
|
- if [[ $DB == SQLITE ]]; then composer require silverstripe/sqlite3:2.0.x-dev --no-update; fi
|
||||||
- composer require silverstripe/recipe-testing:^1 silverstripe/recipe-core:4.2.x-dev silverstripe/admin:1.2.x-dev silverstripe/versioned:1.2.x-dev --no-update
|
- composer require silverstripe/recipe-testing:^1 silverstripe/recipe-core:4.2.x-dev silverstripe/admin:1.2.x-dev silverstripe/versioned:1.2.x-dev --no-update
|
||||||
- if [[ $PHPUNIT_TEST == cms ]] || [[ $BEHAT_TEST == cms ]]; then composer require silverstripe/recipe-cms:4.2.x-dev --no-update; fi
|
- if [[ $PHPUNIT_TEST == cms ]]; then composer require silverstripe/recipe-cms:4.2.x-dev --no-update; fi
|
||||||
- if [[ $PHPCS_TEST ]]; then composer global require squizlabs/php_codesniffer:^3 --prefer-dist --no-interaction --no-progress --no-suggest -o; fi
|
- if [[ $PHPCS_TEST ]]; then composer global require squizlabs/php_codesniffer:^3 --prefer-dist --no-interaction --no-progress --no-suggest -o; fi
|
||||||
- composer install --prefer-source --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile
|
- composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile
|
||||||
|
|
||||||
# Log constants to CI for debugging purposes
|
# Log constants to CI for debugging purposes
|
||||||
- php ./tests/dump_constants.php
|
- php ./tests/dump_constants.php
|
||||||
|
|
||||||
# Start behat services
|
|
||||||
- if [[ $BEHAT_TEST ]]; then mkdir artifacts; fi
|
|
||||||
- if [[ $BEHAT_TEST ]]; then cp composer.lock artifacts/; fi
|
|
||||||
- if [[ $BEHAT_TEST ]]; then sh -e /etc/init.d/xvfb start; sleep 3; fi
|
|
||||||
- if [[ $BEHAT_TEST ]]; then (chromedriver > artifacts/chromedriver.log 2>&1 &); fi
|
|
||||||
- if [[ $BEHAT_TEST == framework ]]; then (vendor/bin/serve --bootstrap-file tests/behat/serve-bootstrap.php &> artifacts/serve.log &); fi
|
|
||||||
- if [[ $BEHAT_TEST == cms ]]; then (vendor/bin/serve --bootstrap-file vendor/silverstripe/cms/tests/behat/serve-bootstrap.php &> artifacts/serve.log &); fi
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit --testsuite $PHPUNIT_TEST; fi
|
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit --testsuite $PHPUNIT_TEST; fi
|
||||||
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --testsuite $PHPUNIT_COVERAGE_TEST --coverage-clover=coverage.xml; fi
|
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --testsuite $PHPUNIT_COVERAGE_TEST --coverage-clover=coverage.xml; fi
|
||||||
- if [[ $BEHAT_TEST == framework ]]; then vendor/bin/behat @framework; fi
|
|
||||||
- if [[ $BEHAT_TEST == cms ]]; then vendor/bin/behat @cms; fi
|
|
||||||
- if [[ $PHPCS_TEST ]]; then composer run-script lint; fi
|
- if [[ $PHPCS_TEST ]]; then composer run-script lint; fi
|
||||||
- if [[ $PHPCS_TEST ]]; then composer run-script php-peg; fi
|
- if [[ $PHPCS_TEST ]]; then composer run-script php-peg; fi
|
||||||
- if [[ $PHPCS_TEST ]]; then git diff-files --quiet -w --relative=src; fi
|
- if [[ $PHPCS_TEST ]]; then git diff-files --quiet -w --relative=src; fi
|
||||||
@ -116,5 +89,3 @@ script:
|
|||||||
after_success:
|
after_success:
|
||||||
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
|
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
|
||||||
|
|
||||||
after_failure:
|
|
||||||
- if [[ $BEHAT_TEST ]]; then php ./tests/behat/travis-upload-artifacts.php --if-env BEHAT_TEST,ARTIFACTS_BUCKET,ARTIFACTS_KEY,ARTIFACTS_SECRET --target-path $TRAVIS_REPO_SLUG/$TRAVIS_BUILD_ID/$TRAVIS_JOB_ID --artifacts-base-url https://s3.amazonaws.com/$ARTIFACTS_BUCKET/ --artifacts-path ./artifacts/; fi
|
|
||||||
|
34
behat.yml
34
behat.yml
@ -1,34 +0,0 @@
|
|||||||
# Run framework behat tests with this command (installed with silverstripe/installer)
|
|
||||||
# Note that framework behat tests require CMS module
|
|
||||||
# ========================================================================= #
|
|
||||||
# vendor/bin/selenium-server-standalone -Dwebdriver.firefox.bin="/Applications/Firefox31.app/Contents/MacOS/firefox-bin"
|
|
||||||
# vendor/bin/serve --bootstrap-file vendor/silverstripe/framework/tests/behat/serve-bootstrap.php
|
|
||||||
# vendor/bin/behat @framework
|
|
||||||
# ========================================================================= #
|
|
||||||
default:
|
|
||||||
suites:
|
|
||||||
framework:
|
|
||||||
paths:
|
|
||||||
- %paths.modules.framework%/tests/behat/features
|
|
||||||
contexts:
|
|
||||||
- SilverStripe\Framework\Tests\Behaviour\FeatureContext
|
|
||||||
- SilverStripe\Framework\Tests\Behaviour\CmsFormsContext
|
|
||||||
- SilverStripe\Framework\Tests\Behaviour\CmsUiContext
|
|
||||||
- SilverStripe\BehatExtension\Context\BasicContext
|
|
||||||
- SilverStripe\BehatExtension\Context\EmailContext
|
|
||||||
- SilverStripe\BehatExtension\Context\LoginContext
|
|
||||||
-
|
|
||||||
SilverStripe\BehatExtension\Context\FixtureContext:
|
|
||||||
- %paths.modules.framework%/tests/behat/features/files/
|
|
||||||
|
|
||||||
extensions:
|
|
||||||
SilverStripe\BehatExtension\MinkExtension:
|
|
||||||
default_session: facebook_web_driver
|
|
||||||
javascript_session: facebook_web_driver
|
|
||||||
facebook_web_driver:
|
|
||||||
browser: chrome
|
|
||||||
wd_host: "http://127.0.0.1:9515" #chromedriver port
|
|
||||||
|
|
||||||
SilverStripe\BehatExtension\Extension:
|
|
||||||
screenshot_path: %paths.base%/artifacts/screenshots
|
|
||||||
bootstrap_file: "tests/behat/serve-bootstrap.php"
|
|
@ -1 +0,0 @@
|
|||||||
See https://github.com/silverstripe-labs/silverstripe-behat-extension
|
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
@ -1,35 +0,0 @@
|
|||||||
@retry
|
|
||||||
Feature: Log in
|
|
||||||
As an site owner
|
|
||||||
I want to access to the CMS to be secure
|
|
||||||
So that only my team can make content changes
|
|
||||||
|
|
||||||
Scenario: Bad login
|
|
||||||
Given I log in with "bad@example.com" and "badpassword"
|
|
||||||
Then I should see "The provided details don't seem to be correct"
|
|
||||||
|
|
||||||
Scenario: Valid login
|
|
||||||
Given I am logged in with "ADMIN" permissions
|
|
||||||
When I go to "/admin/"
|
|
||||||
Then I should see the CMS
|
|
||||||
|
|
||||||
Scenario: /admin/ redirect for not logged in user
|
|
||||||
# disable automatic redirection so we can use the profiler
|
|
||||||
When I go to "/admin/"
|
|
||||||
And I should see a log-in form
|
|
||||||
|
|
||||||
Scenario: Logout without token
|
|
||||||
Given I am logged in with "ADMIN" permissions
|
|
||||||
When I go to "/Security/logout"
|
|
||||||
Then I should see a log-out form
|
|
||||||
When I press the "Log out" button
|
|
||||||
And I go to "/admin/"
|
|
||||||
Then I should see a log-in form
|
|
||||||
|
|
||||||
Scenario: Log in as someone else
|
|
||||||
Given I am logged in with "ADMIN" permissions
|
|
||||||
When I go to "/Security/login"
|
|
||||||
Then the response should contain "Log in as someone else"
|
|
||||||
|
|
||||||
When I press the "Log in as someone else" button
|
|
||||||
Then I should see a log-in form
|
|
@ -1,22 +0,0 @@
|
|||||||
@retry
|
|
||||||
Feature: Lost Password
|
|
||||||
As a site owner
|
|
||||||
I want to be able to reset my password
|
|
||||||
Using my email
|
|
||||||
|
|
||||||
Background:
|
|
||||||
Given a "member" "Admin" with "Email"="admin@example.org"
|
|
||||||
|
|
||||||
Scenario: I can request a password reset by email
|
|
||||||
Given I go to "Security/login"
|
|
||||||
When I follow "I've lost my password"
|
|
||||||
And I fill in "admin@example.org" for "Email"
|
|
||||||
And I press the "Send me the password reset link" button
|
|
||||||
Then I should see "A reset link has been sent to 'admin@example.org'"
|
|
||||||
And there should be an email to "admin@example.org" titled "Your password reset link"
|
|
||||||
When I click on the "password reset link" link in the email to "admin@example.org"
|
|
||||||
Then I should see "Please enter a new password"
|
|
||||||
When I fill in "newpassword" for "New Password"
|
|
||||||
And I fill in "newpassword" for "Confirm New Password"
|
|
||||||
And I press the "Change Password" button
|
|
||||||
Then the password for "admin@example.org" should be "newpassword"
|
|
@ -1,74 +0,0 @@
|
|||||||
@javascript @retry
|
|
||||||
Feature: Manage users
|
|
||||||
As a site administrator
|
|
||||||
I want to create and manage user accounts on my site
|
|
||||||
So that I can control access to the CMS
|
|
||||||
|
|
||||||
Background:
|
|
||||||
Given a "member" "ADMIN" belonging to "ADMIN group" with "Email"="admin@example.org"
|
|
||||||
And the "member" "ADMIN" belonging to "ADMIN group2"
|
|
||||||
And a "member" "Staff" belonging to "Staff group" with "Email"="staffmember@example.org"
|
|
||||||
And the "group" "ADMIN group" has permissions "Full administrative rights"
|
|
||||||
And the "group" "ADMIN group2" has permissions "Full administrative rights"
|
|
||||||
And I am logged in with "ADMIN" permissions
|
|
||||||
And I go to "/admin/security"
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: I cannot remove my admin access, but can remove myself from an admin group
|
|
||||||
When I click the "Groups" CMS tab
|
|
||||||
And I click "ADMIN group" in the "#Root_Groups" element
|
|
||||||
And I should see the "Unlink" button in the "Members" gridfield for the "ADMIN" row
|
|
||||||
Then I click "Groups" in the ".breadcrumbs-wrapper" element
|
|
||||||
And I click the "Groups" CMS tab
|
|
||||||
And I click "ADMIN group2" in the "#Root_Groups" element
|
|
||||||
And I should see the "Unlink" button in the "Members" gridfield for the "ADMIN" row
|
|
||||||
Then I click the "Unlink" button in the "Members" gridfield for the "ADMIN" row
|
|
||||||
And I should not see the "Unlink" button in the "Members" gridfield for the "ADMIN" row
|
|
||||||
Then I click "Groups" in the ".breadcrumbs-wrapper" element
|
|
||||||
And I click the "Groups" CMS tab
|
|
||||||
And I click "ADMIN group" in the "#Root_Groups" element
|
|
||||||
And I should not see the "Unlink" button in the "Members" gridfield for the "ADMIN" row
|
|
||||||
|
|
||||||
Scenario: I can list all users regardless of group
|
|
||||||
When I click the "Users" CMS tab
|
|
||||||
Then I should see "admin@example.org" in the "#Root_Users" element
|
|
||||||
And I should see "staffmember@example.org" in the "#Root_Users" element
|
|
||||||
|
|
||||||
Scenario: I can list all users in a specific group
|
|
||||||
When I click the "Groups" CMS tab
|
|
||||||
# TODO Please check how performant this is
|
|
||||||
And I click "ADMIN group" in the "#Root_Groups" element
|
|
||||||
Then I should see "admin@example.org" in the "#Root_Members" element
|
|
||||||
And I should not see "staffmember@example.org" in the "#Root_Members" element
|
|
||||||
|
|
||||||
Scenario: I can add a user to the system
|
|
||||||
When I click the "Users" CMS tab
|
|
||||||
And I press the "Add Member" button
|
|
||||||
And I fill in the following:
|
|
||||||
| First Name | John |
|
|
||||||
| Surname | Doe |
|
|
||||||
| Email | john.doe@example.org |
|
|
||||||
And I press the "Create" button
|
|
||||||
Then I should see a "Saved member" message
|
|
||||||
|
|
||||||
When I go to "admin/security/"
|
|
||||||
Then I should see "john.doe@example.org" in the "#Root_Users" element
|
|
||||||
|
|
||||||
Scenario: I can edit an existing user and add him to an existing group
|
|
||||||
When I click the "Users" CMS tab
|
|
||||||
And I click "staffmember@example.org" in the "#Root_Users" element
|
|
||||||
And I select "ADMIN group" from "Groups"
|
|
||||||
And I press the "Apply changes" button
|
|
||||||
Then I should see a "Saved Member" message
|
|
||||||
|
|
||||||
When I go to "admin/security"
|
|
||||||
And I click the "Groups" CMS tab
|
|
||||||
And I click "ADMIN group" in the "#Root_Groups" element
|
|
||||||
Then I should see "staffmember@example.org"
|
|
||||||
|
|
||||||
Scenario: I can delete an existing user
|
|
||||||
When I click the "Users" CMS tab
|
|
||||||
And I click "staffmember@example.org" in the "#Root_Users" element
|
|
||||||
And I press the "Delete" button, confirming the dialog
|
|
||||||
Then I should see "admin@example.org"
|
|
||||||
And I should not see "staffmember@example.org"
|
|
@ -1,62 +0,0 @@
|
|||||||
@retry
|
|
||||||
Feature: Manage my own settings
|
|
||||||
As a CMS user
|
|
||||||
I want to be able to change personal settings
|
|
||||||
In order to streamline my CMS experience
|
|
||||||
|
|
||||||
Background:
|
|
||||||
Given a "member" "Joe" belonging to "Admin group" with "Email"="joe@example.org" and "Password"="secret"
|
|
||||||
And the "group" "Admin group" has permissions "Full administrative rights"
|
|
||||||
And the "member" "Joe" belonging to "Admin group2"
|
|
||||||
And the "group" "Admin group2" has permissions "Full administrative rights"
|
|
||||||
And I log in with "joe@example.org" and "secret"
|
|
||||||
And I go to "admin/myprofile"
|
|
||||||
|
|
||||||
Scenario: I cannot remove all my admin groups
|
|
||||||
When I click the "Admin group" option in the "DirectGroups" listbox
|
|
||||||
And I click the "Admin group2" option in the "DirectGroups" listbox
|
|
||||||
And I press the "Save" button
|
|
||||||
Then I should see "Cannot remove all admin groups from your profile" in the "#Form_EditForm" element
|
|
||||||
|
|
||||||
Scenario: I can remove one of my admin groups
|
|
||||||
When I click the "Admin group" option in the "DirectGroups" listbox
|
|
||||||
And I press the "Save" button
|
|
||||||
Then I should see a "Saved" notice
|
|
||||||
And I should not see "Cannot remove all admin groups from your profile" in the "#Form_EditForm" element
|
|
||||||
|
|
||||||
Scenario: I can edit my personal details
|
|
||||||
Given I fill in "First Name" with "Jack"
|
|
||||||
And I fill in "Surname" with "Johnson"
|
|
||||||
And I fill in "Email" with "jack@example.org"
|
|
||||||
When I press the "Save" button
|
|
||||||
Given I go to "admin/myprofile"
|
|
||||||
Then I should not see "Joe"
|
|
||||||
Then I should see "Jack"
|
|
||||||
And I should see "Johnson"
|
|
||||||
|
|
||||||
Scenario: I can't reset the password without the original
|
|
||||||
Given I follow "Change Password"
|
|
||||||
And I fill in "Current Password" with "idontknow"
|
|
||||||
And I fill in "New Password" with "newsecret"
|
|
||||||
And I fill in "Confirm Password" with "newsecret"
|
|
||||||
And I press the "Save" button
|
|
||||||
Then I should see "The current password you have entered is not correct."
|
|
||||||
|
|
||||||
Scenario: I can change my password
|
|
||||||
Given I follow "Change Password"
|
|
||||||
And I fill in "Current Password" with "secret"
|
|
||||||
And I fill in "New Password" with "newsecret"
|
|
||||||
And I fill in "Confirm Password" with "newsecret"
|
|
||||||
And I press the "Save" button
|
|
||||||
And I am not logged in
|
|
||||||
When I log in with "joe@example.org" and "newsecret"
|
|
||||||
And I go to "admin/myprofile"
|
|
||||||
Then I should see the CMS
|
|
||||||
|
|
||||||
Scenario: I can change the interface language
|
|
||||||
And I select "German (Germany)" from "Interface Language"
|
|
||||||
And I press the "Save" button
|
|
||||||
Then I should see "Sprache"
|
|
||||||
|
|
||||||
# TODO Date/time format - Difficult because its not exposed anywhere in the CMS?
|
|
||||||
# TODO Group modification as ADMIN user
|
|
@ -1,37 +0,0 @@
|
|||||||
@modal @retry
|
|
||||||
Feature: Reauthenticate
|
|
||||||
As a content editor
|
|
||||||
I want to be able to log in through a CMS popup when my session expires
|
|
||||||
So that I can avoid losing unsaved work
|
|
||||||
|
|
||||||
Background:
|
|
||||||
And I am logged in with "ADMIN" permissions
|
|
||||||
And I go to "/admin/security"
|
|
||||||
And I am not in an iframe
|
|
||||||
And I click the "Users" CMS tab
|
|
||||||
And my session expires
|
|
||||||
|
|
||||||
Scenario: Reauthenticate with correct login
|
|
||||||
When I press the "Add Member" button
|
|
||||||
And I switch to the "login-dialog-iframe" iframe
|
|
||||||
Then I should see "Your session has timed out due to inactivity" in the ".cms-security__container" element
|
|
||||||
When I fill in "Password" with "Secret!123"
|
|
||||||
And I press the "Let me back in" button
|
|
||||||
And I am not in an iframe
|
|
||||||
And I go to "/admin/security"
|
|
||||||
When I press the "Add Member" button
|
|
||||||
Then I should see "Create" in the "#Form_ItemEditForm_action_doSave" element
|
|
||||||
|
|
||||||
Scenario: Reauthenticate with wrong login
|
|
||||||
When I press the "Add Member" button
|
|
||||||
And I switch to the "login-dialog-iframe" iframe
|
|
||||||
Then I should see "Your session has timed out due to inactivity" in the ".cms-security__container" element
|
|
||||||
When I fill in "Password" with "wrong password"
|
|
||||||
And I press the "Let me back in" button
|
|
||||||
Then I should see "The provided details don't seem to be correct. Please try again."
|
|
||||||
When I fill in "Password" with "Secret!123"
|
|
||||||
And I press the "Let me back in" button
|
|
||||||
And I am not in an iframe
|
|
||||||
And I go to "/admin/security"
|
|
||||||
When I press the "Add Member" button
|
|
||||||
Then I should see "Create" in the "#Form_ItemEditForm_action_doSave" element
|
|
@ -1,85 +0,0 @@
|
|||||||
@javascript @retry
|
|
||||||
Feature: Manage Security Permissions for Groups
|
|
||||||
As a site administrator
|
|
||||||
I want to control my user's security permissions in an intuitive way
|
|
||||||
So that I can easily control access to the CMS
|
|
||||||
|
|
||||||
Background:
|
|
||||||
Given a "group" "test group"
|
|
||||||
And a "member" "ADMIN" belonging to "ADMIN group" with "Email"="admin@example.org"
|
|
||||||
And the "group" "ADMIN group" has permissions "Full administrative rights"
|
|
||||||
And I am logged in with "ADMIN" permissions
|
|
||||||
And I go to "/admin/security"
|
|
||||||
And I click the "Groups" CMS tab
|
|
||||||
And I click on "test group" in the "Groups" table
|
|
||||||
And I click the "Permissions" CMS tab
|
|
||||||
|
|
||||||
Scenario: I can see sub-permissions being properly set and restored when using "Access to all CMS sections"
|
|
||||||
When I check "Access to all CMS sections"
|
|
||||||
Then the "Access to 'Security' section" checkbox should be checked
|
|
||||||
And the "Access to 'Security' section" field should be disabled
|
|
||||||
|
|
||||||
When I uncheck "Access to all CMS sections"
|
|
||||||
Then the "Access to 'Security' section" checkbox should not be checked
|
|
||||||
And the "Access to 'Security' section" field should be enabled
|
|
||||||
|
|
||||||
When I check "Access to 'Security' section"
|
|
||||||
And I check "Access to all CMS sections"
|
|
||||||
When I uncheck "Access to all CMS sections"
|
|
||||||
Then the "Access to 'Security' section" checkbox should be checked
|
|
||||||
|
|
||||||
# Save so the driver can reset without having to deal with the popup alert.
|
|
||||||
Then I press the "Apply changes" button
|
|
||||||
|
|
||||||
Scenario: I can see sub-permissions being properly set and restored when using "Full administrative rights"
|
|
||||||
When I check "Access to 'Security' section"
|
|
||||||
And I check "Full administrative rights"
|
|
||||||
Then the "Access to all CMS sections" checkbox should be checked
|
|
||||||
And the "Access to all CMS sections" field should be disabled
|
|
||||||
And the "Access to 'Security' section" checkbox should be checked
|
|
||||||
And the "Access to 'Security' section" field should be disabled
|
|
||||||
|
|
||||||
And I uncheck "Full administrative rights"
|
|
||||||
Then the "Access to all CMS sections" checkbox should not be checked
|
|
||||||
And the "Access to all CMS sections" field should be enabled
|
|
||||||
And the "Access to 'Security' section" checkbox should be checked
|
|
||||||
And the "Access to 'Security' section" field should be enabled
|
|
||||||
|
|
||||||
# Save so the driver can reset without having to deal with the popup alert.
|
|
||||||
Then I press the "Apply changes" button
|
|
||||||
|
|
||||||
Scenario: I can see sub-permissions being handled properly between reloads when using "Full administrative rights"
|
|
||||||
When I check "Full administrative rights"
|
|
||||||
And I press the "Apply changes" button
|
|
||||||
And I click the "Permissions" CMS tab
|
|
||||||
Then the "Full administrative rights" checkbox should be checked
|
|
||||||
And the "Access to 'Security' section" checkbox should be checked
|
|
||||||
And the "Access to 'Security' section" field should be disabled
|
|
||||||
|
|
||||||
When I uncheck "Full administrative rights"
|
|
||||||
Then the "Access to 'Security' section" checkbox should not be checked
|
|
||||||
And the "Access to 'Security' section" field should be enabled
|
|
||||||
|
|
||||||
When I press the "Apply changes" button
|
|
||||||
And I click the "Permissions" CMS tab
|
|
||||||
Then the "Full administrative rights" checkbox should not be checked
|
|
||||||
And the "Access to 'Security' section" checkbox should not be checked
|
|
||||||
And the "Access to 'Security' section" field should be enabled
|
|
||||||
|
|
||||||
Scenario: I can see sub-permissions being handled properly between reloads when using "Access to all CMS sections"
|
|
||||||
When I check "Access to all CMS sections"
|
|
||||||
And I press the "Apply changes" button
|
|
||||||
And I click the "Permissions" CMS tab
|
|
||||||
Then the "Access to all CMS sections" checkbox should be checked
|
|
||||||
And the "Access to 'Security' section" checkbox should be checked
|
|
||||||
And the "Access to 'Security' section" field should be disabled
|
|
||||||
|
|
||||||
When I uncheck "Access to all CMS sections"
|
|
||||||
Then the "Access to 'Security' section" checkbox should not be checked
|
|
||||||
And the "Access to 'Security' section" field should be enabled
|
|
||||||
|
|
||||||
When I press the "Apply changes" button
|
|
||||||
And I click the "Permissions" CMS tab
|
|
||||||
Then the "Access to all CMS sections" checkbox should not be checked
|
|
||||||
And the "Access to 'Security' section" checkbox should not be checked
|
|
||||||
And the "Access to 'Security' section" field should be enabled
|
|
@ -1,102 +0,0 @@
|
|||||||
#!/usr/bin/env php
|
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Creates an index.html with links to all files in a given directory structure, recursively.
|
|
||||||
* This is useful for Amazon S3 uploads with static file hosting, since it doesn't list files by default.
|
|
||||||
*
|
|
||||||
* Assumes to run in a SilverStripe webroot
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run a command
|
|
||||||
*
|
|
||||||
* @param string $cmd
|
|
||||||
* @param bool $echo
|
|
||||||
*/
|
|
||||||
function run($cmd, $echo = true)
|
|
||||||
{
|
|
||||||
if ($echo) {
|
|
||||||
echo "+ $cmd\n";
|
|
||||||
}
|
|
||||||
passthru($cmd, $returnVar);
|
|
||||||
if ($returnVar > 0) {
|
|
||||||
die($returnVar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if an env variable is set
|
|
||||||
*
|
|
||||||
* @param $envs
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
function checkenv($envs)
|
|
||||||
{
|
|
||||||
if ($envs) {
|
|
||||||
foreach (explode(',', $envs) as $env) {
|
|
||||||
if (!getenv($env)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$opts = getopt('', array(
|
|
||||||
'artifacts-path:',
|
|
||||||
'target-path:',
|
|
||||||
'if-env:',
|
|
||||||
'artifacts-base-url:',
|
|
||||||
));
|
|
||||||
|
|
||||||
// --if-env=BEHAT_TEST means that this script will only be executed if the given environment var is set
|
|
||||||
if (empty($opts['if-env'])) {
|
|
||||||
echo "--if-env option is mandatory";
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
if (!checkenv($opts['if-env'])) {
|
|
||||||
echo "Apache skipped; {$opts['if-env']} wasn't set.\n";
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($opts['artifacts-path'])) {
|
|
||||||
$artifactsPath = $opts['artifacts-path'];
|
|
||||||
} elseif (is_dir(__DIR__ . '/artifacts/')) {
|
|
||||||
$artifactsPath = __DIR__ . '/artifacts/';
|
|
||||||
} elseif (is_dir('~/artifacts/')) {
|
|
||||||
$artifactsPath = '~/artifacts/';
|
|
||||||
} else {
|
|
||||||
$artifactsPath = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$targetPath = $opts['target-path'];
|
|
||||||
$baseUrl = $opts['artifacts-base-url'];
|
|
||||||
|
|
||||||
if (!$artifactsPath || !is_dir($artifactsPath)) {
|
|
||||||
echo "No artifacts found, skipped\n";
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Installing artifacts script to ~/bin/artifacts\n";
|
|
||||||
run("curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash");
|
|
||||||
|
|
||||||
echo "Creating {$artifactsPath}index.html...\n";
|
|
||||||
|
|
||||||
$html = '<html><head></head><body><ul>';
|
|
||||||
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath($artifactsPath)), RecursiveIteratorIterator::SELF_FIRST);
|
|
||||||
foreach ($objects as $name => $object) {
|
|
||||||
if ($object->isDir()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$relativePath = trim(str_replace(realpath($artifactsPath) . '/', '', $object->getPathName()), '/');
|
|
||||||
$html .= sprintf('<li><a href="%s">%s</a></li>', $relativePath, $relativePath);
|
|
||||||
}
|
|
||||||
$html .= '</ul></body></html>';
|
|
||||||
|
|
||||||
file_put_contents("{$artifactsPath}index.html", $html);
|
|
||||||
|
|
||||||
run("~/bin/artifacts upload --permissions public-read --target-paths $targetPath $artifactsPath");
|
|
||||||
|
|
||||||
$fullPath = str_replace('//', '/', "$baseUrl/$targetPath/index.html");
|
|
||||||
$fullPath = str_replace('https:/s3', 'https://s3', $fullPath);
|
|
||||||
echo "Uploaded artifacts to $fullPath\n";
|
|
Loading…
Reference in New Issue
Block a user