Skip to content

Commit

Permalink
MDL-66979 behat: Rename selenium config to webdriver
Browse files Browse the repository at this point in the history
The PHP WebDriver Mink Driver does not necessarily require Selenium. It
supports Selenium 3 upwards, and can be used directly with ChromeDriver,
EdgeDriver, SafariDriver, GeckoDriver, and others.

It therefore uses a slightly different configuraitno path.
  • Loading branch information
andrewnicols committed Jan 22, 2021
1 parent 50b9866 commit c96cde2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ default:
Behat\MinkExtension:
base_url: 'http://localhost:8000'
goutte: null
selenium2: null
webdriver: null
Moodle\BehatExtension:
moodledirroot: /Should/Change/To/Moodle/www/dir
steps_definitions: { }
18 changes: 9 additions & 9 deletions lib/behat/classes/behat_config_util.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,12 @@ protected function build_config($parallelruns = 0, $currentrun = 0) {
$parallelruns = $this->get_number_of_parallel_run();
}

$selenium2wdhost = array('wd_host' => 'http://localhost:4444/wd/hub');
$webdriverwdhost = array('wd_host' => 'http://localhost:4444/wd/hub');
// If parallel run, then set wd_host if specified.
if (!empty($currentrun) && !empty($parallelruns)) {
// Set proper selenium2 wd_host if defined.
// Set proper webdriver wd_host if defined.
if (!empty($CFG->behat_parallel_run[$currentrun - 1]['wd_host'])) {
$selenium2wdhost = array('wd_host' => $CFG->behat_parallel_run[$currentrun - 1]['wd_host']);
$webdriverwdhost = array('wd_host' => $CFG->behat_parallel_run[$currentrun - 1]['wd_host']);
}
}

Expand Down Expand Up @@ -525,7 +525,7 @@ protected function build_config($parallelruns = 0, $currentrun = 0) {
'Behat\MinkExtension' => array(
'base_url' => $CFG->behat_wwwroot,
'goutte' => null,
'selenium2' => $selenium2wdhost
'webdriver' => $webdriverwdhost
),
'Moodle\BehatExtension' => array(
'moodledirroot' => $CFG->dirroot,
Expand Down Expand Up @@ -688,7 +688,7 @@ protected function get_behat_profile($profile, $values) {
$behatprofileextension = array(
'extensions' => array(
'Behat\MinkExtension' => array(
'selenium2' => $seleniumconfig,
'webdriver' => $seleniumconfig,
)
)
);
Expand Down Expand Up @@ -948,11 +948,11 @@ public function get_behat_config_for_profile($profile, $values) {
$oldconfigvalues = array();
if (isset($values['extensions']['Behat\MinkExtension\Extension'])) {
$extensionvalues = $values['extensions']['Behat\MinkExtension\Extension'];
if (isset($extensionvalues['selenium2']['browser'])) {
$oldconfigvalues['browser'] = $extensionvalues['selenium2']['browser'];
if (isset($extensionvalues['webdriver']['browser'])) {
$oldconfigvalues['browser'] = $extensionvalues['webdriver']['browser'];
}
if (isset($extensionvalues['selenium2']['wd_host'])) {
$oldconfigvalues['wd_host'] = $extensionvalues['selenium2']['wd_host'];
if (isset($extensionvalues['webdriver']['wd_host'])) {
$oldconfigvalues['wd_host'] = $extensionvalues['webdriver']['wd_host'];
}
if (isset($extensionvalues['capabilities'])) {
$oldconfigvalues['capabilities'] = $extensionvalues['capabilities'];
Expand Down

0 comments on commit c96cde2

Please sign in to comment.