Browse files

Merge branch 'release/1.0.3'

  • Loading branch information...
2 parents dbc7c6a + 913b8fa commit d8053c049db4820af0966bec5d93b413f359f096 @everzet everzet committed Aug 2, 2011
View
10 CHANGES.md
@@ -1,3 +1,13 @@
+1.0.3 / 2011-08-02
+==================
+
+ * File uploads for empty fields fixed (GoutteDriver)
+ * Lazy sessions restart
+ * `show_tmp_dir` option in MinkContext
+ * Updated to stable Symfony2 components
+ * SahiClient connection limit bumped to 60 seconds
+ * Dutch language support
+
1.0.2 / 2011-07-22
==================
View
6 src/Behat/Mink/Behat/Context/MinkContext.php
@@ -55,6 +55,7 @@ public function __construct(array $parameters = array())
'default_session' => 'goutte',
'base_url' => 'http://localhost',
'show_cmd' => null,
+ 'show_tmp_dir' => sys_get_temp_dir(),
'browser' => 'firefox',
'goutte' => array(
'zend_config' => array(),
@@ -610,7 +611,7 @@ public function showLastResponse()
throw new \RuntimeException('Set "show_cmd" parameter in behat.yml to be able to open page in browser (ex.: "show_cmd: firefox %s")');
}
- $filename = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid().'.html';
+ $filename = rtrim($this->getParameter('show_tmp_dir'), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.uniqid().'.html';
file_put_contents($filename, $this->getSession()->getPage()->getContent());
system(sprintf($this->getParameter('show_cmd'), $filename));
}
@@ -632,7 +633,7 @@ public function prepareMinkSession($event)
}
if ($scenario->hasTag('insulated')) {
- $this->getMink()->restartSessions();
+ $this->getMink()->stopSessions();
} else {
$this->getMink()->resetSessions();
}
@@ -652,6 +653,7 @@ public function getTranslationResources()
__DIR__ . '/translations/fr.xliff',
__DIR__ . '/translations/ja.xliff',
__DIR__ . '/translations/es.xliff',
+ __DIR__ . '/translations/nl.xliff',
);
}
View
131 src/Behat/Mink/Behat/Context/translations/nl.xliff
@@ -0,0 +1,131 @@
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+ <file original="global" source-language="en" target-language="nl" datatype="plaintext">
+ <header />
+ <body>
+ <trans-unit id="i-am-on-page">
+ <source><![CDATA[/^(?:|I )am on "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^dat ik op "(?P<page>[^"]+)" ben$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-go-to-page">
+ <source><![CDATA[/^(?:|I )go to "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^(?:|ik )naar "(?P<page>[^"]+)" ga$/]]></target>
+ </trans-unit>
+ <trans-unit id="reload-the-page">
+ <source><![CDATA[/^(?:|I )reload the page$/]]></source>
+ <target><![CDATA[/^(?:|ik )de pagina herlaad$/]]></target>
+ </trans-unit>
+ <trans-unit id="move-backward-one-page">
+ <source><![CDATA[/^(?:|I )move backward one page$/]]></source>
+ <target><![CDATA[/^(?:|ik )een pagina terugga$/]]></target>
+ </trans-unit>
+ <trans-unit id="move-forward-one-page">
+ <source><![CDATA[/^(?:|I )move forward one page$/]]></source>
+ <target><![CDATA[/^(?:|ik )een pagina vooruit ga$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-press-button">
+ <source><![CDATA[/^(?:|I )press "(?P<button>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ik )druk op "(?P<button>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-follow-link">
+ <source><![CDATA[/^(?:|I )follow "(?P<link>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ik )"(?P<link>(?:[^"]|\\")*)" volg$/]]></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[/^(?:|ik )het veld "(?P<field>(?:[^"]|\\")*)" invul met "(?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[/^(?:|ik )de waarde "(?P<value>(?:[^"]|\\")*)" invul in "(?P<field>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-fill-in-the-following">
+ <source><![CDATA[/^(?:|I )fill in the following:$/]]></source>
+ <target><![CDATA[/^(?:|ik )het volgende invul:$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-select-option-from-select">
+ <source><![CDATA[/^(?:|I )select "(?P<option>(?:[^"]|\\")*)" from "(?P<select>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ik )de optie "(?P<option>(?:[^"]|\\")*)" selecteer voor "(?P<select>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-check-option">
+ <source><![CDATA[/^(?:|I )check "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ik )"(?P<option>(?:[^"]|\\")*)" aanvink$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-uncheck-option">
+ <source><![CDATA[/^(?:|I )uncheck "(?P<option>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^(?:|ik )"(?P<option>(?:[^"]|\\")*)" uitvink$/]]></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[/^(?:|ik )het bestand "(?P<path>[^"]*)" toevoeg aan "(?P<field>(?:[^"]|\\")*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-text">
+ <source><![CDATA[/^(?:|I )should see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^moet (?:|ik )"(?P<text>(?:[^"]|\\")*)" zien$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-should-contain">
+ <source><![CDATA[/^the response should contain "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^moet het antwoord "(?P<text>(?:[^"]|\\")*)" bevatten$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-not-see-text">
+ <source><![CDATA[/^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^moet (?:|ik )niet "(?P<text>(?:[^"]|\\")*)" zien$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-response-should-not-contain">
+ <source><![CDATA[/^the response should not contain "(?P<text>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^moet het antwoord "(?P<text>(?:[^"]|\\")*)" niet bevatten$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-field-should-contain-value">
+ <source><![CDATA[/^the "(?P<field>(?:[^"]|\\")*)" field should contain "(?P<value>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^moet "(?P<field>(?:[^"]|\\")*)" "(?P<value>(?:[^"]|\\")*)" bevatten$/]]></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[/^moet "(?P<field>(?:[^"]|\\")*)" "(?P<value>(?:[^"]|\\")*)" niet bevatten$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-checkbox-should-be-checked">
+ <source><![CDATA[/^the "(?P<checkbox>(?:[^"]|\\")*)" checkbox should be checked$/]]></source>
+ <target><![CDATA[/^moet "(?P<checkbox>(?:[^"]|\\")*)" aangevinkt zijn$/]]></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[/^moet "(?P<checkbox>(?:[^"]|\\")*)" niet aangevinkt zijn$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-be-on-page">
+ <source><![CDATA[/^(?:|I )should be on "(?P<page>[^"]+)"$/]]></source>
+ <target><![CDATA[/^moet (?:|ik )op "(?P<page>[^"]+)" zijn$/]]></target>
+ </trans-unit>
+ <trans-unit id="the-url-should-match">
+ <source><![CDATA[/^the url should match "(?P<pattern>(?:[^"]|\\")*)"$/]]></source>
+ <target><![CDATA[/^moet de url overeenkomen met "(?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[/^moet het element "(?P<element>[^"]*)" "(?P<value>(?:[^"]|\\")*)" bevatten$/]]></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[/^moet (?:|ik )"(?P<text>(?:[^"]|\\")*)" zien in "(?P<element>[^"]*)"$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-see-element">
+ <source><![CDATA[/^(?:|I )should see an? "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^moet (?:|ik )een element "(?P<element>[^"]*)" zien$/]]></target>
+ </trans-unit>
+ <trans-unit id="i-should-not-see-element">
+ <source><![CDATA[/^(?:|I )should not see an? "(?P<element>[^"]*)" element$/]]></source>
+ <target><![CDATA[/^moet (?:|ik )een element "(?P<element>[^"]*)" niet zien$/]]></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[/^moet de statuscode van het antwoord (?P<code>\d+) zijn$/]]></target>
+ </trans-unit>
+ <trans-unit id="print-last-response">
+ <source><![CDATA[/^print last response$/]]></source>
+ <target><![CDATA[/^print het laatste antwoord$/]]></target>
+ </trans-unit>
+ <trans-unit id="show-last-response">
+ <source><![CDATA[/^show last response$/]]></source>
+ <target><![CDATA[/^toon het laatste antwoord$/]]></target>
+ </trans-unit>
+ </body>
+ </file>
+</xliff>
View
4 src/Behat/Mink/Compiler/PearCompiler.php
@@ -197,22 +197,18 @@ protected function getPackageTemplate()
<package>
<name>BrowserKit</name>
<channel>pear.symfony.com</channel>
- <recommended>2.0.0RC1</recommended>
</package>
<package>
<name>CssSelector</name>
<channel>pear.symfony.com</channel>
- <recommended>2.0.0RC1</recommended>
</package>
<package>
<name>DomCrawler</name>
<channel>pear.symfony.com</channel>
- <recommended>2.0.0RC1</recommended>
</package>
<package>
<name>Process</name>
<channel>pear.symfony.com</channel>
- <recommended>2.0.0RC1</recommended>
</package>
<extension>
<name>pcre</name>
View
9 src/Behat/Mink/Driver/GoutteDriver.php
@@ -328,10 +328,11 @@ public function click($xpath)
);
}
$node = $nodes->eq(0);
+ $type = $this->getCrawlerNode($node)->nodeName;
- if ('a' === $this->getCrawlerNode($node)->nodeName) {
+ if ('a' === $type) {
$this->client->click($node->link());
- } else {
+ } elseif('input' === $type) {
$buttonForm = $node->form();
foreach ($this->forms as $form) {
if ($buttonForm->getFormNode()->getLineNo() === $form->getFormNode()->getLineNo()) {
@@ -341,6 +342,10 @@ public function click($xpath)
}
}
$this->client->submit($buttonForm);
+ } else {
+ throw new DriverException(sprintf(
+ 'Goutte driver supports clicking on inputs and links only. But "%s" provided', $type
+ ));
}
$this->forms = array();
View
10 tests/Behat/Mink/Driver/GeneralDriverTest.php
@@ -264,6 +264,16 @@ public function testBasicForm()
public function testAdvancedForm()
{
$this->getSession()->visit($this->pathTo('/advanced_form.php'));
+ $page = $this->getSession()->getPage();
+
+ $page->fillField('first_name', 'ever');
+ $page->fillField('last_name', 'zet');
+
+ $page->pressButton('Register');
+
+ $this->assertContains('no file', $page->getContent());
+
+ $this->getSession()->visit($this->pathTo('/advanced_form.php'));
$page = $this->getSession()->getPage();
$this->assertEquals('ADvanced Form Page', $page->find('css', 'h1')->getText());
View
7 tests/Behat/Mink/Driver/web-fixtures/advanced_form_post.php
@@ -6,10 +6,15 @@
</head>
<body>
<?php
+ error_reporting(0);
$_POST['agreement'] = ('1' === $_POST['agreement'] || 'on' === $_POST['agreement']) ? 'on' : 'off';
print_r($_POST);
- echo count($_FILES) . ' ' . file_get_contents($_FILES['about']['tmp_name']);
+ if (file_exists($_FILES['about']['tmp_name'])) {
+ echo file_get_contents($_FILES['about']['tmp_name']);
+ } else {
+ echo "no file";
+ }
?>
</body>
View
2 tests/Behat/Mink/Driver/web-fixtures/some_file.txt
@@ -1 +1 @@
-uploaded file
+1 uploaded file
2 vendor/Goutte
@@ -1 +1 @@
-Subproject commit 63f57ab4e2a022277d690e57a6cdc77e018f99e7
+Subproject commit 650e1dd6192cdc7aa9d01999e657039532e6d4e7
2 vendor/SahiClient
@@ -1 +1 @@
-Subproject commit 8d9edc01f9189af0701481d9884e7e890a061d68
+Subproject commit 6fbe3a3845ad2b11cb8bf3d682764964cd1b223a
2 vendor/Symfony/Component/BrowserKit
@@ -1 +1 @@
-Subproject commit 66eadd4bc5fe20489bc1c4bd0e8f0b13ed9465e7
+Subproject commit fd0cb960f526238bad7dc28fee24ba91d6858e06
2 vendor/Symfony/Component/Process
@@ -1 +1 @@
-Subproject commit 9d379d291817e9a7efd51522096793ecd5b798fa
+Subproject commit 83186a5f106f33c1c8f8163eef5860ac64ad7679

0 comments on commit d8053c0

Please sign in to comment.