-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix: activate main tab before detecting iframe focus in firefox/bidi implementation of cy.press() #31481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cypress
|
Project |
cypress
|
Branch Review |
cacie/fix/ff-press-flake
|
Run status |
|
Run duration | 09m 37s |
Commit |
|
Committer | Cacie Prins |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
694
|
|
0
|
|
130
|
View all changes introduced in this branch ↗︎ |
} | ||
|
||
async function activateTopWindow (client: Client, autContext: string): Promise<void> { | ||
const { contexts: [{ context: topLevelContext }] } = await client.browsingContextGetTree({}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just eliminate this function and just call client.switchToWindow(topLevelContext)
or remove the autContext
arg? I don't think autContext
is used, but my guess is this was looking up the top context before but no longer is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in e0421b2
|
||
it('activates the top level context window', async () => { | ||
await bidiKeyPress({ key }, client as WebdriverClient, autContext, 'idSuffix') | ||
expect(client.switchToWindow).to.have.been.calledWith(topLevelContext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably also testing the case when the top level context is already active and we don't need to call switchToWindow
if that test doesn't already exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely - also the case where there is an active window, but it's not our top
. Addressed in 944b913
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
cy.press()
only works in the first spec of a run #31466Additional details
The webdriver classic window reference does not sync with the webdriver bidi active context automatically; between specs we clear out all of the tabs and create a new one, so webdriver classic needs to be informed of which window/tab needs to be active. The webdriver classic methods in use are in order to determine if the AUT iframe has focus (will receive key press events).
Steps to test
In run mode, execute any spec prior to executing the
cypress/e2e/commands/actions/press.cy.ts
spec (or any other spec that includes thecy.press()
command. Thecy.press()
command should not error.How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?