diff --git a/CHANGELOG.md b/CHANGELOG.md index 16ac8af..671384b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# Version 1.2.2 + +* Remove force W3c option for chrome because Lambdatest does not support: ` Could not open connection: w3c is not a valid option in chromeOptions capability, please refer to capability generator https://www.lambdatest.com/capabilities-generator or contact support` (2021, 24 june). +* Accept two event type on SessionStateListener. +* Remove `chromeOptions` array if empty. + # Version 1.2.1 * Add content in error message when check concurency. diff --git a/README.md b/README.md index acef9ef..d0af086 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,11 @@ This Behat extension provide a Mink Selenium2 Extension integration for [Lambdatest SaaS](https://lambdatest.com). +Tested browser : + +* Firefox 88+ +* Chrome 90+ +* Safari 13+ ## Installation diff --git a/src/Driver/LambdatestFactory.php b/src/Driver/LambdatestFactory.php index a75f986..3f3e1d2 100644 --- a/src/Driver/LambdatestFactory.php +++ b/src/Driver/LambdatestFactory.php @@ -81,9 +81,17 @@ public function buildDriver(array $config) if ($browser === WebDriverBrowserType::CHROME && isset($capabilities['chromeOptions']) === true && isset($capabilities['chromeOptions']['w3c']) === true && - $chromeW3c !== null && $capabilities['chromeOptions']['w3c'] !== $chromeW3c) { + //Restore the configuration value $capabilities['chromeOptions']['w3c'] = $chromeW3c; + //If no option in behat configuration, remove option + if ($chromeW3c === null) { + unset($capabilities['chromeOptions']['w3c']); + } + } + + if (\array_key_exists('chromeOptions', $capabilities) && \count($capabilities['chromeOptions']) === 0) { + unset($capabilities['chromeOptions']); } $def->setArgument(1, $capabilities); diff --git a/src/Listener/SessionStateListener.php b/src/Listener/SessionStateListener.php index b0028eb..c0b542a 100644 --- a/src/Listener/SessionStateListener.php +++ b/src/Listener/SessionStateListener.php @@ -5,6 +5,7 @@ namespace Macintoshplus\Lambdatest\Listener; use Behat\Mink\Mink; +use Behat\Testwork\EventDispatcher\Event\AfterExerciseAborted; use Behat\Testwork\EventDispatcher\Event\AfterExerciseCompleted; use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted; use Macintoshplus\Lambdatest\Driver\LambdatestWebDriver; @@ -43,11 +44,19 @@ public static function getSubscribedEvents() ]; } - /* - * Define the session test state for all lambdatest session + /** + * Define the session test state for all lambdatest session. + * + * @param \Behat\Testwork\EventDispatcher\Event\AfterExerciseAborted|\Behat\Testwork\EventDispatcher\Event\AfterExerciseCompleted $event */ - public function tearDownMinkSessions(AfterExerciseCompleted $event) + public function tearDownMinkSessions($event) { + if ( + $event instanceof AfterExerciseCompleted === false && + $event instanceof AfterExerciseAborted === false + ) { + return; + } foreach ($this->javascriptsSessions as $sessionName) { if ($this->mink->hasSession($sessionName) === false) { continue;