Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests also with Selenium 3.x #354

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@ 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:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1

Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -59,14 +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
path: logs
7 changes: 6 additions & 1 deletion src/Selenium2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
8 changes: 0 additions & 8 deletions tests/Custom/TimeoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down