Merge pull request #18399 from timvandermeij/intermittent-charlimit
Fix the "must check that charLimit is correctly set" scripting integration test
This commit is contained in:
commit
7a5f5616f4
@ -1535,49 +1535,35 @@ describe("Interaction", () => {
|
|||||||
|
|
||||||
it("must check that charLimit is correctly set", async () => {
|
it("must check that charLimit is correctly set", async () => {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
pages.map(async ([browserName, page]) => {
|
pages.map(async ([, page]) => {
|
||||||
await page.waitForFunction(
|
await page.waitForFunction(
|
||||||
"window.PDFViewerApplication.scriptingReady === true"
|
"window.PDFViewerApplication.scriptingReady === true"
|
||||||
);
|
);
|
||||||
|
|
||||||
await clearInput(page, getSelector("7R"));
|
// The default charLimit is 0, which indicates unlimited text length.
|
||||||
// By default the charLimit is 0 which means that the input
|
await page.type(getSelector("7R"), "abcdefghij", { delay: 10 });
|
||||||
// length is unlimited.
|
|
||||||
await page.type(getSelector("7R"), "abcdefghijklmnopq", {
|
|
||||||
delay: 10,
|
|
||||||
});
|
|
||||||
|
|
||||||
let value = await page.$eval(getSelector("7R"), el => el.value);
|
|
||||||
expect(value)
|
|
||||||
.withContext(`In ${browserName}`)
|
|
||||||
.toEqual("abcdefghijklmnopq");
|
|
||||||
|
|
||||||
// charLimit is set to 1
|
|
||||||
await page.click(getSelector("9R"));
|
|
||||||
|
|
||||||
await page.waitForFunction(
|
await page.waitForFunction(
|
||||||
`document.querySelector('${getSelector(
|
`${getQuerySelector("7R")}.value === "abcdefghij"`
|
||||||
"7R"
|
|
||||||
)}').value !== "abcdefgh"`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
value = await page.$eval(getSelector("7R"), el => el.value);
|
// Increase the charLimit to 1 (this truncates the existing text).
|
||||||
expect(value).withContext(`In ${browserName}`).toEqual("a");
|
|
||||||
|
|
||||||
await clearInput(page, getSelector("7R"));
|
|
||||||
await page.type(getSelector("7R"), "xyz", { delay: 10 });
|
|
||||||
|
|
||||||
value = await page.$eval(getSelector("7R"), el => el.value);
|
|
||||||
expect(value).withContext(`In ${browserName}`).toEqual("x");
|
|
||||||
|
|
||||||
// charLimit is set to 2
|
|
||||||
await page.click(getSelector("9R"));
|
await page.click(getSelector("9R"));
|
||||||
|
await waitForSandboxTrip(page);
|
||||||
|
await page.waitForFunction(`${getQuerySelector("7R")}.value === "a"`);
|
||||||
|
|
||||||
await clearInput(page, getSelector("7R"));
|
await clearInput(page, getSelector("7R"));
|
||||||
await page.type(getSelector("7R"), "xyz", { delay: 10 });
|
await page.type(getSelector("7R"), "xyz", { delay: 10 });
|
||||||
|
await page.waitForFunction(`${getQuerySelector("7R")}.value === "x"`);
|
||||||
|
|
||||||
value = await page.$eval(getSelector("7R"), el => el.value);
|
// Increase the charLimit to 2.
|
||||||
expect(value).withContext(`In ${browserName}`).toEqual("xy");
|
await page.click(getSelector("9R"));
|
||||||
|
await waitForSandboxTrip(page);
|
||||||
|
|
||||||
|
await clearInput(page, getSelector("7R"));
|
||||||
|
await page.type(getSelector("7R"), "xyz", { delay: 10 });
|
||||||
|
await page.waitForFunction(
|
||||||
|
`${getQuerySelector("7R")}.value === "xy"`
|
||||||
|
);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user