mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: unflake "should highlight locators with custom testId" (#19236)
This commit is contained in:
parent
291ad6e618
commit
c547416e24
@ -415,29 +415,19 @@ it.describe('pause', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should highlight locators with custom testId', async ({ page, playwright, recorderPageGetter }) => {
|
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 () => {
|
const scriptPromise = (async () => {
|
||||||
await page.pause();
|
await page.pause();
|
||||||
await page.getByText('click me').click();
|
|
||||||
playwright.selectors.setTestIdAttribute('data-custom-id');
|
playwright.selectors.setTestIdAttribute('data-custom-id');
|
||||||
await page.getByTestId('foo').click();
|
await page.getByTestId('foo').click();
|
||||||
})();
|
})();
|
||||||
const recorderPage = await recorderPageGetter();
|
const recorderPage = await recorderPageGetter();
|
||||||
|
|
||||||
|
const box1Promise = waitForTestLog<Box>(page, 'Highlight box for test: ');
|
||||||
await recorderPage.click('[title="Step over (F10)"]');
|
await recorderPage.click('[title="Step over (F10)"]');
|
||||||
const div1Box1 = roundBox(await page.locator('x-pw-highlight').boundingBox());
|
const box2 = roundBox(await page.locator('#target').boundingBox());
|
||||||
const div1Box2 = roundBox(await page.locator('#target1').boundingBox());
|
const box1 = roundBox(await box1Promise);
|
||||||
expect(div1Box1).toEqual(div1Box2);
|
expect(box1).toEqual(box2);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
await recorderPage.click('[title="Resume (F8)"]');
|
await recorderPage.click('[title="Resume (F8)"]');
|
||||||
await scriptPromise;
|
await scriptPromise;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user