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
test: unflake "should highlight locators with custom testId" (#19236)
Dmitry Gozmanc547416e24d7
diff --git a/tests/library/inspector/pause.spec.ts b/tests/library/inspector/pause.spec.tsindex 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('<div id=target1>click me</div><div data-custom-id=foo id=target2>and me</div>');+ await page.setContent('<div data-custom-id=foo id=target>and me</div>');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<Box>(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;