Skip to content

Commit

Permalink
Merge pull request #453: Behat tests improvements.
Browse files Browse the repository at this point in the history
* pr-453: (29 commits)
  [Behat] using chromedriver --lang=en tags to force english language during behat tests
  [Behat] added documentation to perform skipped tests
  [CI] removed @skip-travis tags when running behat tests
  [Behat] using @mail and @social-profile tags to skip behat tests
  [Behat] using zf3 route name to visit all available url
  [CI] added phpunit test for install also fix behat exclude dir configuration
  [Install] fix error when running test in separate process
  [Behat] improved behat tests documentation
  [CI] try to fix phpunit test fatal error when passthru "git describe" in travis environment
  [CI] try to fix phpunit test fatal error when passthru "git describe" in travis environment
  [CI] try to fix phpunit test fatal error when passthru "git describe" in travis environment
  [CI] try to fix phpunit test fatal error when exec command `git describe` in travis environment
  [CI] removed chrome driver download command
  [CI] changed phpunit run command
  [CI] increase php memory limit for travis environment
  [Behat] exclude behat from code coverage
  improved travis to use cache during build
  [Behat] improved behat tests documentation
  [Behat] fixed all todo tests to be included in travis environment
  [Install] provided behat install feature, to test Install module, fix #452
  ...
  • Loading branch information
TiSiE committed Jan 22, 2018
2 parents dce9eab + 06c77d0 commit 9709202
Show file tree
Hide file tree
Showing 32 changed files with 613 additions and 273 deletions.
19 changes: 9 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
language: php

php:
- "5.6"

services:
- mongodb

cache:
directories:
- "$HOME/.composer/cache"
- "$HOME/.npm"

env:
- PECLMONGO=mongo-1.6.10

before_install:
- sudo apt-get update > /dev/null
- "mongo --eval 'db.runCommand({setParameter: 1, textSearchEnabled: true})' admin"
# setup xvfb to be used by selenium
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1680x1050x16
- export DISPLAY=:99

install:
# install php packages required for running YAWIK phpunit tests
Expand Down Expand Up @@ -41,19 +44,15 @@ before_script:
- ./composer.phar install --dev

# setup display, behat, and selenium
- "wget http://chromedriver.storage.googleapis.com/2.33/chromedriver_linux64.zip -O chromedriver.zip && unzip chromedriver.zip && sudo mv chromedriver /usr/bin"
- ./vendor/bin/selenium-server-standalone -Dwebdriver.chrome.driver=/usr/bin/chromedriver > /dev/null 2>&1 &
- ./bin/start-selenium.sh > /dev/null 2>&1 &
- sleep 5
- APPLICATION_ENV=development php -S localhost:8000 -t public public/index.php > /dev/null 2>&1 &
- sleep 3


script:
- ln -s ../test/build/logs build
- cd test
- ./phpunit --configuration $TRAVIS_BUILD_DIR/test/phpunit.xml.dist
- cd $TRAVIS_BUILD_DIR
- APPLICATION_ENV=development ./vendor/bin/behat --strict --no-interaction -f progress --tags="@javascript && ~@todo && ~@skip-travis"
- ./vendor/bin/phpunit -c test
- APPLICATION_ENV=development ./vendor/bin/behat --strict --no-interaction

after_script:
- cd $TRAVIS_BUILD_DIR
Expand Down
1 change: 1 addition & 0 deletions .travis/phpenv.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

extension="mongo.so"
memory_limit=512M
20 changes: 12 additions & 8 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

default:
formatters:
pretty:
progress:
verbose: true
paths: false
extensions:
Expand All @@ -13,8 +13,10 @@ default:
screenshot: true

Behat\MinkExtension:
files_path: "%paths.base%/module/Behat/resources/fixtures/"
# change this base url value to match
# your local development server url:
base_url: "http://localhost:8000"
files_path: "%paths.base%/module/Behat/resources/fixtures/"
javascript_session: chrome
sessions:
chrome:
Expand All @@ -26,25 +28,27 @@ default:
version: ""
chrome:
switches:
- "start-maximized"
- "start-fullscreen"
- "no-sandbox"
- "--headless"
- "--disable-gpu"
- "--window-size=2000,2000"
- "--lang=en"
show_auto: false

gherkin:
filters:
tags: "~@todo && ~@cli" # CLI is excluded as it registers an error handler that mutes fatal errors
tags: "~@mail && ~@social-profile"

suites:
user:
contexts:
- Behat\MinkExtension\Context\MinkContext
- Yawik\Behat\CoreContext
- Yawik\Behat\OrganizationContext
- Yawik\Behat\UserContext
- Yawik\Behat\SettingsContext
- Yawik\Behat\Select2Context
- Yawik\Behat\UserContext
- Yawik\Behat\JobContext
- Yawik\Behat\ApplicationContext
- Yawik\Behat\SummaryFormContext
- Yawik\Behat\CvContext
- Yawik\Behat\CvContext
- Yawik\Behat\InstallContext
5 changes: 5 additions & 0 deletions bin/start-selenium.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

# A script to start selenium browser for browser testing with behat

vendor/bin/selenium-server-standalone -p 4444 -Dwebdriver.chrome.driver="./vendor/bin/chromedriver"
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@
"imagine/imagine": "*",
"zendframework/zend-progressbar": "^2.5",
"zendframework/zend-math": "^3.0",
"zendframework/zend-captcha": "^2.7",
"behat/mink-extension": "2.2"
"zendframework/zend-captcha": "^2.7"
},
"require-dev": {
"cbleek/pecl-solr-hint": "dev-master",
Expand All @@ -80,7 +79,9 @@
"friends-of-behat/context-service-extension": "^0.3.0",
"friends-of-behat/cross-container-extension": "^0.3.0",
"friends-of-behat/service-container-extension": "^0.3.0",
"novaway/common-contexts": "dev-master"
"novaway/common-contexts": "dev-master",
"enm1989/chromedriver": "^2.35",
"behat/mink-extension": "^2.3"
},
"scripts": {
"post-install-cmd": [
Expand Down
Loading

0 comments on commit 9709202

Please sign in to comment.