Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(inspect): highlight on explore input change (#5726)
Pavel Feldman1d6feb2ab8ef
diff --git a/src/server/supplements/recorderSupplement.ts b/src/server/supplements/recorderSupplement.tsindex 097dd360d7..95fccaa0a3 100644--- a/src/server/supplements/recorderSupplement.ts+++ b/src/server/supplements/recorderSupplement.ts@@ -204,7 +204,7 @@ export class RecorderSupplement {await this._context.exposeBinding('_playwrightRecorderState', false, source => {let snapshotUrl: string | undefined;- let actionSelector: string | undefined;+ let actionSelector = this._highlightedSelector;let actionPoint: Point | undefined;if (this._hoveredSnapshot) {const metadata = this._allMetadatas.get(this._hoveredSnapshot.callLogId)!;@@ -214,7 +214,7 @@ export class RecorderSupplement {for (const [metadata, sdkObject] of this._currentCallsMetadata) {if (source.page === sdkObject.attribution.page) {actionPoint = metadata.point || actionPoint;- actionSelector = metadata.params.selector || actionSelector;+ actionSelector = actionSelector || metadata.params.selector;}}}diff --git a/test/pause.spec.ts b/test/pause.spec.tsindex 841e9bd814..6ce9ed8f21 100644--- a/test/pause.spec.ts+++ b/test/pause.spec.ts@@ -270,6 +270,24 @@ describe('pause', (suite, { mode }) => {await recorderPage.click('[title=Resume]');await scriptPromise;});++ it('should highlight on explore', async ({ page, recorderPageGetter }) => {+ await page.setContent('<button>Submit</button>');+ const scriptPromise = (async () => {+ await page.pause();+ })();+ const recorderPage = await recorderPageGetter();+ const [element] = await Promise.all([+ page.waitForSelector('x-pw-highlight:visible'),+ recorderPage.fill('input[placeholder="Playwright Selector"]', 'text=Submit'),+ ]);+ const button = await page.$('text=Submit');+ const box1 = await element.boundingBox();+ const box2 = await button.boundingBox();+ expect(box1).toEqual(box2);+ await recorderPage.click('[title=Resume]');+ await scriptPromise;+ });});async function sanitizeLog(recorderPage: Page): Promise<string[]> {