Skip to content
Open
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
2 changes: 1 addition & 1 deletion behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ default:
base_url: http://en.wikipedia.org/
sessions:
default:
goutte: ~
browserkit_http: ~
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0"
},
"require-dev": {
"behat/mink-goutte-driver": "^1.1 || ^2.0",
"behat/mink-browserkit-driver": "^2.0",
"phpspec/phpspec": "^6.0 || ^7.0 || 7.1.x-dev",
"mink/webdriver-classic-driver": "^1.0@dev"
},
Expand Down
50 changes: 8 additions & 42 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The easiest way to keep your suite updated is to use `Composer <http://getcompos
base_url: 'http://example.com'
sessions:
default:
goutte: ~
browserkit_http: ~

Usage
-----
Expand Down Expand Up @@ -143,7 +143,7 @@ will need to choose the driver you want to use.
first_session:
selenium2: ~
second_session:
goutte: ~
browserkit_http: ~
third_session:
selenium2: ~

Expand Down Expand Up @@ -171,16 +171,16 @@ session using a javascript driver in the order of the configuration (it would
be ``first_session`` in the example above as ``selenium2`` supports Javascript).
If it is not configured explicitly, the default session is set to the first
session using a non-javascript driver if any, or to the first javascript session
otherwise (it would be ``second_session`` above as ``goutte`` does not support
otherwise (it would be ``second_session`` above as ``browserkit_http`` does not support
javascript).

Drivers
~~~~~~~

First of all, there are drivers enabling configuration. MinkExtension comes
with support for 7 drivers out of the box:
with support for different drivers.

* ``GoutteDriver`` - headless driver without JavaScript support. In order to use
* ``BrowserKitDriver`` - headless driver without JavaScript support. In order to use
it, modify your ``behat.yml`` profile:

.. code-block:: yaml
Expand All @@ -190,38 +190,7 @@ with support for 7 drivers out of the box:
Behat\MinkExtension:
sessions:
my_session:
goutte: ~

.. Tips : HTTPS and self-signed certificate
If you use Behat/Mink/Goutte to test your application, and want to test an
application secured with HTTPS, but with a self-signed certificate, you can use
the following parameters to avoid the validation error triggered by Guzzle:

* For ``Guzzle 4`` or later:

.. code-block:: yaml

default:
extensions:
Behat\MinkExtension:
sessions:
my_session:
goutte:
guzzle_parameters:
verify: false

* For ``Guzzle 3`` or earlier:

.. code-block:: yaml

default:
extensions:
Behat\MinkExtension:
sessions:
my_session:
goutte:
guzzle_parameters:
ssl.certificate_authority: false
Comment on lines -195 to -224
Copy link

Choose a reason for hiding this comment

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

Why were parts about Guzzle support removed?

Copy link
Author

Choose a reason for hiding this comment

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

I thought that was just special configuration for Goutte-with-Guzzle-X, wasn't it?

Copy link

Choose a reason for hiding this comment

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

You're correct.

browserkit_http: ~

* ``Selenium2Driver`` - javascript driver. In order to use it, modify your
``behat.yml`` profile:
Expand Down Expand Up @@ -301,12 +270,9 @@ with support for 7 drivers out of the box:

.. note::

The phar version of Mink comes bundled with all 5 drivers and you don't need to do
anything except enabling them in order to use them.
Comment on lines -304 to -305
Copy link

Choose a reason for hiding this comment

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

Do we support Mink PHAR version or why have you removed this part of the docs?

Copy link
Author

Choose a reason for hiding this comment

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

I have never seen a .phar being built or provided in this repo here, so I dropped any remarks regarding a PHAR version

Copy link

Choose a reason for hiding this comment

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

I haven't either.

You need to install drivers that you need through Composer:

But if you're using Composer, you need to install drivers that you need first:

- GoutteDriver - ``behat/mink-goutte-driver``
- BrowserKitDriver - ``behat/mink-browserkit-driver``
- SeleniumDriver - ``behat/mink-selenium-driver``
- Selenium2Driver (also used for SauceLabs and BrowserStack) - ``behat/mink-selenium2-driver``
- SahiDriver - ``behat/mink-sahi-driver``
Expand Down
10 changes: 5 additions & 5 deletions spec/Behat/MinkExtension/Listener/SessionsListenerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SessionsListenerSpec extends ObjectBehavior
{
function let(Mink $mink, ScenarioTested $event, FeatureNode $feature, ScenarioNode $scenario, Suite $suite)
{
$this->beConstructedWith($mink, 'goutte', 'selenium2', array('selenium2', 'sahi'));
$this->beConstructedWith($mink, 'browserkit_http', 'selenium2', array('selenium2', 'sahi'));

$event->getSuite()->willReturn($suite);
$event->getFeature()->willReturn($feature);
Expand All @@ -38,7 +38,7 @@ function it_is_an_event_subscriber()
function it_resets_the_default_session_before_scenarios($event, $mink)
{
$mink->resetSessions()->shouldBeCalled();
$mink->setDefaultSessionName('goutte')->shouldBeCalled();
$mink->setDefaultSessionName('browserkit_http')->shouldBeCalled();

$this->prepareDefaultMinkSession($event);
}
Expand Down Expand Up @@ -120,7 +120,7 @@ function it_fails_for_invalid_javascript_suite_session($event, $scenario, $suite
function it_fails_when_the_javascript_session_is_used_but_not_defined($event, $mink, $feature, $suite)
{
$suite->hasSetting('mink_javascript_session')->willReturn(false);
$this->beConstructedWith($mink, 'goutte', null);
$this->beConstructedWith($mink, 'browserkit_http', null);
$feature->getTags()->willReturn(array('javascript'));

$this->shouldThrow(new ProcessingException('The @javascript tag cannot be used without enabling a javascript session'))
Expand Down Expand Up @@ -151,7 +151,7 @@ function it_stops_the_sessions_for_insulated_scenarios($event, $mink, $scenario)
{
$scenario->hasTag('insulated')->willReturn(true);
$mink->stopSessions()->shouldBeCalled();
$mink->setDefaultSessionName('goutte')->shouldBeCalled();
$mink->setDefaultSessionName('browserkit_http')->shouldBeCalled();

$this->prepareDefaultMinkSession($event);
}
Expand All @@ -160,7 +160,7 @@ function it_stops_the_sessions_for_insulated_features($event, $mink, $feature)
{
$feature->hasTag('insulated')->willReturn(true);
$mink->stopSessions()->shouldBeCalled();
$mink->setDefaultSessionName('goutte')->shouldBeCalled();
$mink->setDefaultSessionName('browserkit_http')->shouldBeCalled();

$this->prepareDefaultMinkSession($event);
}
Expand Down
2 changes: 0 additions & 2 deletions src/Behat/MinkExtension/ServiceContainer/MinkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Behat\MinkExtension\ServiceContainer\Driver\BrowserKitFactory;
use Behat\MinkExtension\ServiceContainer\Driver\BrowserStackFactory;
use Behat\MinkExtension\ServiceContainer\Driver\DriverFactory;
use Behat\MinkExtension\ServiceContainer\Driver\GoutteFactory;
use Behat\MinkExtension\ServiceContainer\Driver\SahiFactory;
use Behat\MinkExtension\ServiceContainer\Driver\SauceLabsFactory;
use Behat\MinkExtension\ServiceContainer\Driver\Selenium2Factory;
Expand Down Expand Up @@ -53,7 +52,6 @@ class MinkExtension implements ExtensionInterface

public function __construct()
{
$this->registerDriverFactory(new GoutteFactory());
$this->registerDriverFactory(new BrowserKitFactory());
$this->registerDriverFactory(new SahiFactory());
$this->registerDriverFactory(new SeleniumFactory());
Expand Down