minkphp / Mink

PHP web browser emulator abstraction
https://mink.behat.org/
MIT License
1.6k stars 280 forks source link

Mink strips out : #777

Open Ghostff opened 5 years ago

Ghostff commented 5 years ago

Mink is striping out : from string example: And I fill in "time" with "10:10" is filled out with 1010 also

When I fill in the following:
    | description  | Some random: test description  |

Is filled out with Some random test description

stof commented 5 years ago

Is the stripping done by Mink, by Behat of my something between them ? Please provide a reproducer using Mink directly.

stof commented 5 years ago

Also, which Mink driver are you using ?

Ghostff commented 5 years ago
"behat/behat": "^3.5",
"behat/mink-extension": "^2.3",
"behat/mink": "^1.7",
"behat/mink-goutte-driver": "^1.2",
"behat/mink-selenium2-driver": "^1.3"

"Please provide a reproducer using Mink directly" sorry how do i do this?

Ghostff commented 5 years ago

I dont know the actual cause if this, but this is what am using temporally

/**
* Fills in form field with specified id|name|label|value
* Example: When I fill in "time" with raw "10:10"
*
* @When /^(?:|I )fill in "(?P<field>(?:[^"]|\\")*)" with raw "(?P<value>(?:[^"]|\\")*)"$/
* @param string $field
* @param string $value
*/
public function fillRaw(string $field, string $value)
{
    $this->getSession()->evaluateScript("document.getElementsByName('{$field}')[0].value = '{$value}';");
}
stof commented 5 years ago

have a look at the functional testsuite of drivers (available at https://github.com/minkphp/driver-testsuite). This gives lots of examples of using Mink directly (to remove any effect coming from other layers).

And you still haven't told us which driver you are using

Ghostff commented 5 years ago

behat.yml

default:
  autoload:
    '': tests/behat/bootstrap
  suites:
    default:
      paths:
        features: "%paths.base%/tests/behat/"
      contexts:
        - BehatContexts\FeatureContext
    extensions:
      Behat\MinkExtension:
        base_url: https://www.wikipedia.org/
        browser_name: chrome
        goutte: ~
        selenium2:
          wd_host: http://127.0.0.1:4444/wd/hub
          browser: chrome
          capabilities:
            chrome:
              switches:
                - "--window-size=1920,1080"
stof commented 5 years ago

this config creates 2 Mink sessions, one using GoutteDriver and one using Selenium2Driver. This does not tell me which one is used for your issue.

Ghostff commented 5 years ago

selenium2 the scenarios use @javascript