Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion commands/web/behat
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,21 @@ if [ ! -f "bin/behat" ]; then
composer install
fi

# Run behat with the provided flags/arguments
# Signal to PHP-FPM (via shared filesystem) that behat is running, so settings.php
# can disable modules like captcha and antibot that block automated requests.
touch /var/www/html/web/.behat_testing
trap "rm -f /var/www/html/web/.behat_testing" EXIT INT TERM
bin/behat "$@"

# big_pipe
# Please use following php code in FeatureContext.php to deal with big_pipe module and failing tests:
#
# /** @BeforeSuite */
# public static function disableBigPipe(): void {
# \Drupal::service('module_installer')->uninstall(['big_pipe']);
# }
#
# /** @AfterSuite */
# public static function enableBigPipe(): void {
# \Drupal::service('module_installer')->install(['big_pipe']);
# }
14 changes: 14 additions & 0 deletions settings.local.devmode.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,17 @@
if (file_exists($project_settings)) {
include $project_settings;
}

// Prepare the environment for tests. The flag file is created by the
// ddev behat command and removed on exit, since env vars are not shared
// between the CLI process and PHP-FPM.
if (file_exists(DRUPAL_ROOT . '/.behat_testing')) {
// Disable captcha during Behat test runs.
$config['captcha.captcha_point.user_login_form']['status'] = FALSE;
// Enable aggregation
$config['system.performance']['css']['preprocess'] = TRUE;
$config['system.performance']['js']['preprocess'] = TRUE;
// Enable advagg.
$config['advagg.settings']['enabled'] = TRUE;
// @todo: Decide on cache-bins for tests
}
14 changes: 14 additions & 0 deletions settings.local.perfmode.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,17 @@
if (file_exists($project_settings)) {
include $project_settings;
}

// Prepare the environment for tests. The flag file is created by the
// ddev behat command and removed on exit, since env vars are not shared
// between the CLI process and PHP-FPM.
if (file_exists(DRUPAL_ROOT . '/.behat_testing')) {
// Disable captcha during Behat test runs.
$config['captcha.captcha_point.user_login_form']['status'] = FALSE;
// Enable aggregation
$config['system.performance']['css']['preprocess'] = TRUE;
$config['system.performance']['js']['preprocess'] = TRUE;
// Enable advagg.
$config['advagg.settings']['enabled'] = TRUE;
// @todo: Decide on cache-bins for tests
}