cypress: cy.focused() inconsistent behavior
- Operating System: Mac OS X Sierra
- Cypress Version: 1.0.2
- Browser Version: All
Is this a Feature or Bug?
Bug
Current behavior:
cy.focused()
does the right thing when you keep the Cypress UI window focused. It does the wrong thing if you blur the Cypress UI window or if you run headlessly.
Desired behavior:
cy.focused()
should produce consistent results, regardless of being run headed/headless or focused/blurred.
How to reproduce:
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 9
- Comments: 17 (12 by maintainers)
Hey, while this works in headless mode,
focused()
still fails when using the ui and not having the cypress window focused. It would be great if it worked even when I’m on another tab or in my IDE, etc.@brian-mann meaning these docs are out of date, and you implement the chai-jquery natively (via the string args in
.should()
)?I also second the OP – currently
cy.focused()
yieldswindow
object (in some(?) cases) ).IMO
cy.focused()
should correctly yield focused element.Meanwhile, it can be done like this:
Damn, what was I thinking?? Nevermind all that. Sorry for bothering…
I ran into this issue when testing moving between text boxes in a form. Basically was testing the behavior of focusing on the first text box, typed something, jumped to next one and typing something else.