Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the "must check that an infinite loop is not triggered" integration test #19064

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions test/integration/scripting_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,13 @@ describe("Interaction", () => {
await page.waitForFunction(
`${getQuerySelector("27R")}.value === "HEAO "`
);

// The typing actions in the first textbox caused sandbox events to be
// queued. We don't close the document between tests, so we have to
// flush them here, by clicking the second textbox, so they don't leak
// through to the following test.
await page.click(getSelector("28R"));
await waitForSandboxTrip(page);
})
);
});
Expand All @@ -1276,30 +1283,19 @@ describe("Interaction", () => {
await waitForScripting(page);

await page.click(getSelector("28R"));
await page.$eval(getSelector("28R"), el =>
el.setSelectionRange(0, 0)
);

await page.keyboard.press("Home");
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.
// The action triggers a `calculateNow` which in turn triggers a
// `resetForm (inducing a `calculateNow`) and a `calculateNow`.
// Without infinite loop prevention the field would be 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