Created
July 17, 2016 18:30
-
-
Save ggirtsou/22cb3ba364bb750e420947bd664b0038 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# firefox 27 | |
sudo mkdir -m 755 /opt | |
cd /opt | |
wget https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/27.0/linux-x86_64/en-US/firefox-27.0.tar.bz2 | |
sudo tar xjf firefox-7.0.1.tar.bz2 | |
sudo apt-get purge firefox | |
sudo ln -s /opt/firefox/firefox /usr/bin/firefox | |
# selenium | |
cd /home/usersetup/Downloads | |
wget http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar | |
java -jar selenium-server-standalone-2.42.2.jar | |
# behat.yml | |
default: | |
extensions: | |
Behat\MinkExtension\Extension: | |
base_url: http://en.wikipedia.org | |
goutte: ~ | |
selenium2: ~ | |
# WikiPedia Search Feature | |
# features/search.feature | |
Feature: Search | |
In order to see a word definition | |
As a website user | |
I need to be able to search for a word | |
Scenario: Searching for a page that does exist | |
Given I am on "/wiki/Main_Page" | |
When I fill in "search" with "Behavior Driven Development" | |
And I press "searchButton" | |
Then I should see "agile software development" | |
Scenario: Searching for a page that does NOT exist | |
Given I am on "/wiki/Main_Page" | |
When I fill in "search" with "Glory Driven Development" | |
And I press "searchButton" | |
Then I should see "Search results" | |
@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" | |
# features/FeatureContext.php | |
<?php | |
use Behat\Behat\Context\ClosuredContextInterface, | |
Behat\Behat\Context\TranslatedContextInterface, | |
Behat\Behat\Context\BehatContext, | |
Behat\Behat\Exception\PendingException; | |
use Behat\Gherkin\Node\PyStringNode, | |
Behat\Gherkin\Node\TableNode; | |
use Behat\MinkExtension\Context\MinkContext; | |
/** | |
* Features context. | |
*/ | |
class FeatureContext extends MinkContext | |
{ | |
/** | |
* @Then /^I wait for the suggestion box to appear$/ | |
*/ | |
public function iWaitForTheSuggestionBoxToAppear() | |
{ | |
$this->getSession()->wait(5000, | |
"$('.suggestions-results').children().length > 0" | |
); | |
} | |
} | |
# composer.json | |
"require": { | |
"behat/behat": "2.4.*@stable", | |
"behat/mink": "1.4.*@stable", | |
"behat/mink-extension": "*", | |
"behat/mink-goutte-driver": "*", | |
"behat/mink-selenium2-driver": "*" | |
}, | |
"config": { | |
"bin-dir": "bin/" | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment