Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
uuf6429 committed Jun 11, 2023
1 parent 0640cc2 commit 1ea3c8b
Show file tree
Hide file tree
Showing 17 changed files with 4,707 additions and 30 deletions.
16 changes: 10 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.editorconfig export-ignore
.gitattributes export-ignore
.github/ export-ignore
.gitignore export-ignore
phpunit.xml.dist export-ignore
tests/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
/LICENSE.md export-ignore
/README.md export-ignore
/resources/get-syn.php export-ignore
/docker-compose.yaml export-ignore
34 changes: 28 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,61 @@ jobs:
tests:
name: Tests
runs-on: ubuntu-latest
# We cannot trigger events in old chrome, so we allow the run to fail
continue-on-error: ${{ matrix.browser == 'chrome' && matrix.selenium == '2.53.1' }}
strategy:
matrix:
php: [ '7.4', '8.0', '8.1', '8.2' ]
browser: [ 'firefox', 'chrome' ]
selenium: [ '2.53.1', '3', '4' ]
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Start Selenium
run: |
mkdir -p ./logs
SELENIUM_IMAGE=selenium/standalone-${{ matrix.browser }}:${{ matrix.selenium }} docker compose up --no-color &> ./logs/selenium.log &
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "xdebug"
php-version: "${{ matrix.php }}"
tools: composer
ini-file: development
ini-values: date.timezone=Europe/Berlin, error_reporting=-1, display_errors=On
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: |
composer update --no-interaction --prefer-dist
composer update --no-interaction --prefer-dist --no-progress --ansi
- name: Wait for selenium to start
run: |
curl --head -X GET --silent --show-error --retry 60 --retry-connrefused --retry-delay 1 http://172.18.0.2:4444
- name: Run tests
env:
WEB_FIXTURES_BROWSER: ${{ matrix.browser }}
DRIVER_URL: http://172.18.0.2:4444/wd/hub
WEB_FIXTURES_HOST: http://host.docker.internal:8002
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
if: ${{ !env.ACT }}
with:
files: coverage.xml

- name: Archive logs artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
if: always()
with:
name: logs_php-${{ matrix.php }}
path: |
logs
name: logs_php-${{ matrix.php }}_selenium-${{ matrix.selenium }}_${{ matrix.browser }}
path: logs
File renamed without changes.
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.md)
[![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
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
],
"require": {
"php": ">=7.4",
"behat/mink": "^1.9@dev"
"ext-json": "*",
"behat/mink": "^1.9@dev",
"php-webdriver/webdriver": "^1.14"
},
"require-dev": {
"mink/driver-testsuite": "dev-master",
Expand All @@ -28,7 +30,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="disabled" />
</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 1ea3c8b

Please sign in to comment.