From ebdebe7bf581fbae1a647bc5f4c162ccc45d0ca7 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Sun, 6 Oct 2024 16:28:12 +0200 Subject: [PATCH] Fix failing integration test on Windws with Chrome It fixes #18775. --- test/integration/highlight_editor_spec.mjs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/test/integration/highlight_editor_spec.mjs b/test/integration/highlight_editor_spec.mjs index 931ff440a4439d..eddfe62ac5fb84 100644 --- a/test/integration/highlight_editor_spec.mjs +++ b/test/integration/highlight_editor_spec.mjs @@ -1777,14 +1777,18 @@ 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 = Math.round(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 }; @@ -1798,19 +1802,22 @@ 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; 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"] .annotationEditorLayer:not(.drawing)` + ); const { count } = await counterHandle.jsonValue(); expect(count).withContext(`In ${browserName}`).toEqual(0);