Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'release/1.3.3'

  • Loading branch information...
commit 91031cd6da3caf2dfc2e83d49f75163327b2d07e 2 parents edbee09 + 5ac4c6f
@everzet everzet authored
Showing with 1,127 additions and 285 deletions.
  1. +9 −0 CHANGES.md
  2. +4 −6 README.md
  3. +1 −11 bin/install_selenium
  4. +14 −173 composer.json
  5. +185 −0 composer/packages.json
  6. +143 −0 i18n/cs.xliff
  7. +14 −2 {src/Behat/Mink/Behat/Context/translations → i18n}/de.xliff
  8. 0  {src/Behat/Mink/Behat/Context/translations → i18n}/es.xliff
  9. 0  {src/Behat/Mink/Behat/Context/translations → i18n}/fr.xliff
  10. 0  {src/Behat/Mink/Behat/Context/translations → i18n}/ja.xliff
  11. 0  {src/Behat/Mink/Behat/Context/translations → i18n}/nl.xliff
  12. +143 −0 i18n/pl.xliff
  13. 0  {src/Behat/Mink/Behat/Context/translations → i18n}/pt.xliff
  14. 0  {src/Behat/Mink/Behat/Context/translations → i18n}/ru.xliff
  15. 0  {src/Behat/Mink/Behat/Context/translations → i18n}/sv.xliff
  16. +63 −21 src/Behat/Mink/Behat/Context/BaseMinkContext.php
  17. +8 −9 src/Behat/Mink/Behat/Context/MinkContext.php
  18. +3 −0  src/Behat/Mink/Compiler/PearCompiler.php
  19. +3 −0  src/Behat/Mink/Compiler/PharCompiler.php
  20. +39 −0 src/Behat/Mink/Driver/Goutte/Client.php
  21. +23 −0 src/Behat/Mink/Driver/Goutte/CookieJar.php
  22. +24 −7 src/Behat/Mink/Driver/GoutteDriver.php
  23. +27 −9 src/Behat/Mink/Driver/SahiDriver.php
  24. +12 −8 src/Behat/Mink/Driver/Selenium2Driver.php
  25. +2 −1  src/Behat/Mink/Driver/SeleniumDriver.php
  26. +2 −18 src/Behat/Mink/Driver/ZombieDriver.php
  27. +10 −0 src/Behat/Mink/Element/NodeElement.php
  28. +12 −3 src/Behat/Mink/Exception/ElementHtmlException.php
  29. +12 −3 src/Behat/Mink/Exception/ElementNotFoundException.php
  30. +12 −3 src/Behat/Mink/Exception/ElementTextException.php
  31. +1 −1  src/Behat/Mink/Exception/Exception.php
  32. +12 −3 src/Behat/Mink/Exception/ExpectationException.php
  33. +12 −3 src/Behat/Mink/Exception/ResponseTextException.php
  34. +32 −0 src/Behat/Mink/PHPUnit/Constraints/PageContains.php
  35. +31 −3 src/Behat/Mink/PHPUnit/TestCase.php
  36. +76 −0 tests/Behat/Mink/Driver/GeneralDriverTest.php
  37. +12 −0 tests/Behat/Mink/Driver/JavascriptDriverTest.php
  38. +15 −0 tests/Behat/Mink/Driver/SahiDriverTest.php
  39. +5 −0 tests/Behat/Mink/Driver/SeleniumDriverTest.php
  40. +5 −0 tests/Behat/Mink/Driver/ZombieDriverTest.php
  41. +1 −1  tests/Behat/Mink/Driver/web-fixtures/index.php
  42. +14 −0 tests/Behat/Mink/Driver/web-fixtures/issue130.php
  43. +18 −0 tests/Behat/Mink/Driver/web-fixtures/issue140.php
  44. +23 −0 tests/Behat/Mink/Driver/web-fixtures/issue162.php
  45. +26 −0 tests/Behat/Mink/Driver/web-fixtures/issue193.html
  46. +25 −0 tests/Behat/Mink/Driver/web-fixtures/issue211.php
  47. +10 −0 tests/Behat/Mink/Driver/web-fixtures/issue212.php
  48. +1 −0  tests/Behat/Mink/Driver/web-fixtures/links.php
  49. +43 −0 tests/Behat/Mink/PHPUnit/TestCaseTest.php
