Skip to content

Commit

Permalink
Fix the "must check that an infinite loop is not triggered" scripting…
Browse files Browse the repository at this point in the history
… 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 mozilla#18399 and PR mozilla#19001.
  • Loading branch information
timvandermeij committed Nov 3, 2024
1 parent 35673d3 commit cf0e253
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions test/integration/scripting_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
})
);
});
Expand Down

0 comments on commit cf0e253

Please sign in to comment.