initial commit
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*.tgz
|
||||
*.phar
|
||||
composer.lock
|
||||
vendor
|
||||
6
behat.yml.dist
Normal file
6
behat.yml.dist
Normal file
@@ -0,0 +1,6 @@
|
||||
default:
|
||||
extensions:
|
||||
Behat\MinkExtension\Extension:
|
||||
base_url: http://en.wikipedia.org/
|
||||
goutte: ~
|
||||
sahi: ~
|
||||
36
composer.json
Normal file
36
composer.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "behat/mink-extension",
|
||||
"type": "behat-extension",
|
||||
"description": "Mink extension for Behat",
|
||||
"keywords": ["web", "test", "browser", "gui"],
|
||||
"homepage": "http://mink.behat.org",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Konstantin Kudryashov",
|
||||
"email": "ever.zet@gmail.com"
|
||||
}
|
||||
],
|
||||
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"behat/behat": "dev-develop",
|
||||
"behat/mink": "1.4.0.x-dev"
|
||||
},
|
||||
|
||||
"require-dev": {
|
||||
"fabpot/goutte": "*",
|
||||
"behat/sahi-client": "*"
|
||||
},
|
||||
|
||||
"autoload": {
|
||||
"psr-0": { "Behat\\MinkExtension": "src/" }
|
||||
},
|
||||
|
||||
"repositories": {
|
||||
"behat/mink-deps": {
|
||||
"type": "composer",
|
||||
"url": "behat.org"
|
||||
}
|
||||
}
|
||||
}
|
||||
14
features/bootstrap/FeatureContext.php
Normal file
14
features/bootstrap/FeatureContext.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
use Behat\MinkExtension\Context\MinkContext;
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
23
features/search.feature
Normal file
23
features/search.feature
Normal file
@@ -0,0 +1,23 @@
|
||||
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"
|
||||
47
src/Behat/MinkExtension/Compiler/SelectorsPass.php
Normal file
47
src/Behat/MinkExtension/Compiler/SelectorsPass.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Behat\MinkExtension\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Reference,
|
||||
Symfony\Component\DependencyInjection\ContainerBuilder,
|
||||
Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
|
||||
/*
|
||||
* This file is part of the Behat\MinkExtension
|
||||
*
|
||||
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Selectors handler compilation pass. Registers all avaiable Mink selector engines.
|
||||
*
|
||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*/
|
||||
class SelectorsPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* Registers additional Mink selector handlers.
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('behat.mink.selectors_handler')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$handlerDefinition = $container->getDefinition('behat.mink.selectors_handler');
|
||||
foreach ($container->findTaggedServiceIds('behat.mink.selector') as $id => $attributes) {
|
||||
foreach ($attributes as $attribute) {
|
||||
if (isset($attribute['alias']) && $alias = $attribute['alias']) {
|
||||
$handlerDefinition->addMethodCall(
|
||||
'registerSelector', array($alias, new Reference($id))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
52
src/Behat/MinkExtension/Compiler/SessionsPass.php
Normal file
52
src/Behat/MinkExtension/Compiler/SessionsPass.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Behat\MinkExtension\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Reference,
|
||||
Symfony\Component\DependencyInjection\ContainerBuilder,
|
||||
Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
|
||||
/*
|
||||
* This file is part of the Behat\MinkExtension
|
||||
*
|
||||
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Behat\Mink container compilation pass.
|
||||
* Registers all available in controller Mink sessions.
|
||||
*
|
||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*/
|
||||
class SessionsPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* Registers Mink sessions.
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('behat.mink')) {
|
||||
return;
|
||||
}
|
||||
$minkDefinition = $container->getDefinition('behat.mink');
|
||||
|
||||
foreach ($container->findTaggedServiceIds('behat.mink.session') as $id => $attributes) {
|
||||
foreach ($attributes as $attribute) {
|
||||
if (isset($attribute['alias']) && $name = $attribute['alias']) {
|
||||
$minkDefinition->addMethodCall(
|
||||
'registerSession', array($name, new Reference($id))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$minkDefinition->addMethodCall(
|
||||
'setDefaultSessionName', array($container->getParameter('behat.mink.default_session'))
|
||||
);
|
||||
}
|
||||
}
|
||||
142
src/Behat/MinkExtension/Configuration.php
Normal file
142
src/Behat/MinkExtension/Configuration.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace Behat\MinkExtension;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder,
|
||||
Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
/*
|
||||
* This file is part of the Behat\MinkExtension
|
||||
*
|
||||
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* MinkExtension configuration tree.
|
||||
*
|
||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*/
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
/**
|
||||
* Returns configuration tree.
|
||||
*
|
||||
* @return TreeBuilder
|
||||
*/
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
|
||||
return $treeBuilder->root('mink')->
|
||||
children()->
|
||||
scalarNode('base_url')->
|
||||
defaultNull()->
|
||||
end()->
|
||||
scalarNode('files_path')->
|
||||
defaultNull()->
|
||||
end()->
|
||||
scalarNode('show_cmd')->
|
||||
defaultNull()->
|
||||
end()->
|
||||
scalarNode('show_tmp_dir')->
|
||||
defaultValue(sys_get_temp_dir())->
|
||||
end()->
|
||||
scalarNode('default_session')->
|
||||
defaultValue('goutte')->
|
||||
end()->
|
||||
scalarNode('javascript_session')->
|
||||
defaultValue('sahi')->
|
||||
end()->
|
||||
scalarNode('browser_name')->
|
||||
defaultValue('firefox')->
|
||||
end()->
|
||||
arrayNode('goutte')->
|
||||
children()->
|
||||
arrayNode('zend_config')->
|
||||
useAttributeAsKey('key')->
|
||||
prototype('variable')->end()->
|
||||
end()->
|
||||
arrayNode('server_parameters')->
|
||||
useAttributeAsKey('key')->
|
||||
prototype('variable')->end()->
|
||||
end()->
|
||||
end()->
|
||||
end()->
|
||||
arrayNode('sahi')->
|
||||
children()->
|
||||
scalarNode('sid')->
|
||||
defaultNull()->
|
||||
end()->
|
||||
scalarNode('host')->
|
||||
defaultValue('localhost')->
|
||||
end()->
|
||||
scalarNode('port')->
|
||||
defaultValue(9999)->
|
||||
end()->
|
||||
end()->
|
||||
end()->
|
||||
arrayNode('zombie')->
|
||||
children()->
|
||||
scalarNode('host')->
|
||||
defaultValue('127.0.0.1')->
|
||||
end()->
|
||||
scalarNode('port')->
|
||||
defaultValue(8124)->
|
||||
end()->
|
||||
scalarNode('auto_server')->
|
||||
defaultValue(true)->
|
||||
end()->
|
||||
scalarNode('node_bin')->
|
||||
defaultValue('node')->
|
||||
end()->
|
||||
end()->
|
||||
end()->
|
||||
arrayNode('selenium')->
|
||||
children()->
|
||||
scalarNode('host')->
|
||||
defaultValue('127.0.0.1')->
|
||||
end()->
|
||||
scalarNode('port')->
|
||||
defaultValue(4444)->
|
||||
end()->
|
||||
scalarNode('browser')->
|
||||
defaultValue('*%behat.mink.browser_name%')->
|
||||
end()->
|
||||
end()->
|
||||
end()->
|
||||
arrayNode('selenium2')->
|
||||
children()->
|
||||
scalarNode('browser')->
|
||||
defaultValue('%behat.mink.browser_name%')->
|
||||
end()->
|
||||
arrayNode('capabilities')->
|
||||
children()->
|
||||
scalarNode('browserName')->
|
||||
defaultValue('firefox')->
|
||||
end()->
|
||||
scalarNode('version')->
|
||||
defaultValue(8)->
|
||||
end()->
|
||||
scalarNode('platform')->
|
||||
defaultValue('ANY')->
|
||||
end()->
|
||||
scalarNode('browserVersion')->
|
||||
defaultValue(8)->
|
||||
end()->
|
||||
scalarNode('browser')->
|
||||
defaultValue('firefox')->
|
||||
end()->
|
||||
end()->
|
||||
end()->
|
||||
scalarNode('wd_host')->
|
||||
defaultValue('http://localhost:4444/wd/hub')->
|
||||
end()->
|
||||
end()->
|
||||
end()->
|
||||
end()->
|
||||
end();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Behat\MinkExtension\Context;
|
||||
|
||||
use Behat\Behat\Context\ContextInitializerInterface,
|
||||
Behat\Behat\Context\ContextInterface;
|
||||
|
||||
use Behat\Mink\Mink;
|
||||
|
||||
/*
|
||||
* This file is part of the Behat\MinkExtension.
|
||||
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mink aware contexts initializer.
|
||||
* Sets Mink instance and parameters to the MinkAware contexts.
|
||||
*
|
||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*/
|
||||
class MinkAwareContextInitializer implements ContextInitializerInterface
|
||||
{
|
||||
private $mink;
|
||||
private $parameters;
|
||||
|
||||
/**
|
||||
* Initializes initializer.
|
||||
*
|
||||
* @param Mink $mink
|
||||
* @param array $parameters
|
||||
*/
|
||||
public function __construct(Mink $mink, array $parameters)
|
||||
{
|
||||
$this->mink = $mink;
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if initializer supports provided context.
|
||||
*
|
||||
* @param ContextInterface $context
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public function supports(ContextInterface $context)
|
||||
{
|
||||
return $context instanceof MinkAwareContextInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes provided context.
|
||||
*
|
||||
* @param ContextInterface $context
|
||||
*/
|
||||
public function initialize(ContextInterface $context)
|
||||
{
|
||||
$context->setMink($this->mink);
|
||||
$context->setMinkParameters($this->parameters);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Behat\MinkExtension\Context;
|
||||
|
||||
use Behat\Mink\Mink;
|
||||
|
||||
/*
|
||||
* This file is part of the Behat\MinkExtension.
|
||||
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mink aware interface for contexts.
|
||||
*
|
||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*/
|
||||
interface MinkAwareContextInterface
|
||||
{
|
||||
/**
|
||||
* Sets Mink instance.
|
||||
*
|
||||
* @param Mink $mink Mink session manager
|
||||
*/
|
||||
function setMink(Mink $mink);
|
||||
|
||||
/**
|
||||
* Sets parameters provided for Mink.
|
||||
*
|
||||
* @param array $parameters
|
||||
*/
|
||||
function setMinkParameters(array $parameters);
|
||||
}
|
||||
440
src/Behat/MinkExtension/Context/MinkContext.php
Normal file
440
src/Behat/MinkExtension/Context/MinkContext.php
Normal file
@@ -0,0 +1,440 @@
|
||||
<?php
|
||||
|
||||
namespace Behat\MinkExtension\Context;
|
||||
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
|
||||
use Behat\Behat\Context\TranslatedContextInterface;
|
||||
|
||||
/*
|
||||
* This file is part of the Behat\MinkExtension.
|
||||
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mink context for Behat BDD tool.
|
||||
* Provides Mink integration and base step definitions.
|
||||
*
|
||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*/
|
||||
class MinkContext extends RawMinkContext implements TranslatedContextInterface
|
||||
{
|
||||
/**
|
||||
* Opens specified page.
|
||||
*
|
||||
* @Given /^(?:|I )am on "(?P<page>[^"]+)"$/
|
||||
* @When /^(?:|I )go to "(?P<page>[^"]+)"$/
|
||||
*/
|
||||
public function visit($page)
|
||||
{
|
||||
$this->getSession()->visit($this->locatePath($page));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads current page.
|
||||
*
|
||||
* @When /^(?:|I )reload the page$/
|
||||
*/
|
||||
public function reload()
|
||||
{
|
||||
$this->getSession()->reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves backward one page in history.
|
||||
*
|
||||
* @When /^(?:|I )move backward one page$/
|
||||
*/
|
||||
public function back()
|
||||
{
|
||||
$this->getSession()->back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves forward one page in history
|
||||
*
|
||||
* @When /^(?:|I )move forward one page$/
|
||||
*/
|
||||
public function forward()
|
||||
{
|
||||
$this->getSession()->forward();
|
||||
}
|
||||
|
||||
/**
|
||||
* Presses button with specified id|name|title|alt|value.
|
||||
*
|
||||
* @When /^(?:|I )press "(?P<button>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function pressButton($button)
|
||||
{
|
||||
$button = $this->fixStepArgument($button);
|
||||
$this->getSession()->getPage()->pressButton($button);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clicks link with specified id|title|alt|text.
|
||||
*
|
||||
* @When /^(?:|I )follow "(?P<link>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function clickLink($link)
|
||||
{
|
||||
$link = $this->fixStepArgument($link);
|
||||
$this->getSession()->getPage()->clickLink($link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills in form field with specified id|name|label|value.
|
||||
*
|
||||
* @When /^(?:|I )fill in "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/
|
||||
* @When /^(?:|I )fill in "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function fillField($field, $value)
|
||||
{
|
||||
$field = $this->fixStepArgument($field);
|
||||
$value = $this->fixStepArgument($value);
|
||||
$this->getSession()->getPage()->fillField($field, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills in form fields with provided table.
|
||||
*
|
||||
* @When /^(?:|I )fill in the following:$/
|
||||
*/
|
||||
public function fillFields(TableNode $fields)
|
||||
{
|
||||
foreach ($fields->getRowsHash() as $field => $value) {
|
||||
$this->fillField($field, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects option in select field with specified id|name|label|value.
|
||||
*
|
||||
* @When /^(?:|I )select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function selectOption($select, $option)
|
||||
{
|
||||
$select = $this->fixStepArgument($select);
|
||||
$option = $this->fixStepArgument($option);
|
||||
$this->getSession()->getPage()->selectFieldOption($select, $option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects additional option in select field with specified id|name|label|value.
|
||||
*
|
||||
* @When /^(?:|I )additionally select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function additionallySelectOption($select, $option)
|
||||
{
|
||||
$select = $this->fixStepArgument($select);
|
||||
$option = $this->fixStepArgument($option);
|
||||
$this->getSession()->getPage()->selectFieldOption($select, $option, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks checkbox with specified id|name|label|value.
|
||||
*
|
||||
* @When /^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function checkOption($option)
|
||||
{
|
||||
$option = $this->fixStepArgument($option);
|
||||
$this->getSession()->getPage()->checkField($option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unchecks checkbox with specified id|name|label|value.
|
||||
*
|
||||
* @When /^(?:|I )uncheck "(?P<option>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function uncheckOption($option)
|
||||
{
|
||||
$option = $this->fixStepArgument($option);
|
||||
$this->getSession()->getPage()->uncheckField($option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches file to field with specified id|name|label|value.
|
||||
*
|
||||
* @When /^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function attachFileToField($field, $path)
|
||||
{
|
||||
$field = $this->fixStepArgument($field);
|
||||
|
||||
if (isset($this->minkParameters['files_path']) && $this->minkParameters['files_path']) {
|
||||
$path = $this->minkParameters['files_path'].DIRECTORY_SEPARATOR.$path;
|
||||
}
|
||||
|
||||
$this->getSession()->getPage()->attachFileToField($field, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that current page PATH is equal to specified.
|
||||
*
|
||||
* @Then /^(?:|I )should be on "(?P<page>[^"]+)"$/
|
||||
*/
|
||||
public function assertPageAddress($page)
|
||||
{
|
||||
$this->assertSession()->addressEquals($this->locatePath($page));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that current page PATH matches regular expression.
|
||||
*
|
||||
* @Then /^the (?i)url(?-i) should match (?P<pattern>\/([^\/]|\\\/)*\/)$/
|
||||
*/
|
||||
public function assertUrlRegExp($pattern)
|
||||
{
|
||||
$this->assertSession()->addressMatches($pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that current page response status is equal to specified.
|
||||
*
|
||||
* @Then /^the response status code should be (?P<code>\d+)$/
|
||||
*/
|
||||
public function assertResponseStatus($code)
|
||||
{
|
||||
$this->assertSession()->statusCodeEquals($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that current page response status is not equal to specified.
|
||||
*
|
||||
* @Then /^the response status code should not be (?P<code>\d+)$/
|
||||
*/
|
||||
public function assertResponseStatusIsNot($code)
|
||||
{
|
||||
$this->assertSession()->statusCodeNotEquals($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that page contains specified text.
|
||||
*
|
||||
* @Then /^(?:|I )should see "(?P<text>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function assertPageContainsText($text)
|
||||
{
|
||||
$this->assertSession()->pageTextContains($this->fixStepArgument($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that page doesn't contain specified text.
|
||||
*
|
||||
* @Then /^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function assertPageNotContainsText($text)
|
||||
{
|
||||
$this->assertSession()->pageTextNotContains($this->fixStepArgument($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that page contains text matching specified pattern.
|
||||
*
|
||||
* @Then /^(?:|I )should see text matching (?P<pattern>"(?:[^"]|\\")*")$/
|
||||
*/
|
||||
public function assertPageMatchesText($pattern)
|
||||
{
|
||||
$this->assertSession()->pageTextMatches($this->fixStepArgument($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that page doesn't contain text matching specified pattern.
|
||||
*
|
||||
* @Then /^(?:|I )should not see text matching (?P<pattern>"(?:[^"]|\\")*")$/
|
||||
*/
|
||||
public function assertPageNotMatchesText($pattern)
|
||||
{
|
||||
$this->assertSession()->pageTextNotMatches($this->fixStepArgument($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that HTML response contains specified string.
|
||||
*
|
||||
* @Then /^the response should contain "(?P<text>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function assertResponseContains($text)
|
||||
{
|
||||
$this->assertSession()->responseContains($this->fixStepArgument($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that HTML response doesn't contain specified string.
|
||||
*
|
||||
* @Then /^the response should not contain "(?P<text>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function assertResponseNotContains($text)
|
||||
{
|
||||
$this->assertSession()->responseNotContains($this->fixStepArgument($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that element with specified CSS contains specified text.
|
||||
*
|
||||
* @Then /^(?:|I )should see "(?P<text>(?:[^"]|\\")*)" in the "(?P<element>[^"]*)" element$/
|
||||
*/
|
||||
public function assertElementContainsText($element, $text)
|
||||
{
|
||||
$this->assertSession()->elementTextContains('css', $element, $this->fixStepArgument($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that element with specified CSS doesn't contain specified text.
|
||||
*
|
||||
* @Then /^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)" in the "(?P<element>[^"]*)" element$/
|
||||
*/
|
||||
public function assertElementNotContainsText($element, $text)
|
||||
{
|
||||
$this->assertSession()->elementTextNotContains('css', $element, $this->fixStepArgument($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that element with specified CSS contains specified HTML.
|
||||
*
|
||||
* @Then /^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function assertElementContains($element, $value)
|
||||
{
|
||||
$this->assertSession()->elementContains('css', $element, $this->fixStepArgument($value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that element with specified CSS exists on page.
|
||||
*
|
||||
* @Then /^(?:|I )should see an? "(?P<element>[^"]*)" element$/
|
||||
*/
|
||||
public function assertElementOnPage($element)
|
||||
{
|
||||
$this->assertSession()->elementExists('css', $element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that element with specified CSS doesn't exist on page.
|
||||
*
|
||||
* @Then /^(?:|I )should not see an? "(?P<element>[^"]*)" element$/
|
||||
*/
|
||||
public function assertElementNotOnPage($element)
|
||||
{
|
||||
$this->assertSession()->elementNotExists('css', $element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that form field with specified id|name|label|value has specified value.
|
||||
*
|
||||
* @Then /^the "(?P<field>(?:[^"]|\\")*)" field should contain "(?P<value>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function assertFieldContains($field, $value)
|
||||
{
|
||||
$this->assertSession()->fieldValueEquals($field, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that form field with specified id|name|label|value doesn't have specified value.
|
||||
*
|
||||
* @Then /^the "(?P<field>(?:[^"]|\\")*)" field should not contain "(?P<value>(?:[^"]|\\")*)"$/
|
||||
*/
|
||||
public function assertFieldNotContains($field, $value)
|
||||
{
|
||||
$this->assertSession()->fieldValueNotEquals($field, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that checkbox with specified in|name|label|value is checked.
|
||||
*
|
||||
* @Then /^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should be checked$/
|
||||
*/
|
||||
public function assertCheckboxChecked($checkbox)
|
||||
{
|
||||
$this->assertSession()->checkboxChecked($checkbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that checkbox with specified in|name|label|value is unchecked.
|
||||
*
|
||||
* @Then /^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should not be checked$/
|
||||
*/
|
||||
public function assertCheckboxNotChecked($checkbox)
|
||||
{
|
||||
$this->assertSession()->checkboxNotChecked($checkbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that (?P<num>\d+) CSS elements exist on the page
|
||||
*
|
||||
* @Then /^(?:|I )should see (?P<num>\d+) "(?P<element>[^"]*)" elements?$/
|
||||
*/
|
||||
public function assertNumElements($num, $element)
|
||||
{
|
||||
$this->assertSession()->elementsCount('css', $element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints last response to console.
|
||||
*
|
||||
* @Then /^print last response$/
|
||||
*/
|
||||
public function printLastResponse()
|
||||
{
|
||||
$this->printDebug(
|
||||
$this->getSession()->getCurrentUrl()."\n\n".
|
||||
$this->getSession()->getPage()->getContent()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens last response content in browser.
|
||||
*
|
||||
* @Then /^show last response$/
|
||||
*/
|
||||
public function showLastResponse()
|
||||
{
|
||||
if (null === $this->minkParameters['show_cmd']) {
|
||||
throw new \RuntimeException('Set "show_cmd" parameter in behat.yml to be able to open page in browser (ex.: "show_cmd: firefox %s")');
|
||||
}
|
||||
|
||||
$filename = rtrim($this->minkParameters['show_tmp_dir'], DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.uniqid().'.html';
|
||||
file_put_contents($filename, $this->getSession()->getPage()->getContent());
|
||||
system(sprintf($this->minkParameters['show_cmd'], escapeshellarg($filename)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of definition translation resources paths.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTranslationResources()
|
||||
{
|
||||
return glob(__DIR__.'/../../../../../i18n/*.xliff');
|
||||
}
|
||||
|
||||
/**
|
||||
* Locates url, based on provided path.
|
||||
* Override to provide custom routing mechanism.
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function locatePath($path)
|
||||
{
|
||||
$startUrl = rtrim($this->minkParameters['base_url'], '/') . '/';
|
||||
|
||||
return 0 !== strpos($path, 'http') ? $startUrl . ltrim($path, '/') : $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns fixed step argument (with \\" replaced back to ").
|
||||
*
|
||||
* @param string $argument
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function fixStepArgument($argument)
|
||||
{
|
||||
return str_replace('\\"', '"', $argument);
|
||||
}
|
||||
}
|
||||
108
src/Behat/MinkExtension/Context/RawMinkContext.php
Normal file
108
src/Behat/MinkExtension/Context/RawMinkContext.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace Behat\MinkExtension\Context;
|
||||
|
||||
use Behat\Behat\Context\BehatContext,
|
||||
Behat\Behat\Event\ScenarioEvent;
|
||||
|
||||
use Behat\Mink\Mink,
|
||||
Behat\Mink\WebAssert;
|
||||
|
||||
/*
|
||||
* This file is part of the Behat\MinkExtension.
|
||||
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Raw Mink context for Behat BDD tool.
|
||||
* Provides raw Mink integration (without step definitions) and web assertions.
|
||||
*
|
||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*/
|
||||
class RawMinkContext extends BehatContext implements MinkAwareContextInterface
|
||||
{
|
||||
private $mink;
|
||||
protected $minkParameters;
|
||||
|
||||
/**
|
||||
* Sets Mink instance.
|
||||
*
|
||||
* @param Mink $mink Mink session manager
|
||||
*/
|
||||
public function setMink(Mink $mink)
|
||||
{
|
||||
$this->mink = $mink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets parameters provided for Mink.
|
||||
*
|
||||
* @param array $parameters
|
||||
*/
|
||||
public function setMinkParameters(array $parameters)
|
||||
{
|
||||
$this->minkParameters = $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Mink instance.
|
||||
*
|
||||
* @return Mink
|
||||
*/
|
||||
public function getMink()
|
||||
{
|
||||
return $this->mink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Mink session.
|
||||
*
|
||||
* @param string|null $name name of the session OR active session will be used
|
||||
*
|
||||
* @return Session
|
||||
*/
|
||||
public function getSession($name = null)
|
||||
{
|
||||
return $this->getMink()->getSession($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Mink session assertion tool.
|
||||
*
|
||||
* @param string|null $name name of the session OR active session will be used
|
||||
*
|
||||
* @return WebAssert
|
||||
*/
|
||||
public function assertSession($name = null)
|
||||
{
|
||||
return $this->getMink()->assertSession($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @BeforeScenario
|
||||
*/
|
||||
public function prepareMinkSessions($event)
|
||||
{
|
||||
$scenario = $event instanceof ScenarioEvent ? $event->getScenario() : $event->getOutline();
|
||||
$session = $this->minkParameters['default_session'];
|
||||
|
||||
foreach ($scenario->getTags() as $tag) {
|
||||
if ('javascript' === $tag) {
|
||||
$session = $this->minkParameters['javascript_session'];
|
||||
} elseif (preg_match('/^mink\:(.+)/', $tag, $matches)) {
|
||||
$session = $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ($scenario->hasTag('insulated')) {
|
||||
$this->getMink()->stopSessions();
|
||||
} else {
|
||||
$this->getMink()->resetSessions();
|
||||
}
|
||||
|
||||
$this->getMink()->setDefaultSessionName($session);
|
||||
}
|
||||
}
|
||||
88
src/Behat/MinkExtension/Extension.php
Normal file
88
src/Behat/MinkExtension/Extension.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace Behat\MinkExtension;
|
||||
|
||||
use Symfony\Component\Config\Definition\Processor,
|
||||
Symfony\Component\Config\FileLocator,
|
||||
Symfony\Component\DependencyInjection\ContainerBuilder,
|
||||
Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
|
||||
use Behat\Behat\Extension\ExtensionInterface;
|
||||
|
||||
/*
|
||||
* This file is part of the Behat\MinkExtension
|
||||
*
|
||||
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mink extension for Behat class.
|
||||
*
|
||||
* @author Konstantin Kudryashov <ever.zet@gmail.com>
|
||||
*/
|
||||
class Extension implements ExtensionInterface
|
||||
{
|
||||
/**
|
||||
* Loads a specific configuration.
|
||||
*
|
||||
* @param array $config Extension configuration hash (from behat.yml)
|
||||
* @param ContainerBuilder $container ContainerBuilder instance
|
||||
*/
|
||||
public function load(array $config, ContainerBuilder $container)
|
||||
{
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration();
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/services'));
|
||||
|
||||
$config = $processor->processConfiguration($configuration, array($config));
|
||||
$loader->load('mink.xml');
|
||||
|
||||
if (isset($config['goutte'])) {
|
||||
$loader->load('sessions/goutte.xml');
|
||||
}
|
||||
if (isset($config['sahi'])) {
|
||||
$loader->load('sessions/sahi.xml');
|
||||
}
|
||||
if (isset($config['zombie'])) {
|
||||
$loader->load('sessions/zombie.xml');
|
||||
}
|
||||
if (isset($config['selenium'])) {
|
||||
$loader->load('sessions/selenium.xml');
|
||||
}
|
||||
if (isset($config['selenium2'])) {
|
||||
$loader->load('sessions/selenium2.xml');
|
||||
}
|
||||
|
||||
$minkParameters = array();
|
||||
foreach ($config as $ns => $tlValue) {
|
||||
if (!is_array($tlValue)) {
|
||||
$minkParameters[$ns] = $tlValue;
|
||||
} else {
|
||||
foreach ($tlValue as $name => $value) {
|
||||
$container->setParameter("behat.mink.$ns.$name", $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
$container->setParameter('behat.mink.parameters', $minkParameters);
|
||||
|
||||
$minkReflection = new \ReflectionClass('Behat\Mink\Mink');
|
||||
$minkLibPath = realpath(dirname($minkReflection->getFilename()) . '/../../../');
|
||||
$container->setParameter('mink.paths.lib', $minkLibPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns compiler passes used by mink extension.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCompilerPasses()
|
||||
{
|
||||
return array(
|
||||
new Compiler\SelectorsPass(),
|
||||
new Compiler\SessionsPass(),
|
||||
);
|
||||
}
|
||||
}
|
||||
43
src/Behat/MinkExtension/services/mink.xml
Normal file
43
src/Behat/MinkExtension/services/mink.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<parameters>
|
||||
|
||||
<parameter key="mink.paths.lib">null</parameter>
|
||||
<parameter key="behat.mink.parameters" type="collection"></parameter>
|
||||
<parameter key="behat.mink.class">Behat\Mink\Mink</parameter>
|
||||
<parameter key="behat.mink.session.class">Behat\Mink\Session</parameter>
|
||||
<parameter key="behat.mink.selectors_handler.class">Behat\Mink\Selector\SelectorsHandler</parameter>
|
||||
<parameter key="behat.test_client.class">Behat\MinkBundle\Client</parameter>
|
||||
|
||||
<parameter key="behat.mink.default_session">goutte</parameter>
|
||||
<parameter key="behat.mink.javascript_session">sahi</parameter>
|
||||
<parameter key="behat.mink.base_url">null</parameter>
|
||||
<parameter key="behat.mink.show_cmd">null</parameter>
|
||||
<parameter key="behat.mink.show_tmp_dir">null</parameter>
|
||||
<parameter key="behat.mink.browser_name">firefox</parameter>
|
||||
|
||||
</parameters>
|
||||
<services>
|
||||
|
||||
<service id="behat.mink" class="%behat.mink.class%" />
|
||||
|
||||
<service id="behat.mink.selectors_handler" class="%behat.mink.selectors_handler.class%" />
|
||||
|
||||
<service id="behat.mink.selector.css" class="Behat\Mink\Selector\CssSelector">
|
||||
<tag name="behat.mink.selector" alias="css" />
|
||||
</service>
|
||||
|
||||
<service id="behat.mink.selector.named" class="Behat\Mink\Selector\NamedSelector">
|
||||
<tag name="behat.mink.selector" alias="named" />
|
||||
</service>
|
||||
|
||||
<service id="behat.mink.context_initializer" class="Behat\MinkExtension\Context\MinkAwareContextInitializer">
|
||||
<argument type="service" id="behat.mink" />
|
||||
<argument>%behat.mink.parameters%</argument>
|
||||
<tag name="behat.context_initializer" />
|
||||
</service>
|
||||
|
||||
</services>
|
||||
</container>
|
||||
31
src/Behat/MinkExtension/services/sessions/goutte.xml
Normal file
31
src/Behat/MinkExtension/services/sessions/goutte.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<parameters>
|
||||
|
||||
<parameter key="behat.mink.driver.goutte.class">Behat\Mink\Driver\GoutteDriver</parameter>
|
||||
<parameter key="behat.mink.goutte.class">Goutte\Client</parameter>
|
||||
<parameter key="behat.mink.goutte.zend_config" type="collection"></parameter>
|
||||
<parameter key="behat.mink.goutte.server_parameters" type="collection"></parameter>
|
||||
|
||||
</parameters>
|
||||
<services>
|
||||
|
||||
<service id="behat.mink.session.goutte" class="%behat.mink.session.class%">
|
||||
<argument type="service">
|
||||
<service class="%behat.mink.driver.goutte.class%">
|
||||
<argument type="service" id="behat.mink.goutte" />
|
||||
</service>
|
||||
</argument>
|
||||
<argument type="service" id="behat.mink.selectors_handler" />
|
||||
<tag name="behat.mink.session" alias="goutte" />
|
||||
</service>
|
||||
|
||||
<service id="behat.mink.goutte" class="%behat.mink.goutte.class%">
|
||||
<argument>%behat.mink.goutte.zend_config%</argument>
|
||||
<argument>%behat.mink.goutte.server_parameters%</argument>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
</container>
|
||||
40
src/Behat/MinkExtension/services/sessions/sahi.xml
Normal file
40
src/Behat/MinkExtension/services/sessions/sahi.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<parameters>
|
||||
|
||||
<parameter key="behat.mink.driver.sahi.class">Behat\Mink\Driver\SahiDriver</parameter>
|
||||
<parameter key="behat.mink.sahi.class">Behat\SahiClient\Client</parameter>
|
||||
<parameter key="behat.mink.sahi.connection.class">Behat\SahiClient\Connection</parameter>
|
||||
|
||||
<parameter key="behat.mink.sahi.sid">null</parameter>
|
||||
<parameter key="behat.mink.sahi.host">localhost</parameter>
|
||||
<parameter key="behat.mink.sahi.port">9999</parameter>
|
||||
|
||||
</parameters>
|
||||
<services>
|
||||
|
||||
<service id="behat.mink.session.sahi" class="%behat.mink.session.class%">
|
||||
<argument type="service">
|
||||
<service class="%behat.mink.driver.sahi.class%">
|
||||
<argument>%behat.mink.browser_name%</argument>
|
||||
<argument type="service" id="behat.mink.sahi" />
|
||||
</service>
|
||||
</argument>
|
||||
<argument type="service" id="behat.mink.selectors_handler" />
|
||||
<tag name="behat.mink.session" alias="sahi" />
|
||||
</service>
|
||||
|
||||
<service id="behat.mink.sahi" class="%behat.mink.sahi.class%">
|
||||
<argument type="service">
|
||||
<service class="%behat.mink.sahi.connection.class%">
|
||||
<argument>%behat.mink.sahi.sid%</argument>
|
||||
<argument>%behat.mink.sahi.host%</argument>
|
||||
<argument>%behat.mink.sahi.port%</argument>
|
||||
</service>
|
||||
</argument>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
</container>
|
||||
35
src/Behat/MinkExtension/services/sessions/selenium.xml
Normal file
35
src/Behat/MinkExtension/services/sessions/selenium.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<parameters>
|
||||
|
||||
<parameter key="behat.mink.driver.selenium.class">Behat\Mink\Driver\SeleniumDriver</parameter>
|
||||
<parameter key="behat.mink.selenium.class">Selenium\Client</parameter>
|
||||
|
||||
<parameter key="behat.mink.selenium.host">127.0.0.1</parameter>
|
||||
<parameter key="behat.mink.selenium.port">4444</parameter>
|
||||
<parameter key="behat.mink.selenium.browser">*%behat.mink.browser_name%</parameter>
|
||||
|
||||
</parameters>
|
||||
<services>
|
||||
|
||||
<service id="behat.mink.session.selenium" class="%behat.mink.session.class%">
|
||||
<argument type="service">
|
||||
<service class="%behat.mink.driver.selenium.class%">
|
||||
<argument>%behat.mink.selenium.browser%</argument>
|
||||
<argument>%behat.mink.base_url%</argument>
|
||||
<argument type="service" id="behat.mink.selenium" />
|
||||
</service>
|
||||
</argument>
|
||||
<argument type="service" id="behat.mink.selectors_handler" />
|
||||
<tag name="behat.mink.session" alias="selenium" />
|
||||
</service>
|
||||
|
||||
<service id="behat.mink.selenium" class="%behat.mink.selenium.class%">
|
||||
<argument>%behat.mink.selenium.host%</argument>
|
||||
<argument>%behat.mink.selenium.port%</argument>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
</container>
|
||||
35
src/Behat/MinkExtension/services/sessions/selenium2.xml
Normal file
35
src/Behat/MinkExtension/services/sessions/selenium2.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<parameters>
|
||||
|
||||
<parameter key="behat.mink.driver.selenium2.class">Behat\Mink\Driver\Selenium2Driver</parameter>
|
||||
|
||||
<parameter key="behat.mink.selenium2.browser">%behat.mink.browser_name%</parameter>
|
||||
<parameter key="behat.mink.selenium2.capabilities">
|
||||
<parameter key="browserName">firefox</parameter>
|
||||
<parameter key="version">8</parameter>
|
||||
<parameter key="platform">ANY</parameter>
|
||||
<parameter key="browserVersion">8</parameter>
|
||||
<parameter key="browser">firefox</parameter>
|
||||
</parameter>
|
||||
<parameter key="behat.mink.selenium2.wd_host">http://localhost:4444/wd/hub</parameter>
|
||||
|
||||
</parameters>
|
||||
<services>
|
||||
|
||||
<service id="behat.mink.session.selenium2" class="%behat.mink.session.class%">
|
||||
<argument type="service">
|
||||
<service class="%behat.mink.driver.selenium2.class%">
|
||||
<argument type="string">%behat.mink.selenium2.browser%</argument>
|
||||
<argument type="collection">%behat.mink.selenium2.capabilities%</argument>
|
||||
<argument type="string">%behat.mink.selenium2.wd_host%</argument>
|
||||
</service>
|
||||
</argument>
|
||||
<argument type="service" id="behat.mink.selectors_handler" />
|
||||
<tag name="behat.mink.session" alias="selenium2" />
|
||||
</service>
|
||||
|
||||
</services>
|
||||
</container>
|
||||
43
src/Behat/MinkExtension/services/sessions/zombie.xml
Normal file
43
src/Behat/MinkExtension/services/sessions/zombie.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<parameters>
|
||||
|
||||
<parameter key="behat.mink.driver.zombie.class">Behat\Mink\Driver\ZombieDriver</parameter>
|
||||
<parameter key="behat.mink.zombie.connection.class">Behat\Mink\Driver\Zombie\Connection</parameter>
|
||||
<parameter key="behat.mink.zombie.server.class">Behat\Mink\Driver\Zombie\Server</parameter>
|
||||
|
||||
<parameter key="behat.mink.zombie.host">127.0.0.1</parameter>
|
||||
<parameter key="behat.mink.zombie.port">8124</parameter>
|
||||
<parameter key="behat.mink.zombie.auto_server">true</parameter>
|
||||
<parameter key="behat.mink.zombie.node_bin">node</parameter>
|
||||
|
||||
</parameters>
|
||||
<services>
|
||||
|
||||
<service id="behat.mink.session.zombie" class="%behat.mink.session.class%">
|
||||
<argument type="service">
|
||||
<service class="%behat.mink.driver.zombie.class%">
|
||||
<argument type="service" id="behat.mink.zombie.connection" />
|
||||
<argument type="service" id="behat.mink.zombie.server" />
|
||||
<argument>%behat.mink.zombie.auto_server%</argument>
|
||||
</service>
|
||||
</argument>
|
||||
<argument type="service" id="behat.mink.selectors_handler" />
|
||||
<tag name="behat.mink.session" alias="zombie" />
|
||||
</service>
|
||||
|
||||
<service id="behat.mink.zombie.connection" class="%behat.mink.zombie.connection.class%">
|
||||
<argument>%behat.mink.zombie.host%</argument>
|
||||
<argument>%behat.mink.zombie.port%</argument>
|
||||
</service>
|
||||
|
||||
<service id="behat.mink.zombie.server" class="%behat.mink.zombie.server.class%">
|
||||
<argument>%behat.mink.zombie.host%</argument>
|
||||
<argument>%behat.mink.zombie.port%</argument>
|
||||
<argument>%behat.mink.zombie.node_bin%</argument>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
</container>
|
||||
Reference in New Issue
Block a user