Skip to content

Commit

Permalink
Fix failing integration test on Windws with Chrome
Browse files Browse the repository at this point in the history
It fixes mozilla#18775.
  • Loading branch information
calixteman committed Oct 6, 2024
1 parent 81cf42d commit f4a80bc
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions test/integration/highlight_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const getXY = async (page, selector) => {
return `${rect.x}::${rect.y}`;
};

describe("Highlight Editor", () => {
fdescribe("Highlight Editor", () => {
describe("Editor must be removed without exception", () => {
let pages;

Expand Down Expand Up @@ -1785,6 +1785,10 @@ describe("Highlight Editor", () => {
await page.keyboard.press("Escape");
await page.waitForSelector(`${editorSelector}:not(.selectedEditor)`);

const clickHandle = await waitForPointerUp(page);
y = rect.y - rect.height;
await page.mouse.move(x, y);

const counterHandle = await page.evaluateHandle(sel => {
const el = document.querySelector(sel);
const counter = { count: 0 };
Expand All @@ -1798,10 +1802,10 @@ describe("Highlight Editor", () => {
return counter;
}, editorSelector);

const clickHandle = await waitForPointerUp(page);
y = rect.y - rect.height;
await page.mouse.move(x, y);
await page.mouse.down();
await page.waitForSelector(
`.page[data-page-number = "1"] .annotationEditorLayer.drawing`
);
for (
const endY = rect.y + 2 * rect.height;
y <= endY;
Expand All @@ -1811,6 +1815,9 @@ describe("Highlight Editor", () => {
}
await page.mouse.up();
await awaitPromise(clickHandle);
await page.waitForSelector(
`.page[data-page-number = "1"] .annotationEditorLayer:not(.drawing)`
);

const { count } = await counterHandle.jsonValue();
expect(count).withContext(`In ${browserName}`).toEqual(0);
Expand Down Expand Up @@ -1841,14 +1848,18 @@ describe("Highlight Editor", () => {
"ternative compilation technique for dynamically-typed languages"
);
const editorSelector = getEditorSelector(0);
const x = rect.x + rect.width / 2;
const x = Math.round(rect.x + rect.width / 2);
let y = rect.y + rect.height / 2;
await page.mouse.click(x, y, { count: 3, delay: 100 });
await page.waitForSelector(editorSelector);
await waitForSerialized(page, 1);
await page.keyboard.press("Escape");
await page.waitForSelector(`${editorSelector}:not(.selectedEditor)`);

const clickHandle = await waitForPointerUp(page);
y = rect.y - 3 * rect.height;
await page.mouse.move(x, Math.round(y));

const counterHandle = await page.evaluateHandle(sel => {
const el = document.querySelector(sel);
const counter = { count: 0 };
Expand All @@ -1862,19 +1873,22 @@ describe("Highlight Editor", () => {
return counter;
}, editorSelector);

const clickHandle = await waitForPointerUp(page);
y = rect.y - 3 * rect.height;
await page.mouse.move(x, y);
await page.mouse.down();
await page.waitForSelector(
`.page[data-page-number = "1"] .textLayer.selecting`
);
for (
const endY = rect.y + 3 * rect.height;
y <= endY;
y += rect.height / 10
) {
await page.mouse.move(x, y);
await page.mouse.move(x, Math.round(y));
}
await page.mouse.up();
await awaitPromise(clickHandle);
await page.waitForSelector(
`.page[data-page-number = "1"] .textLayer:not(.selecting)`
);

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

0 comments on commit f4a80bc

Please sign in to comment.