Instructions are similar to the ones on behat drupal extension
To use javascript, add selenium arknold
cd ~
sudo ansible-galaxy install arknoll.selenium
platform branch behat
git commit --allow-empty "branch behat created"
git push bitbucket
platform snapshot:create
create a file named behat.yml and add it to web app root with the following code. Add base_url for specific environments
-
suites: default: contexts: - FeatureContext - Drupal\DrupalExtension\Context\DrupalContext - Drupal\DrupalExtension\Context\MinkContext extensions: Behat\MinkExtension: goutte: ~ selenium2: ~ #base_url: https://baseurl.com Drupal\DrupalExtension: blackbox: ~ api_driver: 'drupal' drush: alias: 'local' drupal: drupal_root: 'web' region_map: footer: "#footer"
on platform.sh root folder .environment, add the following command which will create a base_url for each branch created. In this way, we can run behat on every branch without the need of change base_url
#export parameters to behat.yml by jmo
export BEHAT_PARAMS='{"extensions" : {"Behat\\MinkExtension" : {"base_url" : "http://'$PLATFORM_ENVIRONMENT'-'$PLATFORM_PROJECT'.us.platform.sh/"}, "Drupal\\DrupalExtension" : {"drush" : { "alias": "@drupal.'$PLATFORM_BRANCH'" }}}}'
composer require guzzlehttp/guzzle
composer config bin-dir
behat --ini
behat -dl
cd ~
ln -s /var/www/drupalvm/drupal/vendor/behat/behat/bin/behat /var/www/drupalvm/drupal/config/behat
cd drupalvm/drupal/config/behat
behat --dl
behat --help
Feature: Test DrupalContext
In order to prove the Behat is working correctly in Drupal VM
As a developer
I need to run a simple interface test
Scenario: Viewing homepage
Given I am on the homepage
Then I should see "Welcome to Drupal"
platform build
behat
Push code to platform.sh and run $behat. If all works, merge the branch into master