Checkbox "foo" is not checked, but it should be.
mruz opened this issue · comments
I'm trying to test whether the foo checkbox is checked:
<form>
<input type="checkbox" name="foo" id="foo" value="on" checked="checked">
<input type="submit" />
</form>
Given I am on "/"
Then the "foo" checkbox should be checked
And I'm getting:
Checkbox "foo" is not checked, but it should be.
Is Behat/Behat#298 fixed?
There was a fix in MinkBrowserKitDriver (see Behat/MinkBrowserKitDriver@258d2c7) which fixed check for checkboxes with value
attribute different from 1
and 0
.
It was released as part MinkBrowserKitDriver 2.0 version. What version are you using? Better yet list all package versions that composer is using.
I have:
behat/behat v3.0.14 Scenario-oriented BDD framework for PHP 5.3
behat/gherkin v4.3.0 Gherkin DSL parser for PHP 5.3
behat/mink v1.5.0 Web acceptance testing framework for PHP 5.3
behat/mink-browserkit-driver v1.1.0 Symfony2 BrowserKit driver for Mink framework
behat/mink-extension v2.0.1 Mink extension for Behat
behat/mink-goutte-driver v1.0.9 Goutte driver for Mink framework
behat/mink-selenium-driver v1.1.0 Selenium driver for Mink framework
behat/mink-selenium2-driver v1.1.1 Selenium2 (WebDriver) driver for Mink framework
behat/transliterator v1.0.1 String transliterator
And that's why it's not working: you have v1.1.0 of MinkBrowserKitDriver where it's still the issue. Maybe you're locking used version of your dependencies in the composer.json
?
In the composer.json I have:
"behat/behat": "*",
"behat/mink": "*",
"behat/mink-extension": "*",
"behat/mink-goutte-driver": "*",
"behat/mink-selenium-driver": "*",
"behat/mink-selenium2-driver": "*"
and in the mink-goutte-driver's composer.json I see:
"require": {
"php": ">=5.3.1",
"behat/mink-browserkit-driver": ">=1.0.5,<1.2.0",
"fabpot/goutte": "~1.0.1"
},
But the MinkGoutteDriver
already released 1.1.0 version with different MinkBrowserKitDriver
dependency. Using *
is bad idea, so I believe that what version of each driver is used is determined by lowest denominator: some package requires something old and that forces all drivers to use their old version.
I'd recommend you specifying exact (or with ~
) version of each package and see what happens after composer update
.
You know 2 things already:
- use
behat/mink
~1.6 - use
behat/mink-goutte-driver
~1.1
Using * is bad idea, so I believe that what version of each driver is used is determined by lowest denominator
That's what I thought. I specified with ~
and works like a charm.
Thanks for helping.