fix: stricter condition for Firefox codegen tests workaround (#20998)

This patch fixes the following tests on WebKit @ Darwin:
- library/inspector/cli-codegen-2.spec.ts:197:7 › cli codegen › should
download files
- library/inspector/cli-codegen-2.spec.ts:428:7 › cli codegen › should
update hover model on action
This commit is contained in:
Andrey Lushnikov 2023-02-17 12:19:46 -08:00 committed by GitHub
parent d7a0b3bb4e
commit 1b441ef4f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,7 +239,7 @@ export class Recorder {
const activeElement = this._deepActiveElement(this.document);
// Firefox dispatches "focus" event to body when clicking on a backgrounded headed browser window.
// We'd like to ignore this stray event.
if (activeElement === this.document.body)
if (userGesture && activeElement === this.document.body)
return;
const result = activeElement ? generateSelector(this._injectedScript, activeElement, this._testIdAttributeName) : null;
this._activeModel = result && result.selector ? result : null;