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

Add support for PHP 8.1, Symfony 6 and GitHub Actions instead of Travis CI #23

Merged
merged 5 commits into from
Feb 17, 2022
Merged
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
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI

on:
push:
pull_request:

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' ]
fail-fast: false
env:
MATRIX_PHP: ${{ matrix.php }}
PANTHER_CHROME_BINARY: '/opt/hostedtoolcache/chromium/858016/x64/chrome'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "xdebug"
php-version: "${{ matrix.php }}"
extensions: zip
tools: composer
ini-values: error_reporting=-1, display_errors=On
- name: Install dependencies
run: |
composer install --no-interaction --no-scripts --no-progress --prefer-dist
- uses: browser-actions/setup-chrome@latest
with:
chrome-version: 858016
- run: chrome --version
- name: Uninstall chromedriver from Ubuntu
run: |
sudo apt-get remove chromium-chromedriver
- name: Add browser drivers
run: |
vendor/bin/bdi driver:chromedriver --driver-version=90.0.4430.24 drivers
- name: Setup Mink test server
run: |
mkdir ./logs
./vendor/bin/mink-test-server &> ./logs/mink-test-server.log &
- name: Remove preinstalled chromedriver bin from ubuntu
run: sudo rm -rf /usr/local/share/chrome_driver
- name: Run tests
run: |
vendor/bin/phpunit -v --coverage-clover=coverage.xml
- name: Upload coverage
uses: codecov/codecov-action@v2
with:
files: coverage.xml
- name: Archive logs artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: logs_php-${{ matrix.php }}
path: |
logs
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
v1.1.0 / 2022-02-xx
==================

Features:
* Add support for ```symfony/panther:~2.0```.
* Add support for ```PHP 8.1```.
* Drop support for ```PHP 7.1``` cause of too much maintenance afford. Stick with ```v1.0.8``` if you want to use ```PHP 7.1```.
* Enable RadioTest::testIsChecked and RadioTest::testSetValue as soon as ```symfony/panther#v2.0.2``` ist out.

Misc:
* Use GitHub Actions instead of Travis CI for continuous integration.

v1.0.8 / 2021-03-14
==================

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG PHP_VERSION=7.2

FROM composer:latest as composer
FROM composer:2.2 as composer
FROM php:${PHP_VERSION}

