MinkExtension icon indicating copy to clipboard operation
MinkExtension copied to clipboard

Does not correctly fill in form fields

Open nietzscheson opened this issue 7 years ago • 4 comments

I have a form, with two fields. Username and password. I did some tests with the admin | admin, for each field. If I change the value admin by administrator (or any other value other than admin) the fields are not filled. There are so many things involved that I do not know what is failing. I’m using everything in Homestead, PHP7. Behat, Mink, Selenium2. Quartz.

behat-720

#composer.json

        "behat/mink": "^1.7",
        "behat/mink-extension": "^2.2",
        "behat/mink-browserkit-driver": "^1.3",
        "behat/mink-selenium2-driver": "^1.3",
        "behat/behat": "3.3.1",
        "behat/symfony2-extension": "^2.1@dev"
Feature: Login

  @javascript
  Scenario: Login
    Given I am on the homepage
    When I fill in "_username" with "administrador"
    And I fill in "_password" with "administrador"
    When I press "_submit"

default:
    formatters:
        pretty:
            verbose: true
            paths: false
            snippets: false

    extensions:
        Behat\Symfony2Extension: ~
        Behat\MinkExtension:
            base_url: "http://beauty.app/app_test.php/"
            default_session: symfony
            javascript_session: chrome
            sessions:
                symfony:
                    symfony2: ~
                chrome:
                    selenium2:
                        browser: chrome
                        capabilities:
                            browserName: chrome
                            browser: chrome
                            version: ""
                            chrome:
                                switches:
                                    - "start-fullscreen"
                                    - "start-maximized"
                                    - "no-sandbox"
                firefox:
                    selenium2:
                        browser: firefox
            show_auto: false
default:
    suites:
        default:
            contexts:
                - DefaultContext
<?php

use Behat\MinkExtension\Context\MinkContext;

class DefaultContext extends MinkContext
{
}

nietzscheson avatar Jul 24 '17 04:07 nietzscheson

@nietzscheson Your gif reproducing the bug is amazing!

I have the same problem with PhantomJS browser: it just skips filling a single form field - everytime skipped field is the same. I've applied a workaround: just doubled the filling command for this concrete field - it is very ugly, so I need this bug to be fixed.

PatchRanger avatar Aug 23 '17 03:08 PatchRanger

Same problem with this config, very annoying: "behat/behat": "^3.0", "behat/mink-extension": "^2.1", "behat/mink-goutte-driver": "^1.2", "behat/mink-selenium2-driver": "^1.3", "behat/symfony2-extension": "^2.1", "se/selenium-server-standalone": "2.45.0",

Using Chrome Driver 2.36.540470 extensions: Behat\Symfony2Extension: ~ Behat\MinkExtension: base_url: http://127.0.0.1/myurl browser_name: chrome selenium2: capabilities: chrome: switches: - "start-fullscreen" - "start-maximized" goutte: ~ default_session: goutte javascript_session: selenium2 show_cmd: 'C:\Progra~2\Google\Chrome\Application\chrome.exe %s'

pfleu avatar Apr 04 '18 12:04 pfleu

I am having a possibly related problem:

Anytime I fill a field and the following step is something like "push a button" the focus is removed from the field before the full text is inserted into the field.

For example, If I have the fields username and password and something like this:

And I fill in "username" with "derrek"
And I fill in "password" with "password"
And I press "Login"

The password field will actually get filled in with something like "pass" or "passw" or "passwor".

I end up having to add a wait step:

And I fill in "username" with "derrek"
And I fill in "password" with "password"
And I press "Login"
And I wait "1" second

This usually solves the issue. Once in a while, 1 second isn't enough time.

I have also written my own definitions to solve this by finding the field myself and using setValue, but the effect is the same. I have even written "waitFor" loops that check that the getText() of the field is what I set it to, it says it is and it is still a truncated version of it when save is pushed. Same problem running chrome through selenium, chromedriver headless or not.

I would love to write something that could detect and wait for the entry to be finished, but I am at a loss as to how. Could this be solved with wait and javascript?

All these fields are angular material based. I haven't tried reproducing this with "normal" fields.

I also discovered that the test failures are directly linked to how busy the CPU is on my system. Many more field entries needed waits after them when my processor was overloaded.

Thoughts? Comments? Could it be related?

dleute avatar Apr 25 '18 16:04 dleute

Refs #307

normanlolx avatar Nov 14 '18 14:11 normanlolx