diff --git a/admin/tool/behat/cli/init.php b/admin/tool/behat/cli/init.php index ce09a1cf5c7..6c665db7395 100644 --- a/admin/tool/behat/cli/init.php +++ b/admin/tool/behat/cli/init.php @@ -49,7 +49,8 @@ list($options, $unrecognized) = cli_get_params( 'torun' => 0, 'optimize-runs' => '', 'add-core-features-to-theme' => false, - 'axe' => false, + 'axe' => '', + 'no-axe' => false, 'disable-composer' => false, 'composer-upgrade' => true, 'composer-self-update' => true, @@ -69,7 +70,7 @@ Behat utilities to initialise behat tests Usage: php init.php [--parallel=value [--maxruns=value] [--fromrun=value --torun=value]] - [--axe] [-o | --optimize-runs] [-a | --add-core-features-to-theme] + [--no-axe] [-o | --optimize-runs] [-a | --add-core-features-to-theme] [--no-composer-self-update] [--no-composer-upgrade] [--disable-composer] [--help] @@ -79,7 +80,7 @@ Options: -m, --maxruns Max parallel processes to be executed at one time --fromrun Execute run starting from (Used for parallel runs on different vms) --torun Execute run till (Used for parallel runs on different vms) ---axe Include axe accessibility tests +--no-axe Disable axe accessibility tests. -o, --optimize-runs Split features with specified tags in all parallel runs. @@ -110,6 +111,14 @@ if (!empty($options['help'])) { exit(0); } +if (!empty($options['axe'])) { + echo "Axe accessibility tests are enabled by default, to disable them, use the --no-axe option.\n"; +} + +if (!empty($options['no-axe'])) { + echo "Axe accessibility tests have been disabled.\n"; +} + // Check which util file to call. $utilfile = 'util_single_run.php'; $commandoptions = ""; @@ -127,6 +136,7 @@ if ($options['parallel'] && $options['parallel'] > 1) { $cmdoptionsforsinglerun = [ 'add-core-features-to-theme', 'axe', + 'no-axe', ]; foreach ($cmdoptionsforsinglerun as $option) { diff --git a/admin/tool/behat/cli/util.php b/admin/tool/behat/cli/util.php index f2649cd4f53..c13116977e9 100644 --- a/admin/tool/behat/cli/util.php +++ b/admin/tool/behat/cli/util.php @@ -57,7 +57,8 @@ list($options, $unrecognized) = cli_get_params( 'torun' => 0, 'optimize-runs' => '', 'add-core-features-to-theme' => false, - 'axe' => false, + 'axe' => '', + 'no-axe' => false, ), array( 'h' => 'help', @@ -73,7 +74,7 @@ $help = " Behat utilities to manage the test environment Usage: - php util.php [--install|--drop|--enable|--disable|--diag|--updatesteps|--axe|--help] [--parallel=value [--maxruns=value]] + php util.php [--install|--drop|--enable|--disable|--diag|--updatesteps|--no-axe|--help] [--parallel=value [--maxruns=value]] Options: --install Installs the test environment for acceptance tests @@ -82,7 +83,7 @@ Options: --disable Disables test environment --diag Get behat test environment status code --updatesteps Update feature step file. ---axe Include axe accessibility tests +--no-axe Disable axe accessibility tests. -j, --parallel Number of parallel behat run operation -m, --maxruns Max parallel processes to be executed at one time. diff --git a/admin/tool/behat/cli/util_single_run.php b/admin/tool/behat/cli/util_single_run.php index 5727e5b8f12..ca0d5a61ac3 100644 --- a/admin/tool/behat/cli/util_single_run.php +++ b/admin/tool/behat/cli/util_single_run.php @@ -52,7 +52,8 @@ list($options, $unrecognized) = cli_get_params( 'updatesteps' => false, 'optimize-runs' => '', 'add-core-features-to-theme' => false, - 'axe' => false, + 'axe' => '', + 'no-axe' => false, ), array( 'h' => 'help', @@ -79,7 +80,7 @@ Options: --disable Disables test environment --diag Get behat test environment status code --updatesteps Update feature step file. ---axe Include axe accessibility tests +--no-axe Disable axe accessibility tests. -o, --optimize-runs Split features with specified tags in all parallel runs. -a, --add-core-features-to-theme Add all core features to specified theme's @@ -186,8 +187,11 @@ if ($options['install']) { behat_config_manager::set_behat_run_config_value('behatsiteenabled', 1); } - // Define whether to run Behat with axe tests. - behat_config_manager::set_behat_run_config_value('axe', $options['axe']); + // Always run Behat with axe tests. + if (!$options['no-axe']) { + behat_config_manager::set_behat_run_config_value('axe', true); + } + // Enable test mode. $timestart = microtime(true); diff --git a/admin/tool/behat/upgrade.txt b/admin/tool/behat/upgrade.txt index 36b1184c2bd..f765fb70c41 100644 --- a/admin/tool/behat/upgrade.txt +++ b/admin/tool/behat/upgrade.txt @@ -1,5 +1,7 @@ This files describes API changes in the tool_behat code. +=== 4.1.4 === +* Behat is initialised with Axe accessibility tests enabled by default, if you want to disable them please use the --no-axe option. === 3.7 === * Behat will now look for behat step definitions in the current theme and any parents the theme may have.