Closed maga-polito closed 1 year ago
@maga-polito facing the same problem (since forever)
Which workaround are you talking about?
Our strings are between 20 and 30 chars and roughly every fifth time are missing one or more characters.
i'm on cypress 8.3.1 and still experiencing this issue. just now i had a test try to type 200
into a field and ended up typing 20
and proceeding to the next one. unfortunately i don't have a reproducible example as the behaviour seems random. this is the code for typing that value, if that helps:
cy.get("[data-cy=foo-bar]").clear().type(value, { scrollBehavior: false });
also experiencing this on 8.7 and it seems to happen more on chrome than on electron. the behaviour seems kind of random.
let value = "some value";
cy.get("[data-cy=foo-bar]").clear();
cy.get("[data-cy=foo-bar]").type(value));
// types: "so" or "som", or "some v"...
Unfortunately, none of these comments contain enough information to reproduce the issue. A code snippet that can be run in isolation, or a public repository demonstrating the issue would be very helpful for looking into it.
describe("typing long strings", function() {
for (let i=0; i < 20; i++) {
it("fails? " + i, function() {
cy.document().then(doc => {
doc.body.innerHTML = `
<form>
<input id="foo" />
</form>
`
})
const str = 'some value, a very long value, typing in a string'
cy.get('#foo').type(str)
cy.get('#foo').should('have.value', str)
})
}
})
This passes every time, but clearly it's far simpler than a real app, so there must be something else going wrong, and there's no way to tell what without having a reproducible test case we can look into.
Ladies and gents, I finally figured this out after a few hours of testing. You need to use the force
optional parameter like this:
.type('your string here', { force: true })
I hope that helps!
cc @maga-polito
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.
This issue has been closed due to inactivity.
I had the same problem.
I realized that some other element on the page was stealing the focus from the element I was typing in.
Experiencing the same issue described on https://github.com/cypress-io/cypress/issues/5480
This happens on angular dialogs from AngularJS Material library
cypress version: 6.8.0
I implemented the workaround described but when text is long this increment test execution time a lot