View
9 CHANGES.md
@@ -1,3 +1,12 @@
+1.3.3 / 2012-03-23
+==================
+
+ * Prevent exceptions in `__toString()`
+ * Added couple of useful step definitions for Behat
+ * Fixed issues #168, #211, #212, #208
+ * Lot of small bug fixes and improvements
+ * Fixed dependencies and composer installation routine
+
1.3.2 / 2011-12-21
==================
View
10 README.md 100644 → 100755
@@ -97,18 +97,16 @@ phpunit --group gouttedriver
Translated languages
--------------------
-For now exists 6 translated language: `es`,`fr`,`ja`,`nl`,`pt`,`ru`.
+For now exist 10 translated languages: `cs`,`de`,`es`,`fr`,`ja`,`nl`,`pl`,`pt`,`ru`,`sv`.
-**Note:** The `es` and `fr` are outdated.
+**Note:** The `ja`,`nl`,`pt` and `sv` are outdated.
#### How to add a new translated language?
If you want to translate another language, you can use as reference the `ru` language file under
-[translations folder](https://github.com/Behat/Mink/tree/develop/src/Behat/Mink/Behat/Context/translations).
-
-Then add it in [MinkContext](https://github.com/Behat/Mink/blob/develop/src/Behat/Mink/Behat/Context/MinkContext.php) after line #657.
+[translations folder](https://github.com/Behat/Mink/tree/develop/i18n).
-**Important:** The filename must match with the same translated language file in [Behat](https://github.com/Behat/Behat/tree/master/i18n) and [Gherkin](https://github.com/Behat/Gherkin/tree/master/i18n) in order to work correctly. If the language does not exist in [Gherkin](https://github.com/Behat/Gherkin/tree/master/i18n) and [Behat](https://github.com/Behat/Behat/tree/master/i18n) you must add it there too.
+**Important:** The filename must match with the same translated language file in [Behat](https://github.com/Behat/Behat/tree/master/i18n) and [Gherkin](https://github.com/Behat/Gherkin/tree/master/i18n) in order to work correctly. If the language does not exist in [Gherkin](https://github.com/Behat/Gherkin/tree/master/i18n) and [Behat](https://github.com/Behat/Behat/tree/master/i18n) you must add it there too.
Copyright
---------
View
12 bin/install_selenium
@@ -3,14 +3,4 @@
BASEDIR=$(dirname $0)
cd $BASEDIR/../vendor
-wget http://selenium.googlecode.com/files/selenium-server-standalone-2.15.0.jar -O selenium.jar
-
-jar xf selenium.jar core/scripts/atoms.js
-ed -- "core/scripts/atoms.js" <<-PATCH
- 9423s|a.|XPCNativeWrapper(a).|
- w
- q
-PATCH
-jar -uf selenium.jar core
-
-rm -r core
+wget http://selenium.googlecode.com/files/selenium-server-standalone-2.20.0.jar -O selenium.jar
View
187 composer.json
@@ -6,7 +6,7 @@
"type": "library",
"license": "MIT",
- "authors": [
+ "authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
@@ -15,14 +15,17 @@
],
"require": {
- "php": ">=5.3.1",
- "symfony/browser-kit": ">=2.0",
- "symfony/dom-crawler": ">=2.0",
- "symfony/css-selector": ">=2.0",
- "symfony/finder": ">=2.0",
- "symfony/process": ">=2.0",
+ "php": ">=5.3.1",
+ "symfony/browser-kit": ">=2.0,<2.2-dev",
+ "symfony/dom-crawler": ">=2.0,<2.2-dev",
+ "symfony/css-selector": ">=2.0,<2.2-dev",
+ "symfony/finder": ">=2.0,<2.2-dev",
+ "symfony/process": ">=2.0,<2.2-dev"
+ },
+
+ "recommend": {
"fabpot/goutte": "*",
- "behat/sahi-client": ">=1.0.1",
+ "behat/sahi-client": ">=1.0.1,<1.1-dev",
"alexandresalome/php-selenium": "*",
"facebook/php-webdriver": "*"
},
@@ -34,171 +37,9 @@
},
"repositories": {
- "fabpot/goutte": {
- "type": "package",
- "package": {
- "name": "fabpot/goutte",
- "version": "master-dev",
- "dist": {
- "url": "https://github.com/fabpot/Goutte/zipball/master",
- "type": "zip"
- },
- "source": {
- "url": "git://github.com/fabpot/Goutte.git",
- "type": "git",
- "reference": "master"
- },
- "require": {
- "symfony/browser-kit": ">=2.0",
- "symfony/dom-crawler": ">=2.0",
- "symfony/css-selector": ">=2.0",
- "symfony/finder": ">=2.0",
- "symfony/process": ">=2.0",
- "zendframework/zend-registry": ">=2.0beta1,<3.0",
- "zendframework/zend-loader": ">=2.0beta1,<3.0",
- "zendframework/zend-stdlib": ">=2.0beta1,<3.0",
- "zendframework/zend-validator": ">=2.0beta1,<3.0",
- "zendframework/zend-http": ">=2.0beta1,<3.0",
- "zendframework/zend-uri": ">=2.0beta1,<3.0"
- },
- "autoload": {
- "psr-0": { "Goutte": "src/" }
- }
- }
- },
- "alexandresalome/php-selenium": {
- "type": "package",
- "package": {
- "name": "alexandresalome/php-selenium",
- "version": "master-dev",
- "dist": {
- "url": "https://github.com/alexandresalome/PHP-Selenium/zipball/master",
- "type": "zip"
- },
- "source": {
- "url": "git://github.com/alexandresalome/PHP-Selenium.git",
- "type": "git",
- "reference": "master"
- },
- "require": {
- "symfony/dom-crawler": ">=2.0"
- },
- "autoload": {
- "psr-0": { "Selenium": "src/" }
- }
- }
- },
- "facebook/php-webdriver": {
- "type": "package",
- "package": {
- "name": "facebook/php-webdriver",
- "version": "master-dev",
- "dist": {
- "url": "https://github.com/facebook/php-webdriver/zipball/master",
- "type": "zip"
- },
- "source": {
- "url": "git://github.com/facebook/php-webdriver.git",
- "type": "git",
- "reference": "master"
- },
- "autoload": {
- "psr-0": {
- "WebDriverBase": ".",
- "WebDriver": ".",
- "WebDriverContainer": ".",
- "WebDriverSession": ".",
- "WebDriverElement": ".",
- "WebDriverEnvironment": ".",
- "WebDriverExceptions": ".",
- "WebDriverSimpleItem": "."
- }
- }
- }
- },
- "zendframework/zend-registry": {
- "type": "package",
- "package": {
- "name": "zendframework/zend-registry",
- "version": "2.0.0beta1",
- "dist": {
- "url": "http://packages.zendframework.com/get/Zend_Registry-2.0.0beta1.tgz",
- "type": "pear"
- },
- "autoload": {
- "psr-0": { "Zend\\Registry": "php/" }
- }
- }
- },
- "zendframework/zend-loader": {
- "type": "package",
- "package": {
- "name": "zendframework/zend-loader",
- "version": "2.0.0beta1",
- "dist": {
- "url": "http://packages.zendframework.com/get/Zend_Loader-2.0.0beta1.tgz",
- "type": "pear"
- },
- "autoload": {
- "psr-0": { "Zend\\Loader": "php/" }
- }
- }
- },
- "zendframework/zend-stdlib": {
- "type": "package",
- "package": {
- "name": "zendframework/zend-stdlib",
- "version": "2.0.0beta1",
- "dist": {
- "url": "http://packages.zendframework.com/get/Zend_Stdlib-2.0.0beta1.tgz",
- "type": "pear"
- },
- "autoload": {
- "psr-0": { "Zend\\Stdlib": "php/" }
- }
- }
- },
- "zendframework/zend-validator": {
- "type": "package",
- "package": {
- "name": "zendframework/zend-validator",
- "version": "2.0.0beta1",
- "dist": {
- "url": "http://packages.zendframework.com/get/Zend_Validator-2.0.0beta1.tgz",
- "type": "pear"
- },
- "autoload": {
- "psr-0": { "Zend\\Validator": "php/" }
- }
- }
- },
- "zendframework/zend-http": {
- "type": "package",
- "package": {
- "name": "zendframework/zend-http",
- "version": "2.0.0beta1",
- "dist": {
- "url": "http://packages.zendframework.com/get/Zend_Http-2.0.0beta1.tgz",
- "type": "pear"
- },
- "autoload": {
- "psr-0": { "Zend\\Http": "php/" }
- }
- }
- },
- "zendframework/zend-uri": {
- "type": "package",
- "package": {
- "name": "zendframework/zend-uri",
- "version": "2.0.0beta1",
- "dist": {
- "url": "http://packages.zendframework.com/get/Zend_Uri-2.0.0beta1.tgz",
- "type": "pear"
- },
- "autoload": {
- "psr-0": { "Zend\\Uri": "php/" }
- }
- }
+ "behat/mink-deps": {
+ "type": "composer",
+ "url": "behat.org"
}
}
}
View
185 composer/packages.json
@@ -0,0 +1,185 @@
+{
+ "fabpot\/goutte": {
+ "name": "fabpot\/goutte",
+ "versions": {
+ "master-dev": {
+ "name": "fabpot\/goutte",
+ "version": "master-dev",
+ "dist": {
+ "url": "https:\/\/github.com\/fabpot\/Goutte\/zipball\/master",
+ "type": "zip"
+ },
+ "source": {
+ "url": "git:\/\/github.com\/fabpot\/Goutte.git",
+ "type": "git",
+ "reference": "master"
+ },
+ "require": {
+ "symfony\/browser-kit": ">=2.0",
+ "symfony\/dom-crawler": ">=2.0",
+ "symfony\/css-selector": ">=2.0",
+ "symfony\/finder": ">=2.0",
+ "symfony\/process": ">=2.0",
+ "zendframework\/zend-registry": ">=2.0beta3,<3.0",
+ "zendframework\/zend-loader": ">=2.0beta3,<3.0",
+ "zendframework\/zend-stdlib": ">=2.0beta3,<3.0",
+ "zendframework\/zend-validator": ">=2.0beta3,<3.0",
+ "zendframework\/zend-http": ">=2.0beta3,<3.0",
+ "zendframework\/zend-uri": ">=2.0beta3,<3.0"
+ },
+ "autoload": {
+ "psr-0": { "Goutte": "src\/" }
+ }
+ }
+ }
+ },
+ "alexandresalome\/php-selenium": {
+ "name": "alexandresalome\/php-selenium",
+ "versions": {
+ "master-dev": {
+ "name": "alexandresalome\/php-selenium",
+ "version": "master-dev",
+ "dist": {
+ "url": "https:\/\/github.com\/alexandresalome\/PHP-Selenium\/zipball\/master",
+ "type": "zip"
+ },
+ "source": {
+ "url": "git:\/\/github.com\/alexandresalome\/PHP-Selenium.git",
+ "type": "git",
+ "reference": "master"
+ },
+ "require": {
+ "symfony\/dom-crawler": ">=2.0"
+ },
+ "autoload": {
+ "psr-0": { "Selenium": "src\/" }
+ }
+ }
+ }
+ },
+ "facebook\/php-webdriver": {
+ "name": "facebook\/php-webdriver",
+ "versions": {
+ "master-dev": {
+ "name": "facebook\/php-webdriver",
+ "version": "master-dev",
+ "dist": {
+ "url": "https:\/\/github.com\/facebook\/php-webdriver\/zipball\/master",
+ "type": "zip"
+ },
+ "source": {
+ "url": "git:\/\/github.com\/facebook\/php-webdriver.git",
+ "type": "git",
+ "reference": "master"
+ },
+ "autoload": {
+ "psr-0": {
+ "WebDriverBase": ".",
+ "WebDriver": ".",
+ "WebDriverContainer": ".",
+ "WebDriverSession": ".",
+ "WebDriverElement": ".",
+ "WebDriverEnvironment": ".",
+ "WebDriverSimpleItem": "."
+ }
+ }
+ }
+ }
+ },
+ "zendframework\/zend-registry": {
+ "name": "zendframework\/zend-registry",
+ "versions": {
+ "2.0.0beta3": {
+ "name": "zendframework\/zend-registry",
+ "version": "2.0.0beta3",
+ "dist": {
+ "url": "http:\/\/packages.zendframework.com\/get\/Zend_Registry-2.0.0beta3.tgz",
+ "type": "pear"
+ },
+ "autoload": {
+ "psr-0": { "Zend\\Registry": "php\/" }
+ }
+ }
+ }
+ },
+ "zendframework\/zend-loader": {
+ "name": "zendframework\/zend-loader",
+ "versions": {
+ "2.0.0beta3": {
+ "name": "zendframework\/zend-loader",
+ "version": "2.0.0beta3",
+ "dist": {
+ "url": "http:\/\/packages.zendframework.com\/get\/Zend_Loader-2.0.0beta3.tgz",
+ "type": "pear"
+ },
+ "autoload": {
+ "psr-0": { "Zend\\Loader": "php\/" }
+ }
+ }
+ }
+ },
+ "zendframework\/zend-stdlib": {
+ "name": "zendframework\/zend-stdlib",
+ "versions": {
+ "2.0.0beta3": {
+ "name": "zendframework\/zend-stdlib",
+ "version": "2.0.0beta3",
+ "dist": {
+ "url": "http:\/\/packages.zendframework.com\/get\/Zend_Stdlib-2.0.0beta3.tgz",
+ "type": "pear"
+ },
+ "autoload": {
+ "psr-0": { "Zend\\Stdlib": "php\/" }
+ }
+ }
+ }
+ },
+ "zendframework\/zend-validator": {
+ "name": "zendframework\/zend-validator",
+ "versions": {
+ "2.0.0beta3": {
+ "name": "zendframework\/zend-validator",
+ "version": "2.0.0beta3",
+ "dist": {
+ "url": "http:\/\/packages.zendframework.com\/get\/Zend_Validator-2.0.0beta3.tgz",
+ "type": "pear"
+ },
+ "autoload": {
+ "psr-0": { "Zend\\Validator": "php\/" }
+ }
+ }
+ }
+ },
+ "zendframework\/zend-http": {
+ "name": "zendframework\/zend-http",
+ "versions": {
+ "2.0.0beta3": {
+ "name": "zendframework\/zend-http",
+ "version": "2.0.0beta3",
+ "dist": {
+ "url": "http:\/\/packages.zendframework.com\/get\/Zend_Http-2.0.0beta3.tgz",
+ "type": "pear"
+ },
+ "autoload": {
+ "psr-0": { "Zend\\Http": "php\/" }
+ }
+ }
+ }
+ },
+ "zendframework\/zend-uri": {
+ "name": "zendframework\/zend-uri",
+ "versions": {
+ "2.0.0beta3": {
+ "name": "zendframework\/zend-uri",
+ "version": "2.0.0beta3",
+ "dist": {
+ "url": "http:\/\/packages.zendframework.com\/get\/Zend_Uri-2.0.0beta3.tgz",
+ "type": "pear"
+ },
+ "autoload": {
+ "psr-0": { "Zend\\Uri": "php\/" }
+ }
+ }
+ }
+ }
+}
View
143 i18n/cs.xliff
@@ -0,0 +1,143 @@
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+ <file original="global" source-language="en" target-language="cs" datatype="plaintext">
+ <header />
+ <body>
+ <trans-unit id="i-am-on-page">
+ <source><![CDATA[/^(?:|I )am on "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^jsem na(?:| stránce) "(?P<page>[^"]+)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-go-to-page">
+ <source><![CDATA[/^(?:|I )go to "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^(?:|pře)jdu na(?:| stránku) "(?P<page>[^"]+)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="reload-the-page">
+ <source><![CDATA[/^(?:|I )reload the page$/]]></source>
+ <target><![CDATA[/^obnovím stránku$/]]></target>
+ </trans-unit>
+ <trans-unit id="move-backward-one-page">
+ <source><![CDATA[/^(?:|I )move backward one page$/]]></source>
+ <target><![CDATA[/^(?:|pře)jdu o jednu stránku zpět$/]]></target>
+ </trans-unit>
+ <trans-unit id="move-forward-one-page">
+ <source><![CDATA[/^(?:|I )move forward one page$/]]></source>
+ <target><![CDATA[/^(?:|pře)jdu o jednu stránku vpřed$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-press-button">
+ <source><![CDATA[/^(?:|I )press "(?P<button>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^stisknu(?:| tlačítko) "(?P<button>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-follow-link">
+ <source><![CDATA[/^(?:|I )follow "(?P<link>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^kliknu na(?:| odkaz) "(?P<link>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-field-with-value">
+ <source><![CDATA[/^(?:|I )fill in "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^zadám do "(?P<field>(?:[^"]|\\")*)" hodnotu "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-value-for-field">
+ <source><![CDATA[/^(?:|I )fill in "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^zadám "(?P<value>(?:[^"]|\\")*)" do "(?P<field>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-the-following">
+ <source><![CDATA[/^(?:|I )fill in the following:$/]]></source>
+ <target><![CDATA[/^vyplním formulář:$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-select-option-from-select">
+ <source><![CDATA[/^(?:|I )select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^vyberu "(?P<option>(?:[^"]|\\")*)" z "(?P<select>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-additionally-select-option-from-select">
+ <source><![CDATA[/^(?:|I )additionally select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^ještě vyberu "(?P<option>(?:[^"]|\\")*)" z "(?P<select>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-check-option">
+ <source><![CDATA[/^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:zaškrtnu|označím) "(?P<option>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-uncheck-option">
+ <source><![CDATA[/^(?:|I )uncheck "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^odznačím "(?P<option>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-attach-the-file-to-field">
+ <source><![CDATA[/^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^nahraji soubor "(?P<path>[^"]*)" do "(?P<field>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-text">
+ <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^musím vidět(?:| text) "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-should-contain">
+ <source><![CDATA[/^the response should contain "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^stránka musí obsahovat "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-not-see-text">
+ <source><![CDATA[/^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^nesmím vidět(?:| text) "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-should-not-contain">
+ <source><![CDATA[/^the response should not contain "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^stránka nesmí obsahovat "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-field-should-contain-value">
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^pole "(?P<field>(?:[^"]|\\")*)" musí obsahovat "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-field-should-not-contain-value">
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should not contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^pole "(?P<field>(?:[^"]|\\")*)" nesmí obsahovat "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-checkbox-should-be-checked">
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should be checked$/]]></source>
+ <target><![CDATA[/^pole "(?P<checkbox>(?:[^"]|\\")*)" musí být (?:zaškrtnuto|vybráno|označeno)$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-checkbox-should-not-be-checked">
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should not be checked$/]]></source>
+ <target><![CDATA[/^pole "(?P<checkbox>(?:[^"]|\\")*)" nesmí být (?:zaškrtnuto|vybráno|označeno)$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-be-on-page">
+ <source><![CDATA[/^(?:|I )should be on "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^musím být na stránce "(?P<page>[^"]+)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-url-should-match">
+ <source><![CDATA[/^the url should match "(?P<pattern>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:url|adresa|url adresa) musí mít tvar "(?P<pattern>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-element-should-contain">
+ <source><![CDATA[/^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^element "(?P<element>[^"]*)" musí obsahovat "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-text-in-element">
+ <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)" in the "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^musím vidět(?:| text) "(?P<text>(?:[^"]|\\")*)" uvnitř elementu "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-element">
+ <source><![CDATA[/^(?:|I )should see an? "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^musím vidět element "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-not-see-element">
+ <source><![CDATA[/^(?:|I )should not see an? "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^nesmím vidět element "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-num-elements">
+ <source><![CDATA[/^(?:|I )should see (?P<num>\d+) "(?P<element>[^"]*)" elements?$/]]></source>
+ <target><![CDATA[/^musím vidět (?P<num>\d+) element(?:|y|ů) "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-status-code-should-be">
+ <source><![CDATA[/^the response status code should be (?P<code>\d+)$/]]></source>
+ <target><![CDATA[/^(?:|stavový )kód odpovědi serveru musí být (?P<code>\d+)$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-status-code-should-not-be">
+ <source><![CDATA[/^the response status code should not be (?P<code>\d+)$/]]></source>
+ <target><![CDATA[/^(?:|stavový )kód odpovědi serveru nesmí být (?P<code>\d+)$/]]></target>
+ </trans-unit>
+ <trans-unit id="print-last-response">
+ <source><![CDATA[/^print last response$/]]></source>
+ <target><![CDATA[/^vypiš (?:|poslední )stránku$/]]></target>
+ </trans-unit>
+ <trans-unit id="show-last-response">
+ <source><![CDATA[/^show last response$/]]></source>
+ <target><![CDATA[/^zobraz (?:|poslední )stránku$/]]></target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
View
16 .../Mink/Behat/Context/translations/de.xliff → i18n/de.xliff
@@ -36,7 +36,7 @@
</trans-unit>
<trans-unit id="i-fill-in-value-for-field">
<source><![CDATA[/^(?:|I )fill in "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/]]></source>
- <target><![CDATA[/^(?:|ich )gebe "(?P<value>(?:[^"]|\\")*)" in "(?P<field>(?:[^"]|\\")*)"ein$/]]></target>
+ <target><![CDATA[/^(?:|ich )gebe "(?P<value>(?:[^"]|\\")*)" in "(?P<field>(?:[^"]|\\")*)" ein$/]]></target>
</trans-unit>
<trans-unit id="i-fill-in-the-following">
<source><![CDATA[/^(?:|I )fill in the following:$/]]></source>
@@ -46,6 +46,10 @@
<source><![CDATA[/^(?:|I )select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source>
<target><![CDATA[/^(?:|ich )wähle "(?P<option>(?:[^"]|\\")*)" von "(?P<select>(?:[^"]|\\")*)"$/]]></target>
</trans-unit>
+ <trans-unit id="i-additionally-select-option-from-select">
+ <source><![CDATA[/^(?:|I )additionally select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ich )wähle zusätzlich "(?P<option>(?:[^"]|\\")*)" von "(?P<select>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
<trans-unit id="i-check-option">
<source><![CDATA[/^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/]]></source>
<target><![CDATA[/^(?:|ich )aktiviere "(?P<option>(?:[^"]|\\")*)"$/]]></target>
@@ -92,7 +96,7 @@
</trans-unit>
<trans-unit id="i-should-be-on-page">
<source><![CDATA[/^(?:|I )should be on "(?P<page>[^"]+)"$/]]></source>
- <target><![CDATA[/^(?:|ich )sollte auf "(?P<page>[^"]+) sein"$/]]></target>
+ <target><![CDATA[/^(?:|ich )sollte auf "(?P<page>[^"]+)" sein$/]]></target>
</trans-unit>
<trans-unit id="the-url-should-match">
<source><![CDATA[/^the url should match "(?P<pattern>(?:[^"]|\\")*)"$/]]></source>
@@ -114,10 +118,18 @@
<source><![CDATA[/^(?:|I )should not see an? "(?P<element>[^"]*)" element$/]]></source>
<target><![CDATA[/^(?:|ich )sollte kein "(?P<element>[^"]*)" Element sehen$/]]></target>
</trans-unit>
+ <trans-unit id="i-should-see-num-elements">
+ <source><![CDATA[/^(?:|I )should see (?P<num>\d+) "(?P<element>[^"]*)" elements?$/]]></source>
+ <target><![CDATA[/^(?:|ich )sollte (?P<num>\d+) "(?P<element>[^"]*)" Elemente? sehen$/]]></target>
+ </trans-unit>
<trans-unit id="the-response-status-code-should-be">
<source><![CDATA[/^the response status code should be (?P<code>\d+)$/]]></source>
<target><![CDATA[/^die Status-Code-Rückmeldung sollte (?P<code>\d+) sein$/]]></target>
</trans-unit>
+ <trans-unit id="the-response-status-code-should-not-be">
+ <source><![CDATA[/^the response status code should not be (?P<code>\d+)$/]]></source>
+ <target><![CDATA[/^die Status-Code-Rückmeldung sollte nicht (?P<code>\d+) sein$/]]></target>
+ </trans-unit>
<trans-unit id="print-last-response">
<source><![CDATA[/^print last response$/]]></source>
<target><![CDATA[/^gib die letzte Rückmeldung aus$/]]></target>
View
0  .../Mink/Behat/Context/translations/es.xliff → i18n/es.xliff
File renamed without changes
View
0  .../Mink/Behat/Context/translations/fr.xliff → i18n/fr.xliff
File renamed without changes
View
0  .../Mink/Behat/Context/translations/ja.xliff → i18n/ja.xliff
File renamed without changes
View
0  .../Mink/Behat/Context/translations/nl.xliff → i18n/nl.xliff
File renamed without changes
View
143 i18n/pl.xliff
@@ -0,0 +1,143 @@
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+ <file original="global" source-language="en" target-language="pl" datatype="plaintext">
+ <header />
+ <body>
+ <trans-unit id="i-am-on-page">
+ <source><![CDATA[/^(?:|I )am on "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^(?:|że )jestem na stronie "(?P<page>[^"]+)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-go-to-page">
+ <source><![CDATA[/^(?:|I )go to "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^(?:|że )odwiedzę stronę "(?P<page>[^"]+)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="reload-the-page">
+ <source><![CDATA[/^(?:|I )reload the page$/]]></source>
+ <target><![CDATA[/^(?:|że )odświeżę stronę$/]]></target>
+ </trans-unit>
+ <trans-unit id="move-backward-one-page">
+ <source><![CDATA[/^(?:|I )move backward one page$/]]></source>
+ <target><![CDATA[/^(?:|że )cofnę się do poprzedniej strony$/]]></target>
+ </trans-unit>
+ <trans-unit id="move-forward-one-page">
+ <source><![CDATA[/^(?:|I )move forward one page$/]]></source>
+ <target><![CDATA[/^(?:|że )przejdę na kolejną stronę$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-press-button">
+ <source><![CDATA[/^(?:|I )press "(?P<button>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|że )nacisnę przycisk "(?P<button>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-follow-link">
+ <source><![CDATA[/^(?:|I )follow "(?P<link>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|że )kliknę na link "(?P<link>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-field-with-value">
+ <source><![CDATA[/^(?:|I )fill in "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|że )wypełnię pole "(?P<field>(?:[^"]|\\")*)" wartością "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-value-for-field">
+ <source><![CDATA[/^(?:|I )fill in "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|że )wpiszę "(?P<value>(?:[^"]|\\")*)" w polu "(?P<field>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-the-following">
+ <source><![CDATA[/^(?:|I )fill in the following:$/]]></source>
+ <target><![CDATA[/^(?:|że )wypełnię następujące pola:$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-select-option-from-select">
+ <source><![CDATA[/^(?:|I )select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|że )wybiorę opcję "(?P<option>(?:[^"]|\\")*)" w polu "(?P<select>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-additionally-select-option-from-select">
+ <source><![CDATA[/^(?:|I )additionally select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|że )dodatkowo zaznaczę opcję "(?P<option>(?:[^"]|\\")*)" w polu "(?P<select>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-check-option">
+ <source><![CDATA[/^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|że )zaznaczę opcję "(?P<option>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-uncheck-option">
+ <source><![CDATA[/^(?:|I )uncheck "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|że )odznaczę opcję "(?P<option>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-attach-the-file-to-field">
+ <source><![CDATA[/^(?:|I )attach the file "(?P<path>[^"]*)" to "(?P<field>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|że )załączę plik "(?P<path>[^"]*)" w polu "(?P<field>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-text">
+ <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|że )zobaczę tekst "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-should-contain">
+ <source><![CDATA[/^the response should contain "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^odpowiedź powinna zawierać tekst "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-not-see-text">
+ <source><![CDATA[/^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|że )nie zobaczę tekstu "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-should-not-contain">
+ <source><![CDATA[/^the response should not contain "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^odpowiedź nie powinna zawierać tekstu "(?P<text>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-field-should-contain-value">
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^pole "(?P<field>(?:[^"]|\\")*)" powinno zawierać wartość "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-field-should-not-contain-value">
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should not contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^pole "(?P<field>(?:[^"]|\\")*)" nie powinno zawierać wartości "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-checkbox-should-be-checked">
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should be checked$/]]></source>
+ <target><![CDATA[/^pole "(?P<checkbox>(?:[^"]|\\")*)" jest zaznaczone$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-checkbox-should-not-be-checked">
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should not be checked$/]]></source>
+ <target><![CDATA[/^pole "(?P<checkbox>(?:[^"]|\\")*)" jest odznaczone$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-be-on-page">
+ <source><![CDATA[/^(?:|I )should be on "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^(?:|że )powinienem być na stronie "(?P<page>[^"]+)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-url-should-match">
+ <source><![CDATA[/^the url should match "(?P<pattern>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:url|adres) powinien odpowiadać "(?P<pattern>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-element-should-contain">
+ <source><![CDATA[/^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^element "(?P<element>[^"]*)" powinien zawierać "(?P<value>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-text-in-element">
+ <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)" in the "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^(?:|że )powinienem widzieć "(?P<text>(?:[^"]|\\")*)" wewnątrz elementu "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-element">
+ <source><![CDATA[/^(?:|I )should see an? "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^(?:|że )powinienem widzieć element "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-not-see-element">
+ <source><![CDATA[/^(?:|I )should not see an? "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^(?:|że )nie powinienem widzieć elementu "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-num-elements">
+ <source><![CDATA[/^(?:|I )should see (?P<num>\d+) "(?P<element>[^"]*)" elements?$/]]></source>
+ <target><![CDATA[/^(?:|że )powinienem widzieć (?P<num>\d+) element(y|ów)? "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-status-code-should-be">
+ <source><![CDATA[/^the response status code should be (?P<code>\d+)$/]]></source>
+ <target><![CDATA[/^kod statusu odpowiedzi powinien być równy (?P<code>\d+)$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-status-code-should-not-be">
+ <source><![CDATA[/^the response status code should not be (?P<code>\d+)$/]]></source>
+ <target><![CDATA[/^kod statusu odpowiedzi nie powinien być równy (?P<code>\d+)$/]]></target>
+ </trans-unit>
+ <trans-unit id="print-last-response">
+ <source><![CDATA[/^print last response$/]]></source>
+ <target><![CDATA[/^wypisz ostatnią odpowiedź$/]]></target>
+ </trans-unit>
+ <trans-unit id="show-last-response">
+ <source><![CDATA[/^show last response$/]]></source>
+ <target><![CDATA[/^pokaż ostatnią odpowiedź$/]]></target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
View
0  .../Mink/Behat/Context/translations/pt.xliff → i18n/pt.xliff
File renamed without changes
View
0  .../Mink/Behat/Context/translations/ru.xliff → i18n/ru.xliff
File renamed without changes
View
0  .../Mink/Behat/Context/translations/sv.xliff → i18n/sv.xliff
File renamed without changes
View
84 src/Behat/Mink/Behat/Context/BaseMinkContext.php
@@ -277,17 +277,10 @@ public function assertPageAddress($page)
/**
* Checks, that current page PATH matches regular expression.
*
- * @Then /^the (?i)url(?-i) should match "(?P<pattern>(?:[^"]|\\")*)"$/
+ * @Then /^the (?i)url(?-i) should match (?P<pattern>\/([^\/]|\\\/)*\/)$/
*/
public function assertUrlRegExp($pattern)
{
- $pattern = str_replace('\\"', '"', $pattern);
- if (!preg_match('/^\/.*\/$/', $pattern)) {
- $this->assertPageAddress($pattern);
-
- return;
- }
-
$actual = parse_url($this->getSession()->getCurrentUrl(), PHP_URL_PATH);
try {
@@ -351,7 +344,7 @@ public function assertPageContainsText($text)
}
/**
- * Checks, that page doesn't contains specified text.
+ * Checks, that page doesn't contain specified text.
*
* @Then /^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/
*/
@@ -369,6 +362,40 @@ public function assertPageNotContainsText($text)
}
/**
+ * Checks, that page contains text matching specified pattern.
+ *
+ * @Then /^(?:|I )should see text matching (?P<pattern>"(?:[^"]|\\")*")$/
+ */
+ public function assertPageMatchesText($pattern)
+ {
+ $actual = $this->getSession()->getPage()->getText();
+
+ try {
+ assertRegExp($pattern, $actual);
+ } catch (AssertException $e) {
+ $message = sprintf('The pattern %s was not found anywhere in the text of the current page.', $pattern);
+ throw new ResponseTextException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
+ * Checks, that page doesn't contain text matching specified pattern.
+ *
+ * @Then /^(?:|I )should not see text matching (?P<pattern>"(?:[^"]|\\")*")$/
+ */
+ public function assertPageNotMatchesText($pattern)
+ {
+ $actual = $this->getSession()->getPage()->getText();
+
+ try {
+ assertNotRegExp($pattern, $actual);
+ } catch (AssertException $e) {
+ $message = sprintf('The pattern %s was found in the text of the current page, but it should not.', $pattern);
+ throw new ResponseTextException($message, $this->getSession(), $e);
+ }
+ }
+
+ /**
* Checks, that HTML response contains specified string.
*
* @Then /^the response should contain "(?P<text>(?:[^"]|\\")*)"$/
@@ -387,7 +414,7 @@ public function assertResponseContains($text)
}
/**
- * Checks, that HTML response doesn't contains specified string.
+ * Checks, that HTML response doesn't contain specified string.
*
* @Then /^the response should not contain "(?P<text>(?:[^"]|\\")*)"$/
*/
@@ -429,6 +456,30 @@ public function assertElementContainsText($element, $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)
+ {
+ $node = $this->getSession()->getPage()->find('css', $element);
+ $text = str_replace('\\"', '"', $text);
+
+ if (null === $node) {
+ throw new ElementNotFoundException(
+ $this->getSession(), 'element', 'css', $element
+ );
+ }
+
+ try {
+ assertNotContains($text, $node->getText());
+ } catch (AssertException $e) {
+ $message = sprintf('The text "%s" appears in the text of the element matching css "%s", but it should not.', $text, $element);
+ throw new ElementTextException($message, $this->getSession(), $node, $e);
+ }
+ }
+
+ /**
* Checks, that element with specified CSS contains specified HTML.
*
* @Then /^the "(?P<element>[^"]*)" element should contain "(?P<value>(?:[^"]|\\")*)"$/
@@ -469,7 +520,7 @@ public function assertElementOnPage($element)
}
/**
- * Checks, that element with specified CSS doesn't exists on page.
+ * Checks, that element with specified CSS doesn't exist on page.
*
* @Then /^(?:|I )should not see an? "(?P<element>[^"]*)" element$/
*/
@@ -633,15 +684,6 @@ public function showLastResponse()
*/
public function getTranslationResources()
{
- return array(
- __DIR__ . '/translations/ru.xliff',
- __DIR__ . '/translations/fr.xliff',
- __DIR__ . '/translations/ja.xliff',
- __DIR__ . '/translations/es.xliff',
- __DIR__ . '/translations/nl.xliff',
- __DIR__ . '/translations/pt.xliff',
- __DIR__ . '/translations/sv.xliff',
- __DIR__ . '/translations/de.xliff',
- );
+ return glob(__DIR__.'/../../../../../i18n/*.xliff');
}
}
View
17 src/Behat/Mink/Behat/Context/MinkContext.php 100644 → 100755
@@ -7,19 +7,17 @@
use Behat\Mink\Mink,
Behat\Mink\Session,
Behat\Mink\Driver\GoutteDriver,
+ Behat\Mink\Driver\Goutte\Client as GoutteClient,
Behat\Mink\Driver\SahiDriver,
Behat\Mink\Driver\ZombieDriver,
+ Behat\Mink\Driver\Zombie\Connection as ZombieConnection,
+ Behat\Mink\Driver\Zombie\Server as ZombieServer,
Behat\Mink\Driver\SeleniumDriver,
Behat\Mink\Driver\Selenium2Driver;
-use Goutte\Client as GoutteClient;
-
use Behat\SahiClient\Connection as SahiConnection,
Behat\SahiClient\Client as SahiClient;
-use Behat\Mink\Driver\Zombie\Connection as ZombieConnection,
- Behat\Mink\Driver\Zombie\Server as ZombieServer;
-
use Selenium\Client as SeleniumClient;
/*
@@ -145,7 +143,7 @@ protected static function registerMinkSessions(Mink $mink, array $parameters)
$params = $parameters['webdriver'];
$browser = $parameters['browser'];
$mink->registerSession('webdriver', static::initWebdriverSession(
- $browser, $params['host']
+ $browser, $params['host'],$params['capabilities']
));
}
}
@@ -225,9 +223,9 @@ protected static function initSeleniumSession($browser = '*firefox',
* @return Behat\Mink\Session
*/
protected static function initWebdriverSession($browser = 'firefox',
- $host = 'http://localhost:4444/wd/hub')
+ $host = 'http://localhost:4444/wd/hub',$capabilities = null)
{
- return new Session(new Selenium2Driver($browser, null, $host));
+ return new Session(new Selenium2Driver($browser, $capabilities, $host));
}
/**
@@ -264,7 +262,8 @@ protected static function getDefaultParameters()
'port' => 4444
),
'webdriver' => array(
- 'host' => 'http://localhost:4444/wd/hub'
+ 'host' => 'http://localhost:4444/wd/hub',
+ 'capabilities' => Selenium2Driver::getDefaultCapabilities()
),
);
}
View
3  src/Behat/Mink/Compiler/PearCompiler.php
@@ -66,6 +66,7 @@ public function compile($version, $stability)
'vendor',
))
->in($this->libPath . '/src')
+ ->in($this->libPath . '/i18n')
->in($this->libPath . '/vendor/.composer')
->in($this->libPath . '/vendor/alexandresalome')
->in($this->libPath . '/vendor/behat')
@@ -84,6 +85,8 @@ public function compile($version, $stability)
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Ip.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Com.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Jp.php',
+ $this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Cn.php',
+ $this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Biz.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/Dispatchable.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/Message.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/MessageDescription.php',
View
3  src/Behat/Mink/Compiler/PharCompiler.php
@@ -70,6 +70,7 @@ public function compile($version)
'vendor',
))
->in($this->libPath . '/src')
+ ->in($this->libPath . '/i18n')
->in($this->libPath . '/vendor/.composer')
->in($this->libPath . '/vendor/symfony')
->in($this->libPath . '/vendor/alexandresalome')
@@ -89,6 +90,8 @@ public function compile($version)
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Ip.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Com.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Jp.php',
+ $this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Cn.php',
+ $this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Biz.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/Dispatchable.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/Message.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/MessageDescription.php',
View
39 src/Behat/Mink/Driver/Goutte/Client.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace Behat\Mink\Driver\Goutte;
+
+use Symfony\Component\BrowserKit\Request;
+use Symfony\Component\BrowserKit\History;
+use Goutte\Client as BaseClient;
+
+/**
+ * Goutte extension point.
+ */
+class Client extends BaseClient
+{
+ protected function createClient(Request $request)
+ {
+ // create new request without content body
+ $client = parent::createClient(new Request(
+ $request->getUri(),
+ $request->getMethod(),
+ $request->getParameters(),
+ $request->getFiles(),
+ $request->getCookies(),
+ $request->getServer()
+ ));
+
+ // add server variables
+ $headers = $this->headers;
+ foreach ($request->getServer() as $key => $val) {
+ $key = ucfirst(strtolower(str_replace(array('_', 'HTTP-'), array('-', ''), $key)));
+
+ if (!isset($headers[$key])) {
+ $headers[$key] = $val;
+ }
+ }
+ $client->setHeaders($headers);
+
+ return $client;
+ }
+}
View
23 src/Behat/Mink/Driver/Goutte/CookieJar.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Behat\Mink\Driver\Goutte;
+
+use Symfony\Component\BrowserKit\Response;
+use Symfony\Component\BrowserKit\Cookie;
+use Symfony\Component\BrowserKit\CookieJar as BaseJar;
+
+/**
+ * CookieJar.
+ */
+class CookieJar extends BaseJar
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function updateFromResponse(Response $response, $uri = null)
+ {
+ foreach ($response->getHeader('Set-Cookie', false) as $cookie) {
+ $this->set(Cookie::fromString($cookie, $uri));
+ }
+ }
+}
View
31 src/Behat/Mink/Driver/GoutteDriver.php
@@ -2,7 +2,7 @@
namespace Behat\Mink\Driver;
-use Goutte\Client as GoutteClient,
+use Behat\Mink\Driver\Goutte\Client as GoutteClient,
Symfony\Component\BrowserKit\Client,
Symfony\Component\BrowserKit\Cookie,
Symfony\Component\DomCrawler\Crawler,
@@ -194,10 +194,23 @@ public function setCookie($name, $value = null)
*/
public function getCookie($name)
{
- $jar = $this->client->getCookieJar();
-
- if (null !== $cookie = $jar->get($name)) {
- return $cookie->getValue();
+ // Note that the following doesn't work well because
+ // Symfony\Component\BrowserKit\CookieJar stores cookies by name,
+ // path, AND domain and if you don't fill them all in correctly then
+ // you won't get the value that you're expecting.
+ //
+ // $jar = $this->client->getCookieJar();
+ //
+ // if (null !== $cookie = $jar->get($name)) {
+ // return $cookie->getValue();
+ // }
+
+ $allValues = $this->client->getCookieJar()->allValues($this->getCurrentUrl());
+
+ if (isset($allValues[$name])) {
+ return $allValues[$name];
+ } else {
+ return null;
}
}
@@ -281,6 +294,10 @@ public function getAttribute($xpath, $attr)
*/
public function getValue($xpath)
{
+ if (in_array($this->getAttribute($xpath, 'type'), array('submit', 'image', 'button'))) {
+ return $this->getAttribute($xpath, 'value');
+ }
+
try {
$field = $this->getFormField($xpath);
} catch (\InvalidArgumentException $e) {
@@ -374,7 +391,7 @@ public function click($xpath)
*/
public function isChecked($xpath)
{
- return true === $this->getValue($xpath);
+ return (bool) $this->getValue($xpath);
}
/**
@@ -613,7 +630,7 @@ private function mergeForms(Form $to, Form $from)
$nodeReflection->setAccessible(true);
$valueReflection->setAccessible(true);
- if (!($field instanceof Field\InputtoField && in_array(
+ if (!($field instanceof Field\InputFormField && in_array(
$nodeReflection->getValue($field)->getAttribute('type'),
array('submit', 'button', 'image')
))) {
View
36 src/Behat/Mink/Driver/SahiDriver.php
@@ -213,11 +213,7 @@ public function getStatusCode()
public function getContent()
{
$html = $this->evaluateScript('document.getElementsByTagName("html")[0].innerHTML');
-
- $html = preg_replace(array(
- '/<\!--SAHI_INJECT_START--\>.*\<\!--SAHI_INJECT_END--\>/sU',
- '/\<script\>\/\*\<\!\[CDATA\[\*\/\/\*----\>\*\/__sahi.*\<\!--SAHI_INJECT_END--\>/sU'
- ), '', $html);
+ $html = $this->removeSahiInjectionFromText($html);
return "<html>\n$html\n</html>";
}
@@ -227,10 +223,11 @@ public function getContent()
*/
public function find($xpath)
{
+ $jsXpath = $this->prepareXPath($xpath);
$function = <<<JS
(function(){
var count = 0;
- while (_sahi._byXPath("({$xpath})["+(count+1)+"]")) count++;
+ while (_sahi._byXPath("({$jsXpath})["+(count+1)+"]")) count++;
return count;
})()
JS;
@@ -256,7 +253,9 @@ public function getTagName($xpath)
*/
public function getText($xpath)
{
- return $this->client->findByXPath($this->prepareXPath($xpath))->getText();
+ return $this->removeSahiInjectionFromText(
+ $this->client->findByXPath($this->prepareXPath($xpath))->getText()
+ );
}
/**
@@ -503,8 +502,8 @@ public function keyUp($xpath, $char, $modifier = null)
*/
public function dragTo($sourceXpath, $destinationXpath)
{
- $from = $this->client->findByXPath($sourceXpath);
- $to = $this->client->findByXPath($destinationXpath);
+ $from = $this->client->findByXPath($this->prepareXPath($sourceXpath));
+ $to = $this->client->findByXPath($this->prepareXPath($destinationXpath));
$from->dragDrop($to);
}
@@ -577,4 +576,23 @@ private function prepareXPath($xpath)
{
return strtr($xpath, array('"' => '\\"'));
}
+
+ /**
+ * Removes injected by Sahi code.
+ *
+ * @param string $string
+ *
+ * @return string
+ */
+ private function removeSahiInjectionFromText($string)
+ {
+ $string = preg_replace(array(
+ '/<\!--SAHI_INJECT_START--\>.*\<\!--SAHI_INJECT_END--\>/sU',
+ '/\<script\>\/\*\<\!\[CDATA\[\*\/\/\*----\>\*\/__sahi.*\<\!--SAHI_INJECT_END--\>/sU'
+ ), '', $string);
+
+ $string = str_replace('/*<![CDATA[*//*---->*/__sahiDebugStr__="";__sahiDebug__=function(s){__sahiDebugStr__+=(s+"\n");};/*--*//*]]>*/ /*<![CDATA[*//*---->*/_sahi.createCookie(\'sahisid\', _sahi.sid);_sahi.loadXPathScript()/*--*//*]]>*/ /*<![CDATA[*//*---->*/eval(_sahi.sendToServer("/_s_/dyn/Player_script/script.js"));/*--*//*]]>*/ ', '', $string);
+
+ return $string;
+ }
}
View
20 src/Behat/Mink/Driver/Selenium2Driver.php 100644 → 100755
@@ -7,10 +7,7 @@
Behat\Mink\Exception\DriverException,
Behat\Mink\Exception\UnsupportedDriverActionException;
-use Selenium\Client as SeleniumClient,
- Selenium\Locator as SeleniumLocator,
- Selenium\Exception as SeleniumException,
- WebDriver;
+use WebDriver;
/*
* This file is part of the Behat\Mink.
@@ -108,13 +105,13 @@ public function setWebDriver(WebDriver $webDriver)
*
* @return array
*/
- protected static function getDefaultCapabilities()
+ public static function getDefaultCapabilities()
{
return array(
'browserName' => 'firefox',
- 'version' => '8',
+ 'version' => '9',
'platform' => 'ANY',
- 'browserVersion' => '8',
+ 'browserVersion' => '9',
'browser' => 'firefox'
);
}
@@ -512,7 +509,14 @@ public function getValue($xpath)
}
}
} else {
- value = "string:" + node.getAttribute('value');
+ attributeValue = node.getAttribute('value');
+ if(attributeValue) {
+ value = "string:" + attributeValue;
+ } else if(node.value) {
+ value = "string:" + node.value;
+ } else {
+ return null;
+ }
}
return value;
View
3  src/Behat/Mink/Driver/SeleniumDriver.php
@@ -424,7 +424,8 @@ public function selectOption($xpath, $value, $multiple = false)
var i, l = nodes.length;
for (i = 0; i < l; i++) {
if (nodes[i].getAttribute('value') == "$valueEscaped") {
- node.checked = true;
+ nodes[i].checked = true;
+ break;
}
}
}
View
20 src/Behat/Mink/Driver/ZombieDriver.php
@@ -662,31 +662,15 @@ public function wait($time, $condition)
*
* @param string $event The name of the event
* @param string $xpath The xpath of the element to trigger this event
- * @param array $opts Additional event options (key-value)
- * @param array $attrs Additional event attributes (key-value)
*/
- protected function triggerBrowserEvent($event, $xpath, array $opts = array(), array $attrs = array())
+ protected function triggerBrowserEvent($event, $xpath)
{
if (!$ref = $this->getNativeRefForXPath($xpath)) {
return;
}
- // Merge event attributes with event options
- if (!empty($attrs)) {
- $mergedAttrs = array_merge(
- (isset($opt["attributes"]) ? $opt["attributes"] : array()), $attrs
- );
-
- if (!empty($mergedAttrs)) {
- $opts["attributes"] = $mergedAttrs;
- }
- }
-
- // Encode options array
- $opts = !empty($opts) ? json_encode($opts) : "{}";
-
$js = <<<JS
-browser.fire("{$event}", {$ref}, {$opts}, function(err) {
+browser.fire("{$event}", {$ref}, function(err) {
if (err) {
stream.end(JSON.stringify(err.stack));
} else {
View
10 src/Behat/Mink/Element/NodeElement.php
@@ -46,6 +46,16 @@ public function getXpath()
}
/**
+ * Returns parent element to the current one.
+ *
+ * @return Behat\Mink\Element\NodeElement
+ */
+ public function getParent()
+ {
+ return $this->find('xpath', '..');
+ }
+
+ /**
* Returns current node tag name.
*
* @return string
View
15 src/Behat/Mink/Exception/ElementHtmlException.php
@@ -49,8 +49,17 @@ public function __construct($message = null, Session $session, Element $element,
*/
public function __toString()
{
- return $this->getMessage()."\n\n"
- . $this->getResponseInfo()
- . $this->pipeString($this->trimString($this->element->getHtml()) . "\n");
+ try {
+ $pageText = $this->trimString($this->element->getHtml());
+ $string = sprintf("%s\n\n%s%s",
+ $this->getMessage(),
+ $this->getResponseInfo(),
+ $this->pipeString($pageText."\n")
+ );
+ } catch (\Exception $e) {
+ return $this->getMessage();
+ }
+
+ return $string;
}
}
View
15 src/Behat/Mink/Exception/ElementNotFoundException.php
@@ -58,8 +58,17 @@ public function __construct(Session $session, $type = null, $selector = null, $l
*/
public function __toString()
{
- return $this->getMessage()."\n\n"
- . $this->getResponseInfo()
- . $this->pipeString($this->trimBody($this->getSession()->getPage()->getContent()) . "\n");
+ try {
+ $pageText = $this->trimBody($this->getSession()->getPage()->getContent());
+ $string = sprintf("%s\n\n%s%s",
+ $this->getMessage(),
+ $this->getResponseInfo(),
+ $this->pipeString($pageText."\n")
+ );
+ } catch (\Exception $e) {
+ return $this->getMessage();
+ }
+
+ return $string;
}
}
View
15 src/Behat/Mink/Exception/ElementTextException.php
@@ -27,8 +27,17 @@ class ElementTextException extends ElementHtmlException
*/
public function __toString()
{
- return $this->getMessage()."\n\n"
- . $this->getResponseInfo()
- . $this->pipeString($this->trimString($this->element->getText()) . "\n");
+ try {
+ $pageText = $this->trimString($this->element->getText());
+ $string = sprintf("%s\n\n%s%s",
+ $this->getMessage(),
+ $this->getResponseInfo(),
+ $this->pipeString($pageText."\n")
+ );
+ } catch (\Exception $e) {
+ return $this->getMessage();
+ }
+
+ return $string;
}
}
View
2  src/Behat/Mink/Exception/Exception.php
@@ -108,7 +108,7 @@ protected function getResponseInfo()
$driver = basename(str_replace('\\', '/', get_class($this->session->getDriver())));
$info = '+--[ ';
- if ('SahiDriver' !== $driver) {
+ if (!in_array($driver, array('SahiDriver', 'SeleniumDriver'))) {
$info .= 'HTTP/1.1 '.$this->session->getStatusCode().' | ';
}
$info .= $this->session->getCurrentUrl().' | '.$driver." ]\n|\n";
View
15 src/Behat/Mink/Exception/ExpectationException.php
@@ -38,8 +38,17 @@ public function __construct($message = null, Session $session, \Exception $excep
*/
public function __toString()
{
- return $this->getMessage()."\n\n"
- . $this->getResponseInfo()
- . $this->pipeString($this->trimBody($this->getSession()->getPage()->getContent()) . "\n");
+ try {
+ $pageText = $this->trimBody($this->getSession()->getPage()->getContent());
+ $string = sprintf("%s\n\n%s%s",
+ $this->getMessage(),
+ $this->getResponseInfo(),
+ $this->pipeString($pageText."\n")
+ );
+ } catch (\Exception $e) {
+ return $this->getMessage();
+ }
+
+ return $string;
}
}
View
15 src/Behat/Mink/Exception/ResponseTextException.php
@@ -26,8 +26,17 @@ class ResponseTextException extends ExpectationException
*/
public function __toString()
{
- return $this->getMessage()."\n\n"
- . $this->getResponseInfo()
- . $this->pipeString($this->trimString($this->getSession()->getPage()->getText()) . "\n");
+ try {
+ $pageText = $this->trimString($this->getSession()->getPage()->getText());
+ $string = sprintf("%s\n\n%s%s",
+ $this->getMessage(),
+ $this->getResponseInfo(),
+ $this->pipeString($pageText."\n")
+ );
+ } catch (\Exception $e) {
+ return $this->getMessage();
+ }
+
+ return $string;
}
}
View
32 src/Behat/Mink/PHPUnit/Constraints/PageContains.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Mink
+ *
+ * @package Mink
+ * @author Михаил Красильников <mihalych@vsepofigu.ru>
+ */
+namespace Behat\Mink\PHPUnit\Constraints;
+
+use PHPUnit_Framework_Constraint_StringContains,
+ PHPUnit_Util_Type;
+
+/**
+ * Constraint that asserts that the page contains a given string.
+ *
+ * @package Mink
+ * @author Михаил Красильников <mihalych@vsepofigu.ru>
+ */
+class PageContains extends PHPUnit_Framework_Constraint_StringContains
+{
+ /**
+ * Returns the description of the failure
+ *
+ * @param mixed $other evaluated value or object
+ *
+ * @return string
+ */
+ protected function failureDescription($other)
+ {
+ return 'page text ' . $this->toString();
+ }
+}
View
34 src/Behat/Mink/PHPUnit/TestCase.php
@@ -4,21 +4,26 @@
use Behat\Mink\Mink,
Behat\Mink\Session,
+ Behat\Mink\Driver\Goutte\Client as GoutteClient,
Behat\Mink\Driver\GoutteDriver,
Behat\Mink\Driver\SahiDriver,
Behat\Mink\Driver\ZombieDriver,
Behat\Mink\Driver\SeleniumDriver,
Behat\Mink\Driver\Selenium2Driver,
Behat\Mink\Driver\Zombie\Connection as ZombieConnection,
- Behat\Mink\Driver\Zombie\Server as ZombieServer;
-
-use Goutte\Client as GoutteClient;
+ Behat\Mink\Driver\Zombie\Server as ZombieServer,
+ Behat\Mink\Exception\ResponseTextException;
use Selenium\Client as SeleniumClient;
use Behat\SahiClient\Connection as SahiConnection,
Behat\SahiClient\Client as SahiClient;
+use Behat\Mink\PHPUnit\Constraints\PageContains as PageContainsConstraint;
+
+require_once 'PHPUnit/Autoload.php';
+require_once 'PHPUnit/Framework/Assert/Functions.php';
+
/*
* This file is part of the Behat\Mink.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
@@ -98,6 +103,29 @@ public function getSession($name = null)
}
/**
+ * Checks, that page contains specified text
+ *
+ * @param Session $session
+ * @param string $text text to look for
+ * @param string $message optional message to show on fail
+ *
+ * @throws ResponseTextException
+ *
+ * @return void
+ */
+ public static function assertPageContainsText(Session $session, $text, $message = null)
+ {
+ $text = str_replace('\\"', '"', $text);
+ $haystack = $session->getPage()->getText();
+
+ $message = $message ?:
+ sprintf('The text "%s" was not found anywhere in the text of the page', $text);
+
+ $constraint = new PageContainsConstraint($text, false);
+ self::assertThat($haystack, $constraint, $message);
+ }
+
+ /**
* Registers Mink sessions on it's initialization.
*
* @param Behat\Mink\Mink $mink Mink manager instance
View
76 tests/Behat/Mink/Driver/GeneralDriverTest.php
@@ -18,6 +18,18 @@ public function testRedirect()
}
/**
+ * @group issue130
+ */
+ public function testIssue130()
+ {
+ $this->getSession()->visit($this->pathTo('/issue130.php?p=1'));
+ $page = $this->getSession()->getPage();
+
+ $page->clickLink('Go to 2');
+ $this->assertEquals($this->pathTo('/issue130.php?p=1'), $page->getText());
+ }
+
+ /**
* @group issue131
*/
public function testIssue131()
@@ -30,6 +42,54 @@ public function testIssue131()
$this->assertEquals('1', $page->findField('foobar')->getValue());
}
+ /**
+ * @group issue140
+ */
+ public function testIssue140()
+ {
+ $this->getSession()->visit($this->pathTo('/issue140.php'));
+
+ $this->getSession()->getPage()->fillField('cookie_value', 'some:value;');
+ $this->getSession()->getPage()->pressButton('Set cookie');
+
+ $this->getSession()->visit($this->pathTo('/issue140.php?show_value'));
+ $this->assertEquals('some:value;', $this->getSession()->getPage()->getText());
+ }
+
+ /**
+ * @group issue162
+ * TODO: fix goutte behavior
+ */
+ public function _testIssue162()
+ {
+ $this->getSession()->visit($this->pathTo('/issue162.php'));
+
+ $this->getSession()->getPage()->uncheckField('Checkbox 1');
+ $this->getSession()->getPage()->pressButton('Submit');
+ }
+
+ /**
+ * @group issue211
+ */
+ public function testIssue211()
+ {
+ $this->getSession()->visit($this->pathTo('/issue211.php'));
+ $field = $this->getSession()->getPage()->findField('Téléphone');
+
+ $this->assertNotNull($field);
+ }
+
+ public function testIssue212()
+ {
+ $session = $this->getSession();
+
+ $session->visit($this->pathTo('/issue212.php'));
+ $page = $session->getPage();
+
+ $field = $page->findById('poney-button');
+ $this->assertEquals('poney', $field->getValue());
+ }
+
public function testCookie()
{
$this->getSession()->visit($this->pathTo('/cookie_page2.php'));
@@ -221,6 +281,12 @@ public function testVeryDeepElementsTraversing()
$profileFormDivLabel = $profileFormDiv->find('css', 'label');
$this->assertNotNull($profileFormDivLabel);
+ $profileFormDivParent = $profileFormDivLabel->getParent();
+ $this->assertNotNull($profileFormDivParent);
+
+ $profileFormDivParent = $profileFormDivLabel->getParent();
+ $this->assertEquals('something', $profileFormDivParent->getAttribute('data-custom'));
+
$profileFormInput = $profileFormDivLabel->findField('user-name');
$this->assertNotNull($profileFormInput);
$this->assertEquals('username', $profileFormInput->getAttribute('name'));
@@ -271,6 +337,16 @@ public function testLinks()
$link->click();
$this->assertEquals($this->pathTo('/basic_form.php'), $this->getSession()->getCurrentUrl());
+
+ $this->getSession()->visit($this->pathTo('/links.php'));
+ $page = $this->getSession()->getPage();
+ $link = $page->findLink("Link with a ");
+
+ $this->assertNotNull($link);
+ $this->assertRegExp('/\/links\.php\?quoted$/', $link->getAttribute('href'));
+ $link->click();
+
+ $this->assertEquals($this->pathTo('/links.php?quoted'), $this->getSession()->getCurrentUrl());
}
public function testJson()
View
12 tests/Behat/Mink/Driver/JavascriptDriverTest.php
@@ -107,4 +107,16 @@ public function testDragDrop()
$draggable->dragTo($droppable);
$this->assertEquals('Dropped!', $droppable->find('css', 'p')->getText());
}
+
+ public function testIssue193()
+ {
+ $session = $this->getSession();
+ $session->visit($this->pathTo('/issue193.html'));
+
+ $session->getPage()->selectFieldOption('options-without-values', 'Two');
+ $this->assertEquals('Two', $session->getPage()->findById('options-without-values')->getValue());
+
+ $session->getPage()->selectFieldOption('options-with-values', 'two');
+ $this->assertEquals('two', $session->getPage()->findById('options-with-values')->getValue());
+ }
}
View
15 tests/Behat/Mink/Driver/SahiDriverTest.php
@@ -33,4 +33,19 @@ public function testIssue131()
$page->selectFieldOption('foobar', 'Gimme some accentués characters');
}
+
+ public function testPrepareXPath()
+ {
+ $driver = $this->getSession()->getDriver();
+
+ // Make the method accessible for testing purposes
+ $method = new \ReflectionMethod(
+ 'Behat\Mink\Driver\SahiDriver', 'prepareXPath'
+ );
+ $method->setAccessible(true);
+
+ $this->assertEquals('No quotes', $method->invokeArgs($driver, array('No quotes')));
+ $this->assertEquals("Single quote'", $method->invokeArgs($driver, array("Single quote'")));
+ $this->assertEquals('Double quote\"', $method->invokeArgs($driver, array('Double quote"')));
+ }
}
View
5 tests/Behat/Mink/Driver/SeleniumDriverTest.php
@@ -44,4 +44,9 @@ public function testOtherMouseEvents()
$clicker->mouseOver();
$this->assertEquals('mouse overed', $clicker->getText());
}
+
+ /**
+ * Selenium1 doesn't handle selects without values
+ */
+ public function testIssue193() {}
}
View
5 tests/Behat/Mink/Driver/ZombieDriverTest.php
@@ -28,4 +28,9 @@ public function testDragDrop() {}
* No need in wait method for Zombie
*/
public function testWait() {}
+
+ /**
+ * Zombie.js doesn't handle selects without values
+ */
+ public function testIssue193() {}
}
View
2  tests/Behat/Mink/Driver/web-fixtures/index.php
@@ -32,7 +32,7 @@
<input type="text" placeholder="Search site..." />
</form>
<form id="profile">
- <div>
+ <div data-custom="something">
<label>
<input type="text" id="user-name" name="username" />
</label>
View
14 tests/Behat/Mink/Driver/web-fixtures/issue130.php
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<html>
+<body>
+ <?php
+ if ('1' === $_GET['p']) {
+ echo '<a href="/issue130.php?p=2">Go to 2</a>';
+ } else {
+ echo '<strong>'.$_SERVER['HTTP_REFERER'].'</strong>';
+ }
+ ?>
+</body>
View
18 tests/Behat/Mink/Driver/web-fixtures/issue140.php
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<html>
+<body>
+ <?php if (!empty($_POST)) {
+ setcookie ("tc", $_POST['cookie_value']);
+ }
+ else if (isset($_GET["show_value"])) {
+ echo $_COOKIE["tc"];
+ die();
+ } ?>
+ <form method="post">
+ <input name="cookie_value">
+ <input type="submit" value="Set cookie">
+ </form>
+</body>
View
23 tests/Behat/Mink/Driver/web-fixtures/issue162.php
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="en">
+<body>
+ <?php
+ if ('POST' === $_SERVER['REQUEST_METHOD']) {
+ var_dump($_POST['some']);
+ }
+ ?>
+
+ <form method="post" action="issue162.php">
+ <label for=check1>
+ Checkbox 1
+ <input id=check1 type="checkbox" checked="checked" name="some[options][]" value="val1" />
+ </label>
+ <label for=check2>
+ Checkbox 2
+ <input id=check2 type="checkbox" name="some[options][]" value="val2" />
+ </label>
+
+ <input type="submit" value="submit" />
+ </form>
+</body>
+</html>
View
26 tests/Behat/Mink/Driver/web-fixtures/issue193.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
+<head>
+ <title>Index page</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+</head>
+<body>
+
+<form action="#">
+ <select id="options-without-values">
+ <option>none selected</option>
+ <option>One</option>
+ <option>Two</option>
+ <option>Three</option>
+ </select>
+
+ <select id="options-with-values">
+ <option value="none">none selected</option>