su-sws / linky_clicky
Behat tests mean death to linky-clicky.
Installs: 34
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 38
Forks: 3
Open Issues: 10
Language:Gherkin
Type:project
Requires
- behat/behat: ~3.3
- behat/mink: ^1.7.0
- behat/mink-goutte-driver: ^1.2.1
- behat/mink-selenium2-driver: ^1.3
- drupal/drupal-driver: ^1.2.1
- drupal/drupal-extension: ~3.4
- emuse/behat-html-formatter: ~0.1
- psr/log: *
- weavora/mink-extra-context: dev-master
- 6.x-dev
- 5.x-dev
- 4.x-dev
- dev-dependabot/composer/guzzlehttp/psr7-1.9.1
- dev-dependabot/composer/twig/twig-1.44.7
- dev-dependabot/composer/guzzlehttp/guzzle-6.5.8
- dev-SITES-1140
- dev-5.x-featured-blocks
- dev-6.x-SITES-831-ACSF-d.o-CJW
- dev-5.x-SOE-3065-credits-hotfix
- dev-SITES-528
- dev-socorro
- dev-DEVOPS-123
- dev-BexBehatScreenshotExtension
- dev-jbickar-patch-N
- dev-weblogin
- dev-paranoiafix
- dev-BASIC-2385/caleb
- dev-5.x-soe-and-i-wait
- dev-soe-redesign-menu
- dev-5.x-rm-outlines
- dev-paragraphs
- dev-test-imgur-api
- dev-remove_masonry_news
- dev-soe-redesign-cj
- dev-HSDO-922-slideshow
- dev-5.x-blt
- dev-HSDO-957-views-selective-filters
- dev-DEVOPS-99
- dev-capx-testing
- dev-sse-redesign
- dev-jse-audit
- dev-stanford_sites_helper_7_x_1_7
- dev-jbickar-patch-1
- dev-login
- dev-version-tests
- dev-stanford-jumpstart-deployer
- dev-lbre
- dev-CAW-752
- dev-shoov
- dev-stanford_courses
- dev-BASIC-1671
- dev-hsdo167
- dev-behat3
- dev-jsvpsa.stanford_gallery.feature
This package is auto-updated.
Last update: 2024-11-19 22:09:50 UTC
README
Behat tests mean death to linky-clicky!
Installation
You can either copy the values from the composer.json file to your local file or you can compile here. The files and directories that composer creates will be .gitignore'd
composer install
If you install locally there should be a bin/behat
executable for you. You can
either point your system to that behat install or use it in some other way.
Updating an Existing Project from branch behat3
Todo
- Update behat.yml paths
- Update behat.local.yml paths
- Update symlinks from features/bootstrap
- Update symlinks that were to shared tests eg: includes/jumpstart_home
Updating an Existing Project from Behat 1.0
If you have a behat.local.yml
file (which is not tracked by git), update it to match the syntax in behat.local.yml.default
. Specifically:
Behat\MinkExtension\Extension
will need to be changed toBehat\MinkExtension
Drupal\DrupalExtension\Extension
will need to be changed toDrupal\DrupalExtension
Otherwise, you may get an error like:
[Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]
`Behat\MinkExtension\Extension` extension file or class could not be located.
Creating a new project
When creating a set of testing features for a new site, create a new directory for that site. Copy behat.yml.default
and behat.local.yml.default
into the root of that directory and rename them to behat.yml
and behat.local.yml
, respectively. Edit the "base_url" and the drush "alias" values to match the site you are testing.
behat.yml
imports the files at includes/extensions/*
and includes/config
behat.local.yml
is ignored by git.
Create a features
directory and place your *.feature
files in that directory.
Create a features/bootstrap
directory, copy FeatureContext.php.default
into there, and rename it FeatureContext.php
In the features/bootstrap
directory, create a symbolic link for each of the following files.
- SWSFeatureContext.php -> includes/bootstrap/SWSFeatureContext.php
- SWSDrupalContext.php -> includes/bootstrap/SWSDrupalContext.php
- SWSMinkContext.php -> includes/bootstrap/SWSMinkContext.php
The default FeatureContext.php
file is where you can put your site specific step definitions.
The SWSFeatureContext.php
file is where all of the custom shared step definitions are stored. Behat 3 does not allow for sub contexts anymore and references to the DrupalContext and MinkContext are saved in variables in this file.
The SWSDrupalContext.php
file is the DrupalExtention DrupalContext override file and contains an override of the Drupal login step, which is necessary because WMD hides the user login form in a collapsible fieldset.
The SWSMinkContext.php
file is the DrupalExtension MinkContext override file that contains an extra function.
There are a number of starter or common feature tests you can use in your new project at includes/features
. Simply copy these into your new projects features folder and start editing them to fit your new site or product.
Formatters
The formatters and syntax that comes with Behat 3 has changed. By default Behat 3 no longer comes with an html output option. Included in the composer build is an HTML formatter for behat but it needs to be configured in your behat.local.yml file or passed to the behat function through the command link with a number of parameters.
See: https://github.com/dutchiexl/BehatHtmlFormatterPlugin and: http://docs.behat.org/en/latest/guides/7.run.html
Directory structure
sitename
|--behat.yml
|--behat.local.yml
|--features
|--featurename.feature
|--bootstrap
|--FeatureContext.php
|--SWSFeatureContext.php
|--SWSDrupalContext.php
|--SWSMinkContext.php
git-crypt
Some files in this repository are encrypted with git-crypt. For instructions on how to decrypt these files, see the directions on SWS Confluence (authentication required).
Travis Integration
CAPx
Included is a custom step definition for CAPx credentials. To use this definition in travis-ci.org, go to settings of the repository to be tested withint travis-ci.org. Add two environment variables "CAPX_USER" and "CAPX_PASSWORD". Verify the values are not displayed in the log report. Then in the behat tests, use the step definition "Given I am authenticated with CAPx". This will track existing credentials and encrypt the new credentials from the travis environment variables. This will only set the variables. Any additional testing may require organization codes to be updated during the test.
See Also
See [Using Linky Clicky] (https://github.com/SU-SWS/linky_clicky/blob/5.x/UsingLinkyClicky.md)
See [Running Linky Clicky] (https://github.com/SU-SWS/linky_clicky/blob/5.x/RunningLinkyClicky.md)