Skip to content

Commit

Permalink
Merge pull request #1 from uuf6429/first-commit
Browse files Browse the repository at this point in the history
Implement the driver
  • Loading branch information
stof authored Dec 9, 2023
2 parents 9d832d8 + 5f52680 commit 3a116f9
Show file tree
Hide file tree
Showing 14 changed files with 4,417 additions and 32 deletions.
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 }}
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"/>
</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) {
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

0 comments on commit 3a116f9

Please sign in to comment.