chore: fix inspector cli firefox tests flakiness (#20919)

This commit is contained in:
Andrey Lushnikov 2023-02-15 09:12:37 -08:00 committed by GitHub
parent 91da67fab1
commit 5f9e2f3db9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -252,6 +252,10 @@ class Recorder {
if (this._mode === 'none')
return;
const activeElement = this._deepActiveElement(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 === document.body)
return;
const result = activeElement ? generateSelector(this._injectedScript, activeElement, this._testIdAttributeName) : null;
this._activeModel = result && result.selector ? result : null;
if (userGesture)