From 0d3fbc18187c7d35bbeef6d6d8b11a87e58a8bda Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 17 Sep 2023 12:59:56 +0200 Subject: [PATCH] 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. --- test/integration/scripting_spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/integration/scripting_spec.js b/test/integration/scripting_spec.js index 98f12a6b9..540d0c7fb 100644 --- a/test/integration/scripting_spec.js +++ b/test/integration/scripting_spec.js @@ -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`,