From 2e9bd496ce1f79b59072f6c477f4886523aef517 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 14 Apr 2024 18:49:31 +0200 Subject: [PATCH] Fix the "must check that invisible fields are made visible" scripting integration test We should not wait for an arbitrary amount of time, which can easily cause intermittent failures, but wait for a property value change instead. Note that this patch mirrors the approach we already use in other scripting integration tests that also check for a visibility change; see e.g. the "must show a text field and then make in invisible when content is removed" test. --- test/integration/scripting_spec.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/integration/scripting_spec.mjs b/test/integration/scripting_spec.mjs index 1cea0f2f7..0ebf460c1 100644 --- a/test/integration/scripting_spec.mjs +++ b/test/integration/scripting_spec.mjs @@ -2104,9 +2104,10 @@ describe("Interaction", () => { expect(visibility).withContext(`In ${browserName}`).toEqual("hidden"); await page.click(getSelector("11R")); - // eslint-disable-next-line no-restricted-syntax - await waitForTimeout(10); + await page.waitForFunction( + `${getComputedStyleSelector("7R")}.visibility !== "hidden"` + ); visibility = await page.$eval( getSelector("7R"), el => getComputedStyle(el).visibility @@ -2115,6 +2116,9 @@ describe("Interaction", () => { .withContext(`In ${browserName}`) .toEqual("visible"); + await page.waitForFunction( + `${getComputedStyleSelector("8R")}.visibility !== "hidden"` + ); visibility = await page.$eval( getSelector("8R"), el => getComputedStyle(el).visibility