Reputation: 31
I'm seeing an issue where cypress (v6.9.1) is randomly stopping mid-type, despite the fact that no other events are triggering on our page, and continuing after a .wait as it proceeds to execute other commands.
cy.get(`[placeholder="Search"]`)
.clear()
.click()
.type(search) //types a portion of 'search', then stops
.wait(500);
//continues typing the rest of search
This issue is sporadic and can not be reliable reproduced, and can and has happened on any text input on our app. Any ideas on what could be causing it?
Upvotes: 1
Views: 1900
Reputation: 94
When using a component like React Async Select
and wanna select an option you can do.
cy.get("#elementid").type("Jef{enter}", { delay: 100 });
so each consecutive keystroke, it will wait 100 ms
. Not the greatest solution as it's arbitrary.
I haven't found a better solution using cy.intercept
so if anyone has one, please let me know.
Upvotes: 0
Reputation: 18639
You can add a delay while typing something like below. Now each keypress will be delayed 50ms.
cy.get('[placeholder="Search"]').clear().click().type(search, {delay: 50})
Upvotes: 2