cy.type() randomly failing to set text, when length of text > 5.
See original GitHub issueCurrent behavior:
cy.type(‘Los Angeles, CA, USA’).should(‘have.value’, ‘Los Angeles, CA, USA’); is failing randomly in google map’s search field. Its like randomly happening. I ran 10 times and it passed 3 times only.
Screen shot:
Desired behavior:
It should set text as we expected all times.
Steps to reproduce: (app code and test code)
Code:
describe('Location related tests', function() {
it('should search the respective location', function() {
cy.visit('https://maps.google.com/');
cy.get('#searchboxinput')
.type('Los Angeles, CA, USA')
.should('have.value', 'Los Angeles, CA, USA');
})
});
Versions
“cypress”: “^3.6.0”
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Retry-ability - Cypress Documentation
If the assertion still fails, Cypress continues retrying until the cy.find() timeout is reached. Retry-ability allows the test to complete each query as...
Read more >cy.type() failed because this element is not visible: - You.com
Hello,. Facing the issue loading the login page in cypress test using cy.visit(). Tested in browser and url link is working correctly so...
Read more >cy.clear() not clearing input field properly - Cypress
clear().should('have.value', '').type('random text');. It works some time and in other times it complains it does not ...
Read more >Solve Flake In Cypress Typing Into An Input Element
Workaround using cypress-recurse # ; () => cy.get('#flaky-input').clear().type(text), ; ($input) => $input.val() === text, ; log: false,
Read more >Bash Reference Manual - GNU.org
The term macro processor means functionality where text and symbols are expanded to create larger expressions. A Unix shell is both a command ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Bkucera I could reproduce this issue exactly as @hardikdiyora92 describes in the test case but…
I created a PR at https://github.com/cypress-io/cypress-test-tiny/pull/53 to demonstrate potentially similar, if not the same issue around the
type()
command. It seems to be related to3.6.x
. The AngularJS material input I am using receives partial events fromtype()
but doesn’t react as expected.The first test example shows it failing. The second shows that I can work around the issue in certain cases by using a
click()
on the component before I type. It looks like the type event isn’t setting, possibly keeping focus, when the type command starts to send events; reverting to the last clicked element and starts sending the events to that other component.@hardikdiyora92 trying out the google maps example, type is working fine but the page is still loading while the text is being typed, which causes the input to briefly be blurred. You can manually verifying this by commenting out all steps but the cy.visit() and manually typing as soon as the page starts to load. If you add a
.wait()
before the type, the problem goes awayyou could use
cy.route
and wait on one of the XHRs to complete before proceeding in the test