From 1b3ccf1321e344ad8b75772c6376793ee2459a1b Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 17 Sep 2023 18:49:11 +0200 Subject: [PATCH] Wait for selector instead of timeout in the freetext double click move 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 just before dispatching the `switchannotationeditormode` event. 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/freetext_editor_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/freetext_editor_spec.js b/test/integration/freetext_editor_spec.js index 084a98e10..830d3f357 100644 --- a/test/integration/freetext_editor_spec.js +++ b/test/integration/freetext_editor_spec.js @@ -1176,7 +1176,7 @@ describe("FreeText Editor", () => { await Promise.all( pages.map(async ([browserName, page]) => { await page.click("[data-annotation-id='26R']", { clickCount: 2 }); - await page.waitForTimeout(10); + await page.waitForSelector(`${getEditorSelector(0)}-editor`); const [focusedId, editable] = await page.evaluate(() => { const el = document.activeElement;