Skip to content

Commit

Permalink
Click on download and print buttons using element.click function in s…
Browse files Browse the repository at this point in the history
…cripting integration tests
  • Loading branch information
calixteman committed Jan 6, 2021
1 parent ed3758f commit 23211ae
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/integration/scripting_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,12 @@ describe("Interaction", () => {
if (process.platform === "win32" && browserName === "firefox") {
pending("Disabled in Firefox on Windows, because of bug 1662471.");
}
await page.waitForSelector("#print", {
timeout: 0,
});

let text = await actAndWaitForInput(page, "#\\34 7R", async () => {
await page.click("#print");
await page.evaluate(() => document.querySelector("#print").click());
});
expect(text).withContext(`In ${browserName}`).toEqual("WillPrint");

Expand Down Expand Up @@ -337,6 +341,10 @@ describe("Interaction", () => {
it("must execute WillSave and DidSave actions", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.waitForSelector("#download", {
timeout: 0,
});

try {
// Disable download in chrome
// (it leads to an error in firefox so the try...)
Expand All @@ -346,7 +354,9 @@ describe("Interaction", () => {
} catch (_) {}
await clearInput(page, "#\\34 7R");
let text = await actAndWaitForInput(page, "#\\34 7R", async () => {
await page.click("#download");
await page.evaluate(() =>
document.querySelector("#download").click()
);
});
expect(text).withContext(`In ${browserName}`).toEqual("WillSave");

Expand Down

0 comments on commit 23211ae

Please sign in to comment.