From c547416e24d7e87c927cbb965e9762f2383a4d34 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Fri, 2 Dec 2022 17:32:29 -0800 Subject: [PATCH] test: unflake "should highlight locators with custom testId" (#19236) --- tests/library/inspector/pause.spec.ts | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/tests/library/inspector/pause.spec.ts b/tests/library/inspector/pause.spec.ts index b287c1acdf..3ced5dfa78 100644 --- a/tests/library/inspector/pause.spec.ts +++ b/tests/library/inspector/pause.spec.ts @@ -415,29 +415,19 @@ it.describe('pause', () => { }); it('should highlight locators with custom testId', async ({ page, playwright, recorderPageGetter }) => { - await page.setContent('
click me
and me
'); + await page.setContent('
and me
'); const scriptPromise = (async () => { await page.pause(); - await page.getByText('click me').click(); playwright.selectors.setTestIdAttribute('data-custom-id'); await page.getByTestId('foo').click(); })(); const recorderPage = await recorderPageGetter(); + const box1Promise = waitForTestLog(page, 'Highlight box for test: '); await recorderPage.click('[title="Step over (F10)"]'); - const div1Box1 = roundBox(await page.locator('x-pw-highlight').boundingBox()); - const div1Box2 = roundBox(await page.locator('#target1').boundingBox()); - expect(div1Box1).toEqual(div1Box2); - - await recorderPage.click('[title="Step over (F10)"]'); - let div2Box1: Box; - await expect.poll(async () => { - div2Box1 = await page.locator('x-pw-highlight').boundingBox(); - return div2Box1; - }).toBeTruthy(); - div2Box1 = roundBox(div2Box1); - const div2Box2 = roundBox(await page.locator('#target2').boundingBox()); - expect(div2Box1).toEqual(div2Box2); + const box2 = roundBox(await page.locator('#target').boundingBox()); + const box1 = roundBox(await box1Promise); + expect(box1).toEqual(box2); await recorderPage.click('[title="Resume (F8)"]'); await scriptPromise;