minkphp/MinkGoutteDriver

Checkbox "foo" is not checked, but it should be.

gimler opened this issue · 8 comments

The following doesn't work with goutte but with selenium driver

Feature: checkbox

  Scenario: create a new customer
    Given I am on "http://127.0.0.1:8080/form.html"

    And the "fuuu" checkbox should be checked # id works
    And the "foo" checkbox should be checked # name works
    And the "Label" checkbox should be checked # label works
    And the "bar" checkbox should be checked # value failed

see also #56

composer.json

{
    "require": {
        "behat/behat": "3.1.*",
        "behat/mink": "1.7.1",
        "behat/mink-extension": "2.2",
        "behat/mink-goutte-driver": "1.2.1"
    },
    "config": {
        "bin-dir": "bin/"
    }
}

html

<html>
<head>
</head>
<body>
<form action="#">

    <label for="fuuu">Label</label>
    <input type="checkbox" id="fuuu" name="foo" value="bar" checked>

    <input type="submit" value="send">

</form>
</body>
</html>

behat.yml

default:
    extensions:
        Behat\MinkExtension: 
            base_url: 'http://127.0.0.1'
            show_cmd: 'firefox %s'
            default_session: http
            javascript_session: javascript
            sessions:
                http:
                    goutte:
                        guzzle_parameters:
                            verify: false
                javascript:
                    selenium2:
                        wd_host: "http://localhost:8643/wd/hub"
        Sanpi\Behatch\Extension: ~

    suites:
        default:
            contexts:
                - FeatureContext
                - Behat\MinkExtension\Context\MinkContext
                - behatch:browser

run with php -S 127.0.0.1:8080

Maybe the <form> needs to have action attribute and there must be least one submit button?

this was not the problem i have updated the example

Can you please post pure-Mink (not used Behat scenario for example) PHP code that you're using.

stof commented

@aik099 And the "foo" checkbox should be checked in MinkExtension just translates to $mink->assertSession()->checkboxChecked('foo')

i use behat with the goutte driver

Strange. Tests pass currently. Maybe Guzzle have changed something that is preventing page from being read properly. Maybe you're opening page by SSL.

no i run the test via localhost over http i have updated the description.

ok sorry proxy problem ;(. the testcase is working