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 #18775.
  • Loading branch information
calixteman committed Oct 6, 2024
1 parent 81cf42d commit dd752ff
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions test/integration/highlight_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,7 @@ describe("Highlight Editor", () => {
});
});

describe("Draw a free highlight with the pointer hovering an existing highlight", () => {
fdescribe("Draw a free highlight with the pointer hovering an existing highlight", () => {

Check failure on line 1762 in test/integration/highlight_editor_spec.mjs

View workflow job for this annotation

GitHub Actions / Lint (lts/*)

Unexpected fdescribe
let pages;

beforeAll(async () => {
Expand All @@ -1777,14 +1777,19 @@ describe("Highlight Editor", () => {

const rect = await getSpanRectFromText(page, 1, "Abstract");
const editorSelector = getEditorSelector(0);
const x = rect.x + rect.width / 2;
let y = rect.y + rect.height / 2;
const x = Math.round(rect.x + rect.width / 2);
let y = Math.round(rect.y + rect.height / 2);
await page.mouse.click(x, y, { count: 2, 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 - rect.height;
await page.mouse.move(x, Math.round(y));
console.log(browserName, "move 1", rect, x, y);

const counterHandle = await page.evaluateHandle(sel => {
const el = document.querySelector(sel);
const counter = { count: 0 };
Expand All @@ -1798,19 +1803,25 @@ 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();
console.log(browserName, "move 2", await counterHandle.jsonValue());
await page.waitForSelector(
`.page[data-page-number = "1"] .annotationEditorLayer.drawing`
);
let i = 2;
for (
const endY = rect.y + 2 * rect.height;
y <= endY;
y += rect.height / 10
) {
await page.mouse.move(x, y);
await page.mouse.move(x, Math.round(y));
console.log(browserName, "move " + (i++), x, y, await counterHandle.jsonValue());

Check failure on line 1818 in test/integration/highlight_editor_spec.mjs

View workflow job for this annotation

GitHub Actions / Lint (lts/*)

Replace `browserName,·"move·"·+·(i++),·x,·y,·await·counterHandle.jsonValue()` with `⏎··············browserName,⏎··············"move·"·+·i++,⏎··············x,⏎··············y,⏎··············await·counterHandle.jsonValue()⏎············`
}
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

0 comments on commit dd752ff

Please sign in to comment.