From 5862e94602e3d36bfd0af5fa23a9a87384828ea0 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Wed, 6 Jan 2021 13:50:34 +0100 Subject: [PATCH] Click on download and print buttons using element.click function in scripting integration tests --- test/integration/scripting_spec.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/integration/scripting_spec.js b/test/integration/scripting_spec.js index 01f6e7ea5d47c..79a6aab074a58 100644 --- a/test/integration/scripting_spec.js +++ b/test/integration/scripting_spec.js @@ -312,6 +312,9 @@ describe("Interaction", () => { await page.waitForFunction( "window.PDFViewerApplication.scriptingReady === true" ); + await page.waitForSelector("#print", { + timeout: 0, + }); await clearInput(page, "#\\34 7R"); await page.evaluate(_ => { @@ -322,7 +325,7 @@ describe("Interaction", () => { ); 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"); @@ -354,6 +357,9 @@ describe("Interaction", () => { await page.waitForFunction( "window.PDFViewerApplication.scriptingReady === true" ); + await page.waitForSelector("#download", { + timeout: 0, + }); try { // Disable download in chrome @@ -371,7 +377,9 @@ describe("Interaction", () => { ); 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");