diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5318b1db..f863f93b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,10 +50,8 @@ jobs: strategy: matrix: php: [ '8.1', '8.2', '8.3' ] - # 2.53.1 - version the original package was using for tests - # 3 - last version of 3 # 4.1.2-20220227 - last known working version of 4 where the modifications to this package weren't needed - selenium: ['2.53.1', '3', '4.1.2', 'latest'] + selenium: ['4.1.2', 'latest'] fail-fast: false steps: @@ -91,11 +89,7 @@ jobs: - name: Run tests run: | - if [ "${{ matrix.selenium }}" == "latest" ] || [ "${{ matrix.selenium }}" == "4.1.2" ]; then - ./vendor/bin/phpunit -v --coverage-clover=coverage.xml - else - DRIVER_URL="http://localhost:4444/wd/hub" ./vendor/bin/phpunit -v --coverage-clover=coverage.xml - fi + ./vendor/bin/phpunit -v --coverage-clover=coverage.xml - name: Upload coverage uses: codecov/codecov-action@v2 diff --git a/composer.json b/composer.json index 172f97ef..9d2e51b8 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "php": ">=7.2", "ext-json": "*", "behat/mink": "^1.11@dev", - "lullabot/php-webdriver": "^2.0" + "lullabot/php-webdriver": "^2.0.5" }, "require-dev": { "mink/driver-testsuite": "dev-master", diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index 058af02c..3fcfe28d 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -422,6 +422,18 @@ public function stop() public function reset() { + $windows = $this->getWindowNames(); + // Remove the main window from the list of windows. + array_shift($windows); + + foreach ($windows as $name) { + $this->switchToWindow($name); + $this->getWebDriverSession()->window()->close(); + } + + // Ensure the main window is active. + $this->switchToWindow(); + $this->getWebDriverSession()->deleteAllCookies(); }