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

Implement the driver #1

Merged
merged 47 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4c0681c
First commit
uuf6429 Jun 10, 2023
ad14001
Enable phpunit bridge
uuf6429 Jun 12, 2023
6ede658
Reverted license change
uuf6429 Jun 12, 2023
c48e7fc
Improve workflow
uuf6429 Jun 12, 2023
d4ca830
Fix deprecation notice
uuf6429 Jun 12, 2023
40f600c
Remove unused flows/logic
uuf6429 Jun 12, 2023
0130058
Fix exception throwing conformance
uuf6429 Jun 13, 2023
b9f6b6f
Remove started prop"
uuf6429 Jun 13, 2023
e2c230d
Guard webDriver prop access
uuf6429 Jun 13, 2023
c5496ca
Disable param alignment
uuf6429 Jun 13, 2023
cc7683f
Remove continue-on-error
uuf6429 Jun 13, 2023
6196f75
Update test skipping
uuf6429 Jun 13, 2023
83f0029
More test skipping fixes
uuf6429 Jun 13, 2023
d30dac8
Add jetbrains attribute classes for dev
uuf6429 Jun 14, 2023
c62968e
Improve timeouts test
uuf6429 Jun 14, 2023
75afba4
Fix phpstan hints
uuf6429 Jun 14, 2023
7574b2b
Wrap errors when capturing throwables; fix deprecation notice
uuf6429 Jun 14, 2023
f153048
More phpstan fixes
uuf6429 Jun 14, 2023
d6f8755
Avoid fancy syntax
uuf6429 Jun 14, 2023
70826c5
Remove github secret; ignore indirect deprecations
uuf6429 Jun 14, 2023
d82433c
Remove redundant phpdoc
uuf6429 Jun 14, 2023
36ba41a
Update dep requirement; remove error wrapping
uuf6429 Jun 14, 2023
9d39c98
Add act comment
uuf6429 Jun 14, 2023
90a18c7
Reset window state
uuf6429 Jun 14, 2023
0fb929d
Use builtin classes
uuf6429 Jun 14, 2023
3044bf0
Compatibility fix
uuf6429 Jun 14, 2023
326aecb
Improve tests
uuf6429 Jun 14, 2023
580090e
Remove unused class; fix syntax error
uuf6429 Jun 14, 2023
92d5787
Declare arg types; use builtin classes; various fixes
uuf6429 Jun 15, 2023
386c9ae
Fix null arg problem; improve init capaibilities
uuf6429 Jun 15, 2023
d1d21ce
Remove inheritdoc
uuf6429 Jun 15, 2023
01a8a75
Each retry should not take longer than 10s
uuf6429 Jun 15, 2023
18ef913
Add a single test for edge
uuf6429 Jun 16, 2023
2130f2f
Fix edge default config
uuf6429 Jun 16, 2023
7a7e5c2
Simplify capabilities stuff
uuf6429 Jun 16, 2023
f2357b2
Minor fixes
uuf6429 Jun 16, 2023
c36a0dd
Remove redundant test
uuf6429 Jun 17, 2023
302fe66
Improve set/getValue
uuf6429 Jun 17, 2023
be08632
Fix syntax; improve code
uuf6429 Jun 17, 2023
b53f9a7
Fix and document regression
uuf6429 Jun 17, 2023
d385eed
Remove unofficial apis
uuf6429 Jun 18, 2023
c5edb42
A few CR fixes
uuf6429 Jul 11, 2023
6619d75
Ensure value for date/time field is a string
uuf6429 Sep 26, 2023
9730f54
MSEdge-specific fix
uuf6429 Sep 26, 2023
8855250
CR fixes
uuf6429 Sep 28, 2023
9a81918
Various workflow improvements (#1)
uuf6429 Sep 28, 2023
5f52680
CR fix
uuf6429 Sep 28, 2023
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ trim_trailing_whitespace = true

[.github/workflows/*.yml]
indent_size = 2

[*.php]
ij_php_align_multiline_parameters = false
17 changes: 10 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.editorconfig export-ignore
.gitattributes export-ignore
.github/ export-ignore
.gitignore export-ignore
phpstan*.neon export-ignore
phpunit.xml.dist export-ignore
tests/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/phpstan*.neon export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
/README.md export-ignore
/resources/get-syn.php export-ignore
/docker-compose.yaml export-ignore
37 changes: 32 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ jobs:
strategy:
matrix:
php: [ '7.4', '8.0', '8.1', '8.2' ]
browser: [ 'firefox', 'chrome' ]
selenium: [ '2.53.1', '3', '4' ]
include:
- php: '7.4'
browser: 'edge'
selenium: '4'
fail-fast: false

steps:
Expand All @@ -57,19 +63,40 @@ jobs:
run: |
composer update --no-interaction --prefer-dist --ansi --no-progress

- name: Start Selenium
run: |
SELENIUM_IMAGE=selenium/standalone-${{ matrix.browser }}:${{ matrix.selenium }} docker compose up --wait

- name: Wait for selenium to start
run: |
curl --retry 5 --retry-all-errors --retry-delay 1 --max-time 10 --head -X GET http://localhost:4444/wd/hub/status

- name: Run tests
env:
SELENIUM_VERSION: ${{ matrix.selenium }}
DRIVER_URL: http://localhost:4444/wd/hub
WEB_FIXTURES_HOST: http://host.docker.internal:8002
WEB_FIXTURES_BROWSER: ${{ matrix.browser }}
DRIVER_MACHINE_BASE_PATH: /fixtures/
run: |
vendor/bin/phpunit -v --coverage-clover=coverage.xml
vendor/bin/phpunit -v --coverage-clover=coverage.xml --colors=always --testdox

- name: Upload coverage
uses: codecov/codecov-action@v3
# See https://github.com/nektos/act#skipping-steps
if: ${{ !env.ACT }}
uuf6429 marked this conversation as resolved.
Show resolved Hide resolved
with:
files: coverage.xml

- name: Archive logs artifacts
- name: Extract docker logs
if: ${{ failure() }}
run: |
mkdir -p ./logs
docker compose logs --no-color &> ./logs/selenium.log

- name: Archive logs artifacts
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: logs_php-${{ matrix.php }}
path: |
logs
name: logs_php-${{ matrix.php }}_selenium-${{ matrix.selenium }}_${{ matrix.browser }}
path: logs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Latest Unstable Version](https://poser.pugx.org/mink/webdriver-classic-driver/v/unstable)](https://packagist.org/packages/mink/webdriver-classic-driver)
[![Total Downloads](https://poser.pugx.org/mink/webdriver-classic-driver/downloads)](https://packagist.org/packages/mink/webdriver-classic-driver)
[![CI](https://github.com/minkphp/webdriver-classic-driver/actions/workflows/ci.yml/badge.svg)](https://github.com/minkphp/webdriver-classic-driver/actions/workflows/ci.yml)
[![License](https://poser.pugx.org/mink/webdriver-classic-driver/license)](https://packagist.org/packages/mink/webdriver-classic-driver)
[![License](https://poser.pugx.org/mink/webdriver-classic-driver/license)](https://github.com/minkphp/webdriver-classic-driver/blob/main/LICENSE)
[![codecov](https://codecov.io/gh/minkphp/webdriver-classic-driver/branch/main/graph/badge.svg?token=11hgqXqod9)](https://codecov.io/gh/minkphp/webdriver-classic-driver)

## Installation
Expand Down
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@
],
"require": {
"php": ">=7.4",
"behat/mink": "^1.9@dev"
"ext-json": "*",
"behat/mink": "^1.11@dev",
"php-webdriver/webdriver": "^1.14"
},
"require-dev": {
"mink/driver-testsuite": "dev-master",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^9.6.8",
"symfony/error-handler": "^5.4 || ^6.0"
"symfony/error-handler": "^5.4 || ^6.0",
"jetbrains/phpstorm-attributes": "^1.0"
},
"autoload": {
"psr-4": {
Expand All @@ -30,7 +33,7 @@
},
"autoload-dev": {
"psr-4": {
"Mink\\WebdriverClassDriver\\Tests\\": "tests"
"Mink\\WebdriverClassDriver\\Tests\\": "tests/"
}
},
"extra": {
Expand Down
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3"

services:
selenium:
image: ${SELENIUM_IMAGE:-selenium/standalone-chrome:4}
hostname: selenium
shm_size: 4g
environment:
VNC_NO_PASSWORD: 1
SCREEN_WIDTH: 1024
SCREEN_HEIGHT: 768
volumes:
- /dev/shm:/dev/shm
- ./vendor/mink/driver-testsuite/web-fixtures:/fixtures
ports:
- "4444:4444"
# VNC Web Viewer port (new images)
- "7900:7900"
# VNC Server port (old "-debug" images)
- "5900:5900"
extra_hosts:
- host.docker.internal:host-gateway
18 changes: 11 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
colors="true"
bootstrap="vendor/autoload.php"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd">
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php"
beStrictAboutOutputDuringTests="true"
colors="true">
<coverage>
<include>
<directory>./src</directory>
Expand All @@ -18,15 +19,18 @@

<php>
<var name="driver_config_factory" value="Mink\WebdriverClassDriver\Tests\WebdriverClassicConfig::getInstance"/>
<!--server name="WEB_FIXTURES_HOST" value="http://test.mink.dev" /-->

<server name="WEB_FIXTURES_HOST" value="http://host.docker.internal:8002"/>
<!-- MacOS -->
<!--<server name="WEB_FIXTURES_HOST" value="http://docker.for.mac.localhost:8002"/>-->
<!--<server name="WEB_FIXTURES_BROWSER" value="firefox"/>-->

<!-- where driver will connect to -->
<server name="DRIVER_URL" value="http://localhost:4444/wd/hub"/>

<!-- where DocumentRoot of 'Test Machine' is mounted to on 'Driver Machine' (only if these are 2 different machines) -->
<!--server name="DRIVER_MACHINE_BASE_PATH" value="" /-->
<!--server name="TEST_MACHINE_BASE_PATH" value="" /-->
<server name="DRIVER_MACHINE_BASE_PATH" value="/fixtures/"/>

<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
Comment on lines 21 to +33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the defaults of this section would result in the developer's inability to run the test suite with a locally started Selenium server.

Copy link
Member Author

@uuf6429 uuf6429 Jul 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replied to this point already, but I guess it got somehow lost: #1 (comment)

That still stands, the recommended test setup is with docker, therefore the defaults are tailored for docker. In case developers want to customize this, they can easily create their own phpunit.xml (that won't be committed with the project).

</php>

<listeners>
Expand Down
38 changes: 38 additions & 0 deletions resources/get-syn.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* Simple script that updates syn.js by downloading it from NPM through Unpkg and attaches a file
* header comment. To switch to a different Syn version, just update $version variable appropriately.
*
* @codeCoverageIgnore
*/

$version = '0.15.0';

if ('cli' !== PHP_SAPI && 'phpdbg' !== PHP_SAPI) {
uuf6429 marked this conversation as resolved.
Show resolved Hide resolved
throw new RuntimeException('This script must be run from the command line.');
}

file_put_contents(
__DIR__ . '/syn.js',
sprintf(
<<<'JS'
/**
* Syn - Standalone Synthetic Event Library
*
* @generated by get-syn.php on %s
*
* @version %s
* @copyright 2014 Bitovi
* @license https://github.com/bitovi/syn/blob/master/LICENSE.md
*/

%s
JS,
date('r'),
$version,
file_get_contents("https://www.unpkg.com/syn@$version/dist/global/syn.js")
)
);

echo "Done.\n";
Loading