MDL-78934 behat: Move to BrowserKit in extension and other custom code

This commit is contained in:
Eloy Lafuente (stronk7)
2023-08-18 13:59:17 +02:00
parent 11b7ff678d
commit 7d37b29248
7 changed files with 14 additions and 6 deletions
+8
View File
@@ -1,10 +1,18 @@
This files describes API changes in the tool_behat code.
=== 4.3 ===
* The goutte behat mink driver has been replaced by the browserkit one because the former has been abandoned. The change should
be completely transparent for (near) everybody. Only if you are using some custom-generated behat.yml file or other configuration
alternatives different from the Moodle default one, then, any "goutte" browser occurrence needs to be changed to "browserkit_http"
when configuring the behat mink extension. See MDL-78934 for more details and changes applied.
=== 4.2 ===
* 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.
=== 2.7 ===
* Constants behat_base::cap_allow, behat_base::cap_prevent and
behat_base::cap_prohibit have been removed in favour of the
+1 -1
View File
@@ -6,7 +6,7 @@ default:
extensions:
Behat\MinkExtension:
base_url: 'http://localhost:8000'
goutte: null
browserkit_http: null
webdriver: null
Moodle\BehatExtension:
moodledirroot: /Should/Change/To/Moodle/www/dir
+1 -1
View File
@@ -552,7 +552,7 @@ class behat_config_util {
'extensions' => array(
'Behat\MinkExtension' => array(
'base_url' => $CFG->behat_wwwroot,
'goutte' => null,
'browserkit_http' => null,
'webdriver' => $webdriverwdhost
),
'Moodle\BehatExtension' => array(
+1 -1
View File
@@ -528,7 +528,7 @@ trait behat_session_trait {
* @return boolean
*/
protected static function running_javascript_in_session(Session $session): bool {
return get_class($session->getDriver()) !== 'Behat\Mink\Driver\GoutteDriver';
return get_class($session->getDriver()) !== 'Behat\Mink\Driver\BrowserKitDriver';
}
/**
@@ -230,7 +230,7 @@ class MoodleScreenshotFormatter implements Formatter {
protected function take_screenshot(AfterStepTested $event, $context) {
// Goutte can't save screenshots.
if ($context->getMink()->isSessionStarted($context->getMink()->getDefaultSessionName())) {
if (get_class($context->getMink()->getSession()->getDriver()) === 'Behat\Mink\Driver\GoutteDriver') {
if (get_class($context->getMink()->getSession()->getDriver()) === 'Behat\Mink\Driver\BrowserKitDriver') {
return false;
}
list ($dir, $filename) = $this->get_faildump_filename($event, 'png');
+1 -1
View File
@@ -203,7 +203,7 @@ class behat_form_field implements behat_session_interface {
* @return bool
*/
protected function running_javascript() {
return get_class($this->session->getDriver()) !== 'Behat\Mink\Driver\GoutteDriver';
return get_class($this->session->getDriver()) !== 'Behat\Mink\Driver\BrowserKitDriver';
}
/**
+1 -1
View File
@@ -310,7 +310,7 @@ EOF;
* @BeforeScenario @~javascript
* @param BeforeScenarioScope $scope scope passed by event fired before scenario.
*/
public function before_goutte_scenarios(BeforeScenarioScope $scope) {
public function before_browserkit_scenarios(BeforeScenarioScope $scope) {
if ($this->running_javascript()) {
// A bug in the BeforeScenario filtering prevents the @~javascript filter on this hook from working
// properly.