robertfausk/mink-panther-driver

Symfony Panther driver for Mink framework

v1.0.6 2020-10-08 15:58 UTC

This package is auto-updated.

Last update: 2020-10-08 20:33:19 UTC


README

Latest Stable Version Latest Unstable Version Total Downloads Build Status Scrutinizer Quality Score Code Coverage Software License PHP7 Compatible Open Issues Closed Issues Contributors Contributors

Symfony Panther driver for Mink framework

Install

composer require --dev robertfausk/mink-panther-driver

Usage Example

<?php

use Behat\Mink\Mink;
use Behat\Mink\Session;
use Behat\Mink\Driver\PantherDriver;
use Symfony\Component\Panther\PantherTestCase;

// These are the same options passed as first argument to PantherTestCaseTrait::createPantherClient client constructor. 
protected static $defaultOptions = [
    'webServerDir' => __DIR__.'/../../../../public', // the Flex directory structure
    'hostname' => '127.0.0.1',
    'port' => 9080,
    'router' => '',
    'external_base_uri' => null,
    'readinessPath' => '',
    'browser' => PantherTestCase::CHROME,
];

$mink = new Mink(array(
    'panther' => new Session(new PantherDriver($defaultOptions)),
));

$mink->getSession('panther')->getPage()->findLink('Chat')->click();

Please refer to MinkExtension-example for an executable example.

Documentation

Since MinkPantherDriver is just glue between Mink and Symfony Panther, it already has an extensive documentation:

How to upgrade?

Have a look at CHANGELOG for detailed information.

How to contribute?

Start docker-compose with php web driver

docker-compose up php7.2

Run phpunit tests

docker-compose exec php7.2 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. The first line could be sufficient but this depends on your actual setup.

docker-compose exec php7.2 bin/updatePantherChromeDriver.sh
docker-compose build php7.2

Credits

Created by Robert Freigang robertfausk.

MinkPantherDriver is built on top of Panther and for usage with Behat and Mink. It has been inspired by MinkBrowserKitDriver and MinkSelenium2Driver.