From cf0e253690226a98366dbec7f8b396274179ab0f Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 3 Nov 2024 18:04:00 +0100 Subject: [PATCH] Fix the "must check that an infinite loop is not triggered" scripting integration test This integration test fails intermittently because we're not correctly awaiting typing actions, causing some characters to be missed in the assertion. This commit fixes the issues by directly waiting for the expected text area contents, similar to e.g. PR #18399 and PR #19001. --- test/integration/scripting_spec.mjs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/test/integration/scripting_spec.mjs b/test/integration/scripting_spec.mjs index 7f74d5893c13f8..8a6c36c4ff12ef 100644 --- a/test/integration/scripting_spec.mjs +++ b/test/integration/scripting_spec.mjs @@ -1282,24 +1282,17 @@ describe("Interaction", () => { await page.type(getSelector("28R"), "Hello"); await page.waitForFunction( - `${getQuerySelector("28R")}.value !== "123"` + `${getQuerySelector("28R")}.value === "Hello123"` ); - let text = await page.$eval(getSelector("28R"), el => el.value); - expect(text).withContext(`In ${browserName}`).toEqual("Hello123"); - // The action will trigger a calculateNow which itself // will trigger a resetForm (inducing a calculateNow) and a - // calculateNow. + // calculateNow. Without preventing against infinite loop + // the field is empty. await page.click("[data-annotation-id='31R']"); - await page.waitForFunction( - `${getQuerySelector("28R")}.value !== "Hello123"` + `${getQuerySelector("28R")}.value === "123"` ); - - // Without preventing against infinite loop the field is empty. - text = await page.$eval(getSelector("28R"), el => el.value); - expect(text).withContext(`In ${browserName}`).toEqual("123"); }) ); });