Wait for selector instead of timeout in the bug1844576 integration test

This integration test currently fails intermittently on the bots because
of the fixed timeout in the test, which is sometimes too low on slower
systems. The issue can be reproduced 100% of the time by introducing a
delay in the `WidgetAnnotationElement.showElementAndHideCanvas` method.

Puppeteer also discourages this and instead recommends waiting for a
selector instead, which we now do here. This ensures that the test only
continues if the element under test is available and therefore prevents
any timing problems.
This commit is contained in:
Tim van der Meij 2023-09-17 12:59:56 +02:00
parent dd46110f6b
commit 0d3fbc1818
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -2011,7 +2011,9 @@ describe("Interaction", () => {
expect(hasHiddenInput).withContext(`In ${browserName}`).toEqual(true);
await page.click(getSelector("12R"));
await page.waitForTimeout(10);
await page.waitForSelector(
`[data-annotation-id="9R"] > canvas[hidden]`
);
const hasHiddenCanvas = await page.$eval(
`[data-annotation-id="9R"] > canvas`,