Last active
September 1, 2021 19:15
-
-
Save dustinleblanc/8d941565ed326126a5f6ccc472f14f4c to your computer and use it in GitHub Desktop.
Pantheon Build Tools with Lando Behat Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: some-site | |
recipe: pantheon | |
config: | |
framework: drupal8 | |
env: dev | |
site: some-site | |
id: some-uuid-string-here | |
drush: 8.3 | |
php: '7.3' | |
webroot: web | |
xdebug: true | |
services: | |
appserver: | |
overrides: | |
environment: | |
BEHAT_PARAMS: >- | |
{"extensions" : {"Behat\\MinkExtension" : {"base_url" : | |
"http://appserver_nginx/"}, "Drupal\\DrupalExtension" : {"drush" : { | |
"root": "/app/web" }}}} | |
qa: | |
type: compose | |
services: | |
image: quay.io/pantheon-public/build-tools-ci:6.x | |
user: root | |
ports: | |
- '9222' | |
command: "google-chrome --disable-gpu --headless --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 --no-sandbox </dev/null &>/dev/null &" | |
environment: | |
DEV_SITE_URL: https://dev-site-name.pantheonsite.io | |
MULTIDEV_SITE_URL: https://appserver_nginx | |
NODE_EXTRA_CA_CERTS: /user/.lando/certs/lndo.site.pem | |
tooling: | |
backstop: | |
service: qa | |
cmd: | |
- "backstop reference --config=.ci/test/visual-regression/backstopConfig.js" | |
- "backstop test --config=/app/.ci/test/visual-regression/backstopConfig.js" | |
behat: | |
service: qa | |
cmd: "/app/vendor/bin/behat -c /app/tests/behat/behat-lando.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# behat.yml file for testing locally with lando. | |
# | |
default: | |
suites: | |
default: | |
paths: | |
- %paths.base%/features | |
- %paths.base%/site-features | |
contexts: | |
- FeatureContext | |
- Drupal\DrupalExtension\Context\DrupalContext | |
- Drupal\DrupalExtension\Context\MinkContext | |
- Drupal\DrupalExtension\Context\MessageContext | |
- Drupal\DrupalExtension\Context\DrushContext | |
- FailAid\Context\FailureContext | |
extensions: | |
Behat\MinkExtension: | |
files_path: './data-files' | |
# base_url set by ENV | |
browser_name: chrome | |
sessions: | |
default: | |
chrome: | |
api_url: "http://qa:9222" | |
validate_certificate: false | |
Drupal\DrupalExtension: | |
blackbox: ~ | |
api_driver: 'drush' | |
drush: | |
root: '/app/web' | |
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~ |
Should I be setting a base_url here - it states #base_url set by ENV
- this is unclear to me.
I'm using this precise configuration but am getting this error:
Could not fetch version information from http://192.168.16.8:9222/json/version. Check if Chrome is running. See docs/troubleshooting.md if Chrome crashed unexpectedly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A Micro-improvement here would be to use the same behat.yml file that pantheon does.... but add a profile for pantheon and a profile for lando...
What this does is keeps yoru other parts of tests DRY. Specifically in this scenario you have to duplicate all the configuration for your contexts, paths, and any other settings (like selectors) across both behat yaml files. Using profiles lets you do the work once.
That said, I culdn't figure out a way to NOT have to duplicate pretty much everything under Behat\MikeExtension in the profile settings... See https://gist.github.com/generalredneck/9091aa83f3e4deac97daa6044653e49d/revisions for the changes I would make
Edit:
Pro Tip: Make sure you double check your
$settings['trusted_host_patterns']
. It might not likeappserver_nginx
out of the box.