dimanche 25 novembre 2018

WebDriver test jumps between fields when typing

In my Laravel 5.7 project, I'm using Dusk browser testing to assert that a form submission is handled properly.

But the test randomly switches between fields when trying to type out the values.

My code is:

$browser->visit(self::PATH)
    ->waitFor(self::HIDDEN_FORM, 1)// Wait a maximum of one second for the selector...                    
    ->type(self::NAME_FIELD, 'John Doe')
    ->type(self::EMAIL_FIELD, 'example@example.com');

But the test randomly errors out (because of the following invalid input) and generates a screenshot, and the screenshot contains variations of:

Name: John Doeple@example.com
Email: exam

Or:

Name: John Doeple.com
Email: example@exam

Or:

Name: John Doeexample@example.com
Email: 

And many other random variations of the text not being typed continuously in the correct fields.

(Can you see that while it was typing the Email field, the cursor jumped back to the Name field?)

How can I fix this?

Aucun commentaire:

Enregistrer un commentaire