From 87e620344a60333bb086b984dea05142f18207e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 18 Apr 2022 09:41:11 +0200 Subject: [PATCH 1/4] Run tests also with Selenium 3.x --- .github/workflows/tests.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 08cd06e5..940ece36 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,18 +7,17 @@ on: env: DRIVER_URL: "http://localhost:4444/wd/hub" -defaults: - run: - shell: bash - jobs: - tests: name: Tests runs-on: ubuntu-20.04 strategy: matrix: - php: [ '7.2', '7.3', '7.4', '8.0', '8.1' ] + selenium: [ '3.141.59' ] + php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] + include: + - selenium: '2.53.1' + php: 'latest' fail-fast: false steps: @@ -33,8 +32,7 @@ jobs: coverage: "xdebug" php-version: "${{ matrix.php }}" tools: composer - # PHP 7.1 development web server segfaults if timezone not set. - ini-values: date.timezone=Europe/Paris, error_reporting=-1, display_errors=On + ini-values: error_reporting=-1, display_errors=On - name: Install dependencies run: | @@ -47,7 +45,7 @@ jobs: - name: Start Selenium run: | - docker run --net host --name selenium --volume /dev/shm:/dev/shm --shm-size 2g selenium/standalone-firefox:2.53.1 &> ./logs/selenium.log & + docker run --net host --name selenium --volume /dev/shm:/dev/shm --shm-size 2g "selenium/standalone-firefox:${{ matrix.selenium }}" &> ./logs/selenium.log & - name: Wait for browser & PHP to start run: | @@ -68,5 +66,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: logs_php-${{ matrix.php }} - path: | - logs + path: logs From 3d1c8d1da2f52f68933052b0018e773a3fe510f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sun, 23 Oct 2022 16:55:29 +0200 Subject: [PATCH 2/4] Fix switchToWindow for Selenium 3.x and Firefox (Chrome is always ok) --- src/Selenium2Driver.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index ee7f2e75..af083a67 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -415,7 +415,12 @@ public function back() */ public function switchToWindow($name = null) { - $this->wdSession->focusWindow($name ?: ''); + if ($name === null) { + $handles = $this->wdSession->window_handles(); + $name = reset($handles); + } + + $this->wdSession->focusWindow($name); } /** From 8c09245415b4d97b0747924704eead9cabf5e36a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sun, 23 Oct 2022 19:15:33 +0200 Subject: [PATCH 3/4] Drop invalid timeout test depending on specific WD impl --- tests/Custom/TimeoutTest.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/Custom/TimeoutTest.php b/tests/Custom/TimeoutTest.php index 9a80de3e..dca7154f 100644 --- a/tests/Custom/TimeoutTest.php +++ b/tests/Custom/TimeoutTest.php @@ -24,14 +24,6 @@ protected function resetSessions() parent::resetSessions(); } - public function testInvalidTimeoutSettingThrowsException() - { - $this->expectException('\Behat\Mink\Exception\DriverException'); - $this->getSession()->start(); - - $this->getSession()->getDriver()->setTimeouts(array('invalid' => 0)); - } - public function testShortTimeoutDoesNotWaitForElementToAppear() { $this->getSession()->getDriver()->setTimeouts(array('implicit' => 0)); From e84a2583a34fdee6c2462fe73b7b740d7ecbecbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 24 Oct 2022 00:52:27 +0200 Subject: [PATCH 4/4] Update GH Actions images to fix node 12 warnings --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 940ece36..25c8bd37 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 1 @@ -57,13 +57,13 @@ jobs: vendor/bin/phpunit -v --coverage-clover=coverage.xml - name: Upload coverage - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: files: coverage.xml - name: Archive logs artifacts if: ${{ failure() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: logs_php-${{ matrix.php }} path: logs