# replace shell with bash so we can source files
Expand Down
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
[![Latest Unstable Version](https://poser.pugx.org/robertfausk/mink-panther-driver/v/unstable.svg)](https://packagist.org/packages/robertfausk/mink-panther-driver)
[![Total Downloads](https://poser.pugx.org/robertfausk/mink-panther-driver/downloads.svg)](https://packagist.org/packages/robertfausk/mink-panther-driver)
[![Monhtly Downloads](https://img.shields.io/packagist/dm/robertfausk/mink-panther-driver?style=flat&color=blue)](https://img.shields.io/packagist/dm/robertfausk/mink-panther-driver)
[![Build Status](https://travis-ci.com/robertfausk/mink-panther-driver.svg?branch=master)](https://travis-ci.com/robertfausk/mink-panther-driver)
[![Daily Downloads](https://img.shields.io/packagist/dd/robertfausk/mink-panther-driver?style=flat&color=blue)](https://img.shields.io/packagist/dm/robertfausk/mink-panther-driver)
[![Tests](https://github.com/robertfausk/mink-panther-driver/actions/workflows/ci.yml/badge.svg)](https://github.com/robertfausk/mink-panther-driver/actions/workflows/ci.yml)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/robertfausk/mink-panther-driver/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/robertfausk/mink-panther-driver/)
[![Code Coverage](https://scrutinizer-ci.com/g/robertfausk/mink-panther-driver/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/robertfausk/mink-panther-driver/)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
![PHP7 Compatible](https://img.shields.io/travis/php-v/robertfausk/mink-panther-driver/master?style=flat)
[![PHP Version Require](http://poser.pugx.org/robertfausk/mink-panther-driver/require/php)](https://packagist.org/packages/robertfausk/mink-panther-driver)
[![Open Issues](https://img.shields.io/github/issues-raw/robertfausk/mink-panther-driver?style=flat)](https://github.com/robertfausk/mink-panther-driver/issues)
[![Closed Issues](https://img.shields.io/github/issues-closed-raw/robertfausk/mink-panther-driver?style=flat)](https://github.com/robertfausk/mink-panther-driver/issues?q=is%3Aissue+is%3Aclosed)
[![Contributors](https://img.shields.io/github/contributors/robertfausk/mink-panther-driver?style=flat)](https://github.com/robertfausk/mink-panther-driver/graphs/contributors)
![Contributors](https://img.shields.io/maintenance/yes/2022?style=flat)
[![Dependents](http://poser.pugx.org/robertfausk/mink-panther-driver/dependents)](https://packagist.org/packages/robertfausk/mink-panther-driver/dependents)


Symfony Panther driver for Mink framework

Expand Down Expand Up @@ -69,24 +72,17 @@ and give [robertfausk/behat-panther-extension](https://github.com/robertfausk/be

Start docker-compose with php web driver

docker-compose up php8.0
docker-compose up php8.1

Run phpunit tests

docker-compose exec php8.0 vendor/bin/phpunit
docker-compose exec php8.1 vendor/bin/phpunit

If you run into issues of type ```session not created: This version of ChromeDriver only supports Chrome version 79```
then it is because of mismatched versions between installed chrome driver and chromium.
Best way to bypass this problem is to update them to their newest version.

docker-compose exec php8.0 composer require --dev dbrekelmans/bdi --ignore-platform-req=php
docker-compose exec php8.0 vendor/bin/bdi detect drivers

If you are developing for PHP 7.1 then you should use following.
The first line could be sufficient but this depends on your actual setup.

docker-compose exec php7.1 bin/updatePantherChromeDriver.sh
docker-compose build php7.1
docker-compose exec php8.1 vendor/bin/bdi detect drivers

## Credits

Expand Down
43 changes: 0 additions & 43 deletions bin/updatePantherChromeDriver.sh

This file was deleted.

23 changes: 16 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"Symfony",
"Mink",
"testing",
"panther",
"chrome",
"chromium",
"firefox",
"headless",
"browser"
],
"homepage": "http://mink.behat.org/",
Expand All @@ -17,22 +22,26 @@
}
],
"require": {
"php": ">=7.1",
"php": ">=7.2",
"behat/mink": "~1.8",
"symfony/panther": "~0.7|~1.0",
"symfony/panther": "~0.7|~1.0|~2.0",
"ext-dom": "*"
},
"require-dev": {
"dbrekelmans/bdi": "^1.0",
"mink/driver-testsuite": "dev-master",
"phpunit/phpunit": "~6.0|~7.0|~8.0|~9.0",
"symfony/dom-crawler": "~2.3|~3.0|~4.0",
"symfony/http-kernel": "~2.3|~3.0|~4.0"
"phpunit/phpunit": "~8.5|~9.3",
"symfony/dom-crawler": "~4.0|~5.0|~6.0",
"symfony/http-kernel": "~4.0|~5.0|~6.0"
},
"scripts": {
"qa": ""
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"pyrech/composer-changelogs": true
}
},
"suggest": {
"ext-gd": "*"
Expand All @@ -49,7 +58,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.1.x-dev"
}
}
}
9 changes: 0 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,3 @@ services:
- PHP_VERSION=7.2
volumes:
- .:/var/www/html

php7.1:
tty: true
build:
context: .
args:
- PHP_VERSION=7.1
volumes:
- .:/var/www/html
7 changes: 3 additions & 4 deletions src/PantherDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ public function back()
public function switchToWindow($name = null)
{
$this->getClient()->switchTo()->window($name);
$this->getClient()->refreshCrawler();
}

/**
Expand Down Expand Up @@ -423,6 +422,7 @@ public function isSelected($xpath)
*/
public function findElementXpaths($xpath)
{
$this->getClient()->refreshCrawler();
$nodes = $this->getCrawler()->filterXPath($xpath);

$elements = [];
Expand All @@ -446,6 +446,7 @@ public function getTagName($xpath)
*/
public function getText($xpath)
{
$this->getClient()->refreshCrawler();
$text = $this->getFilteredCrawler($xpath)->text();
$text = str_replace("\n", ' ', $text);
$text = preg_replace('/ {2,}/', ' ', $text);
Expand Down Expand Up @@ -586,7 +587,6 @@ public function selectOption($xpath, $value, $multiple = false)
public function click($xpath)
{
$this->getClient()->getMouse()->click($this->toCoordinates($xpath));
$this->getClient()->refreshCrawler();
}

/**
Expand All @@ -610,7 +610,7 @@ public function rightClick($xpath)
*/
public function isChecked($xpath)
{
return $this->getChoiceFormField($xpath)->hasValue();
return $this->getCrawlerElement($this->getFilteredCrawler($xpath))->isSelected();
}

/**
Expand Down Expand Up @@ -709,7 +709,6 @@ public function submitForm($xpath)
$crawler = $this->getFilteredCrawler($xpath);

$this->getClient()->submit($crawler->form());
$this->getClient()->refreshCrawler();
}

/**
Expand Down
19 changes: 0 additions & 19 deletions tests/Custom/RadioTest.php

This file was deleted.