Skip to content

Commit

Permalink
Fix the "must check that a field has the correct value when a choice …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
timvandermeij committed Apr 15, 2024
1 parent 00af2e7 commit 0e612fb
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions test/integration/scripting_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
})
Expand Down

0 comments on commit 0e612fb

Please sign in to comment.