Skip to content

Commit 31c7bbf

Browse files
committed
Fix failing integration test on Windws with Chrome
It fixes #18775.
1 parent 81cf42d commit 31c7bbf

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

test/integration/highlight_editor_spec.mjs

+24-10
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,10 @@ describe("Highlight Editor", () => {
17851785
await page.keyboard.press("Escape");
17861786
await page.waitForSelector(`${editorSelector}:not(.selectedEditor)`);
17871787

1788+
const clickHandle = await waitForPointerUp(page);
1789+
y = rect.y - rect.height;
1790+
await page.mouse.move(x, y);
1791+
17881792
const counterHandle = await page.evaluateHandle(sel => {
17891793
const el = document.querySelector(sel);
17901794
const counter = { count: 0 };
@@ -1798,19 +1802,22 @@ describe("Highlight Editor", () => {
17981802
return counter;
17991803
}, editorSelector);
18001804

1801-
const clickHandle = await waitForPointerUp(page);
1802-
y = rect.y - rect.height;
1803-
await page.mouse.move(x, y);
18041805
await page.mouse.down();
1806+
await page.waitForSelector(
1807+
`.page[data-page-number = "1"] .annotationEditorLayer.drawing`
1808+
);
18051809
for (
18061810
const endY = rect.y + 2 * rect.height;
18071811
y <= endY;
18081812
y += rect.height / 10
18091813
) {
1810-
await page.mouse.move(x, y);
1814+
await page.mouse.move(x, Math.round(y));
18111815
}
18121816
await page.mouse.up();
18131817
await awaitPromise(clickHandle);
1818+
await page.waitForSelector(
1819+
`.page[data-page-number = "1"] .annotationEditorLayer:not(.drawing)`
1820+
);
18141821

18151822
const { count } = await counterHandle.jsonValue();
18161823
expect(count).withContext(`In ${browserName}`).toEqual(0);
@@ -1841,14 +1848,18 @@ describe("Highlight Editor", () => {
18411848
"ternative compilation technique for dynamically-typed languages"
18421849
);
18431850
const editorSelector = getEditorSelector(0);
1844-
const x = rect.x + rect.width / 2;
1845-
let y = rect.y + rect.height / 2;
1851+
const x = Math.round(rect.x + rect.width / 2);
1852+
let y = Math.round(rect.y + rect.height / 2);
18461853
await page.mouse.click(x, y, { count: 3, delay: 100 });
18471854
await page.waitForSelector(editorSelector);
18481855
await waitForSerialized(page, 1);
18491856
await page.keyboard.press("Escape");
18501857
await page.waitForSelector(`${editorSelector}:not(.selectedEditor)`);
18511858

1859+
const clickHandle = await waitForPointerUp(page);
1860+
y = rect.y - 3 * rect.height;
1861+
await page.mouse.move(x, y);
1862+
18521863
const counterHandle = await page.evaluateHandle(sel => {
18531864
const el = document.querySelector(sel);
18541865
const counter = { count: 0 };
@@ -1862,19 +1873,22 @@ describe("Highlight Editor", () => {
18621873
return counter;
18631874
}, editorSelector);
18641875

1865-
const clickHandle = await waitForPointerUp(page);
1866-
y = rect.y - 3 * rect.height;
1867-
await page.mouse.move(x, y);
18681876
await page.mouse.down();
1877+
await page.waitForSelector(
1878+
`.page[data-page-number = "1"] .textLayer.selecting`
1879+
);
18691880
for (
18701881
const endY = rect.y + 3 * rect.height;
18711882
y <= endY;
18721883
y += rect.height / 10
18731884
) {
1874-
await page.mouse.move(x, y);
1885+
await page.mouse.move(x, Math.round(y));
18751886
}
18761887
await page.mouse.up();
18771888
await awaitPromise(clickHandle);
1889+
await page.waitForSelector(
1890+
`.page[data-page-number = "1"] .textLayer:not(.selecting)`
1891+
);
18781892

18791893
const { count } = await counterHandle.jsonValue();
18801894
expect(count).withContext(`In ${browserName}`).toEqual(0);

test/integration/text_layer_spec.mjs

+5-2
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,14 @@ describe("Text layer", () => {
4343
}
4444

4545
function middleLeftPosition(rect) {
46-
return { x: rect.x + 1, y: rect.y + rect.height / 2 };
46+
return { x: rect.x + 1, y: rect.y + Math.floor(rect.height / 2) };
4747
}
4848

4949
function belowEndPosition(rect) {
50-
return { x: rect.x + rect.width, y: rect.y + rect.height * 1.5 };
50+
return {
51+
x: rect.x + rect.width,
52+
y: rect.y + Math.floor(rect.height * 1.5),
53+
};
5154
}
5255

5356
beforeAll(() => {

0 commit comments

Comments
 (0)