Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly wait for the editor mode when double clicking on an annotation in integration tests #19163

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions test/integration/ink_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
loadAndWait,
scrollIntoView,
switchToEditor,
waitForAnnotationModeChanged,
waitForNoElement,
waitForSelectedEditor,
waitForSerialized,
Expand Down Expand Up @@ -796,7 +797,14 @@ describe("Ink Editor", () => {
it("must move an annotation", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.click(getAnnotationSelector("277R"), { count: 2 });
const modeChangedHandle = await waitForAnnotationModeChanged(page);
const inkRect = await getRect(page, getAnnotationSelector("277R"));
await page.mouse.click(
inkRect.x + inkRect.width / 2,
inkRect.y + inkRect.height / 2,
{ count: 2 }
);
await awaitPromise(modeChangedHandle);
const edgeB = getEditorSelector(10);
await waitForSelectedEditor(page, edgeB);

Expand All @@ -808,10 +816,7 @@ describe("Ink Editor", () => {
const serialized = await getSerialized(page);
expect(serialized).withContext(`In ${browserName}`).toEqual([]);

const editorRect = await page.$eval(edgeB, el => {
const { x, y, width, height } = el.getBoundingClientRect();
return { x, y, width, height };
});
const editorRect = await getRect(page, edgeB);

// Select the annotation we want to move.
await page.mouse.click(editorRect.x + 2, editorRect.y + 2);
Expand Down
7 changes: 7 additions & 0 deletions test/integration/stamp_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
serializeBitmapDimensions,
switchToEditor,
waitForAnnotationEditorLayer,
waitForAnnotationModeChanged,
waitForEntryInStorage,
waitForSelectedEditor,
waitForSerialized,
Expand Down Expand Up @@ -1437,7 +1438,9 @@ describe("Stamp Editor", () => {
it("must move an annotation", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
const modeChangedHandle = await waitForAnnotationModeChanged(page);
await page.click(getAnnotationSelector("25R"), { count: 2 });
await awaitPromise(modeChangedHandle);
await waitForSelectedEditor(page, getEditorSelector(0));

const editorIds = await getEditors(page, "stamp");
Expand Down Expand Up @@ -1484,7 +1487,9 @@ describe("Stamp Editor", () => {
it("must update an existing alt-text", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
const modeChangedHandle = await waitForAnnotationModeChanged(page);
await page.click(getAnnotationSelector("58R"), { count: 2 });
await awaitPromise(modeChangedHandle);
await waitForSelectedEditor(page, getEditorSelector(4));

const editorIds = await getEditors(page, "stamp");
Expand Down Expand Up @@ -1541,7 +1546,9 @@ describe("Stamp Editor", () => {
it("must check that the annotation is correctly restored", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
const modeChangedHandle = await waitForAnnotationModeChanged(page);
await page.click(getAnnotationSelector("37R"), { count: 2 });
await awaitPromise(modeChangedHandle);
const editorSelector = getEditorSelector(2);
await waitForSelectedEditor(page, editorSelector);

Expand Down
Loading