Closed jraviotta closed 3 years ago
@forceedge01 Success! Thanks for the help. If anyone else needs the secret sauce for Lando + Drupal + Behat + Chromedriver + behat-fail-aid, here it is:
## Composer.json
{
"require": {
"composer/installers": "^1.2",
"dmore/behat-chrome-extension": "^1.3",
"drupal/drupal-extension": "^4.1",
"symfony/finder": "~3.0|^4.4"
},
"config": {},
"require-dev": {
"genesis/behat-fail-aid": "^3.7"
}
}
##behat.yml
default:
suites:
default:
contexts:
- FeatureContext
- Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrushContext
- FailAid\Context\FailureContext
extensions:
FailAid\Extension:
screenshot:
directory: ./tests/screenshots/
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~
Behat\MinkExtension:
base_url: http://4pillars.lndo.site
goutte: ~
browser_name: chrome
sessions:
default:
chrome:
api_url: "http://chromedriver:4444/"
Drupal\DrupalExtension:
blackbox: ~
api_driver: 'drupal'
drush:
alias: '@lando.4pillars'
drupal:
drupal_root: '.'
## FeatureContext.php
<?php
use Behat\Behat\Tester\Exception\PendingException;
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
/**
* Defines application features from the specific context.
*/
class FeatureContext extends RawDrupalContext {
/**
* Initializes context.
*
* Every scenario gets its own context instance.
* You can also pass arbitrary arguments to the
* context constructor through behat.yml.
*/
public function __construct() {
}
PUBLIC FUNCTIONS REDACTED
}
## lando.yml: services
services:
appserver:
config:
php: .vscode/php.ini
build:
- composer install
- mkdir -p ~/.drush/site-aliases
- ln -sf /app/drush/4pillars.aliases.drushrc.php ~/.drush/site-aliases/4pilars.drushrc.php
overrides:
environment:
MINK_DRIVER_ARGS: '["chrome", null, "http://chromedriver:4444/wd/hub"]'
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", null, "http://chromedriver:4444/wd/hub"]'
MINK_DRIVER_CLASS: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver'
SIMPLETEST_DB: 'mysql://drupal:drupal@database/drupal'
SIMPLETEST_BASE_URL: 'https://4pillars.lndo.site/'
PHP_IDE_CONFIG: "serverName=appserver"
BEHAT_PARAMS: '{"extensions" : {"Behat\\MinkExtension" : {"base_url" : "http://appserver/"}, "Drupal\\DrupalExtension" : {"drush" : { "root": "." }}}}'
chromedriver:
type: compose
services:
image: robcherry/docker-chromedriver:latest
expose:
- "4444"
environment:
CHROMEDRIVER_WHITELISTED_IPS: ""
CHROMEDRIVER_URL_BASE: "/wd/hub"
security_opt:
- seccomp:unconfined
command: ["/usr/local/bin/supervisord", "-c", "/etc/supervisord.conf"]
That was easier than I expected. :)
@jraviotta glad you got it sorted.
Extra:
Given you're running your tests inside a container, the screenshots would be created inside the container and the path printed on the screen would be of the container rather than the host. You may want to give hostDirectory option a try to get you the correct path https://github.com/forceedge01/behat-fail-aid#hostdirectory-string so you may just cmd/ctrl + click on it to open it.
Cheers. Closing this issue.
@jraviotta you may want to open a new issue for this to discuss further, but what i've noticed so far from your setup is that your behat.yml extensions section doesn't have the failAid block in it to activate the extension. It does have the context which is fine. The default config suggested on the readme is:
Can you add the extension bit and try again? There may be other issues but one thing is clear, the extension isn't kicking in at all.
Originally posted by @forceedge01 in https://github.com/forceedge01/behat-fail-aid/issues/13#issuecomment-764680971
This post references a conversation started on a stale, closed post.