Skip to content

Commit

Permalink
FIX Update behat tests and add configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Aug 30, 2017
1 parent 1a9797c commit d934fbe
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 125 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ language: php
addons:
firefox: "31.0"

# Required for Behat, currently
dist: precise

env:
global:
- COMPOSER_ROOT_VERSION="4.0.x-dev"
Expand All @@ -17,9 +20,8 @@ matrix:
env: DB=PGSQL PHPUNIT_TEST=1
- php: 7.1
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
# @todo Fix behat
# - php: 7.0
# env: DB=MYSQL BEHAT_TEST=1
- php: 7.0
env: DB=MYSQL BEHAT_TEST=1

before_script:
- phpenv rehash
Expand All @@ -43,7 +45,7 @@ before_script:


script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/php/ flush=1; fi
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=framework/phpcs.xml.dist code/ tests/ ; fi
- if [[ $BEHAT_TEST ]]; then vendor/bin/behat @subsites; fi
Expand Down
27 changes: 27 additions & 0 deletions behat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
default:
suites:
subsites:
paths:
- %paths.modules.subsites%/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\CMS\Tests\Behaviour\LoginContext
- SilverStripe\CMS\Tests\Behaviour\ThemeContext
- SilverStripe\CMS\Tests\Behaviour\FixtureContext:
# Note: double indent for args is intentional
- %paths.modules.subsites%/tests/behat/features/files/

extensions:
SilverStripe\BehatExtension\MinkExtension:
default_session: selenium2
javascript_session: selenium2
selenium2:
browser: firefox

SilverStripe\BehatExtension\Extension:
screenshot_path: %paths.base%/artifacts/screenshots
bootstrap_file: "cms/tests/behat/serve-bootstrap.php"
115 changes: 0 additions & 115 deletions tests/behat/features/bootstrap/Context/FeatureContext.php

This file was deleted.

11 changes: 5 additions & 6 deletions tests/behat/features/preview-navigation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@ Feature: Preview navigation

Background:
Given a "subsite" "My subsite"
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"="=>Subsite.My subsite"
And a "page" "Other page" with "URLSegment"="other-page", "Content"="Other page content <form action='my-page'><input type='submit' value='Submit my form'></form>" and "Subsite"="=>Subsite.My subsite"
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" "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"
Given a "member" "Joe" belonging to "Admin Group" with "Email"="[email protected]" and "Password"="Password1"
And the "group" "Admin Group" has permissions "Full administrative rights"
And I log in with "[email protected]" and "Password1"

@javascript
Scenario: I can navigate the subsite preview
When I go to "admin"
And I select "My subsite" from "SubsitesSelect"
And I go to "admin/pages"
And I click on "My page" in the tree
And I wait for 3 seconds
And I set the CMS mode to "Preview mode"
And I follow "ahref" in preview
Then the preview contains "Other page content"
# We are already on the second page, submit the form to return to first one.
When I wait for 3 seconds
And I press "Submit my form" in preview
# We are already on the second page, submit the form to return to first one.
And I follow "Goto my page" in preview
Then the preview contains "My page content"

0 comments on commit d934fbe

Please sign in to comment.