From 0e612fbb7d4316938f3a5264bd4cd4e4d12b0c4e Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Mon, 15 Apr 2024 15:55:28 +0200 Subject: [PATCH] Fix the "must check that a field has the correct value when a choice is changed" scripting integration test We should not wait for an arbitrary amount of time, which can easily cause intermittent failures, but wait for a value change instead. Note that this patch mirrors the approach we already use in other scripting integration tests that also check for a value change; see e.g. the "must check that a field has the correct formatted value" test. --- test/integration/scripting_spec.mjs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/integration/scripting_spec.mjs b/test/integration/scripting_spec.mjs index 0ebf460c1..a17b2ef00 100644 --- a/test/integration/scripting_spec.mjs +++ b/test/integration/scripting_spec.mjs @@ -1932,18 +1932,14 @@ describe("Interaction", () => { expect(text).withContext(`In ${browserName}`).toEqual(""); await page.select(getSelector("6R"), "Yes"); - // eslint-disable-next-line no-restricted-syntax - await waitForTimeout(10); - + await page.waitForFunction(`${getQuerySelector("44R")}.value !== ""`); text = await page.$eval(getSelector("44R"), el => el.value); expect(text).withContext(`In ${browserName}`).toEqual("Yes"); await clearInput(page, getSelector("44R")); await page.select(getSelector("6R"), "No"); - // eslint-disable-next-line no-restricted-syntax - await waitForTimeout(10); - + await page.waitForFunction(`${getQuerySelector("44R")}.value !== ""`); text = await page.$eval(getSelector("44R"), el => el.value); expect(text).withContext(`In ${browserName}`).toEqual("No"); })