Skip to content

Commit 7daae99

Browse files
committed
Fix integration tests on Mac
It's mainly a matter of keyboard shortcuts. And it fixes few intermittents.
1 parent fbfacf8 commit 7daae99

7 files changed

+355
-213
lines changed

test/integration/copy_paste_spec.mjs

+5-9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
import {
1717
closePages,
18+
kbCopy,
19+
kbSelectAll,
1820
loadAndWait,
1921
mockClipboard,
2022
waitForEvent,
@@ -23,9 +25,7 @@ import {
2325

2426
const selectAll = async page => {
2527
const promise = waitForEvent(page, "selectionchange");
26-
await page.keyboard.down("Control");
27-
await page.keyboard.press("a");
28-
await page.keyboard.up("Control");
28+
await kbSelectAll(page);
2929
await promise;
3030

3131
await page.waitForFunction(() => {
@@ -64,9 +64,7 @@ describe("Copy and paste", () => {
6464
await selectAll(page);
6565

6666
const promise = waitForEvent(page, "copy");
67-
await page.keyboard.down("Control");
68-
await page.keyboard.press("c");
69-
await page.keyboard.up("Control");
67+
await kbCopy(page);
7068
await promise;
7169

7270
await page.waitForFunction(
@@ -173,9 +171,7 @@ describe("Copy and paste", () => {
173171
await selectAll(page);
174172

175173
const promise = waitForEvent(page, "copy");
176-
await page.keyboard.down("Control");
177-
await page.keyboard.press("c");
178-
await page.keyboard.up("Control");
174+
await kbCopy(page);
179175
await promise;
180176

181177
await page.waitForFunction(

test/integration/find_spec.mjs

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe("find bar", () => {
2929
let pages;
3030

3131
beforeAll(async () => {
32-
pages = await loadAndWait("find_all.pdf#zoom=100", ".textLayer");
32+
pages = await loadAndWait("find_all.pdf", ".textLayer", 100);
3333
});
3434

3535
afterAll(async () => {
@@ -76,7 +76,7 @@ describe("find bar", () => {
7676
let pages;
7777

7878
beforeAll(async () => {
79-
pages = await loadAndWait("xfa_imm5257e.pdf#zoom=100", ".xfaLayer");
79+
pages = await loadAndWait("xfa_imm5257e.pdf", ".xfaLayer");
8080
});
8181

8282
afterAll(async () => {
@@ -91,6 +91,9 @@ describe("find bar", () => {
9191
await page.type("#findInput", "preferences");
9292
await page.waitForSelector("#findInput[data-status='']");
9393
await page.waitForSelector(".xfaLayer .highlight");
94+
await page.waitForFunction(
95+
() => !!document.querySelector("#findResultsCount")?.textContent
96+
);
9497
const resultElement = await page.waitForSelector("#findResultsCount");
9598
const resultText = await resultElement.evaluate(el => el.textContent);
9699
/** Unicode bidi isolation characters. */

0 commit comments

Comments
 (0)