Skip to content

Instantly share code, notes, and snippets.

@jk jk/README.md
Last active Apr 27, 2018

Embed
What would you like to do?
Behat + Mink + Selenium 2 Stack

Important files

Here you find the DSL language definition for your phrases you can use in .feature files:

  • features/bootstrap/FeatureContext.php inherits from
  • vendor/behat/mink-extension/Behat/MinkExtension/Context/MinkContext.php

Installation

With Homebrew that gets really easy:

  • brew install selenium-server-standalone

before running bin/behat start up the selenium server:

  • java -jar /usr/local/opt/selenium-server-standalone/selenium-server-standalone-2.35.0.jar -p 4444
default:
extensions:
Behat\MinkExtension\Extension:
base_url: http://example.tld
show_cmd: open -a "Google Chrome" "%s"
javascript_session: 'selenium2'
browser_name: firefox # safari, googlechrome
goutte: ~
selenium2: ~
{
"require": {
"behat/behat": "2.4.*@stable",
"behat/mink": "1.4.*@stable",
"behat/mink-extension": "*",
"behat/mink-goutte-driver": "*",
"behat/mink-sahi-driver": "*",
"behat/mink-selenium-driver": "*",
"behat/mink-selenium2-driver": "*",
"behat/mink-zombie-driver": "1.0.*"
},
"minimum-stability": "dev",
"config": {
"bin-dir": "bin/"
}
}
curl http://getcomposer.org/installer | php
php composer.phar install --prefer-source
./bin/behat --init
# features/myfeature.feature
Feature: Search
In order to test something
As a website user
I need to be able to start a test
@javascript
Scenario: Searching for a page with autocompletion
Given I am on "/wiki/Main_Page"
When I fill in "search" with "Behavior Driv"
And I wait for the suggestion box to appear
Then I should see "Behavior-driven development"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.