From 46321e5bf25225762a375514063c55bda130ec9e Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Sat, 16 Nov 2024 07:56:33 -0800 Subject: [PATCH] chore: clear highlight when performing action (#33638) --- .../src/server/injected/recorder/recorder.ts | 7 +++++-- tests/library/inspector/cli-codegen-2.spec.ts | 11 ----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/packages/playwright-core/src/server/injected/recorder/recorder.ts b/packages/playwright-core/src/server/injected/recorder/recorder.ts index b905ba8548..ddfb0386d9 100644 --- a/packages/playwright-core/src/server/injected/recorder/recorder.ts +++ b/packages/playwright-core/src/server/injected/recorder/recorder.ts @@ -492,9 +492,10 @@ class RecordActionTool implements RecorderTool { return; const result = activeElement ? this._recorder.injectedScript.generateSelector(activeElement, { testIdAttributeName: this._recorder.state.testIdAttributeName }) : null; this._activeModel = result && result.selector ? result : null; - if (userGesture) + if (userGesture) { this._hoveredElement = activeElement as HTMLElement | null; - this._updateModelForHoveredElement(); + this._updateModelForHoveredElement(); + } } private _shouldIgnoreMouseEvent(event: MouseEvent): boolean { @@ -589,6 +590,8 @@ class RecordActionTool implements RecorderTool { } private _updateModelForHoveredElement() { + if (this._performingActions.size) + return; if (!this._hoveredElement || !this._hoveredElement.isConnected) { this._hoveredModel = null; this._hoveredElement = null; diff --git a/tests/library/inspector/cli-codegen-2.spec.ts b/tests/library/inspector/cli-codegen-2.spec.ts index e4aa0a0786..47afcc2fab 100644 --- a/tests/library/inspector/cli-codegen-2.spec.ts +++ b/tests/library/inspector/cli-codegen-2.spec.ts @@ -402,17 +402,6 @@ await page1.GotoAsync("about:blank?foo");`); await expect.poll(() => messages).toEqual(['mousedown', 'mouseup', 'click']); }); - test('should update hover model on action', async ({ openRecorder }) => { - const { page, recorder } = await openRecorder(); - - await recorder.setContentAndWait(``); - const [models] = await Promise.all([ - recorder.waitForActionPerformed(), - page.click('input') - ]); - expect(models.hovered).toBe('#checkbox'); - }); - test('should reset hover model on action when element detaches', async ({ openRecorder }) => { const { page, recorder } = await openRecorder();