Skip to content
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
19 changes: 5 additions & 14 deletions test/integration/comment_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
waitAndClick,
waitForBrowserTrip,
waitForSerialized,
waitForTextToBe,
waitForTimeout,
waitForTooltipToBe,
} from "./test_utils.mjs";
Expand Down Expand Up @@ -1056,21 +1057,11 @@ describe("Comment", () => {

await page.waitForSelector("#commentPopup", { visible: true });
await waitAndClick(page, "button.commentPopupDelete");

await page.waitForFunction(() => {
const messageElement = document.querySelector(
"#editorUndoBarMessage"
);
return messageElement && messageElement.textContent.trim() !== "";
});
const message = await page.waitForSelector("#editorUndoBarMessage");
const messageText = await page.evaluate(
el => el.textContent,
message
await waitForTextToBe(
page,
"#editorUndoBarMessage",
"Comment removed"
);
expect(messageText)
.withContext(`In ${browserName}`)
.toContain("Comment removed");
})
);
});
Expand Down
15 changes: 2 additions & 13 deletions test/integration/freetext_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import {
waitForSelectedEditor,
waitForSerialized,
waitForStorageEntries,
waitForTextToBe,
waitForTimeout,
waitForUnselectedEditor,
} from "./test_utils.mjs";
Expand Down Expand Up @@ -3470,19 +3471,7 @@ describe("FreeText Editor", () => {
await page.waitForSelector(`${editorSelector} button.deleteButton`);
await page.click(`${editorSelector} button.deleteButton`);
await waitForSerialized(page, 0);

await page.waitForFunction(() => {
const messageElement = document.querySelector(
"#editorUndoBarMessage"
);
return messageElement && messageElement.textContent.trim() !== "";
});
const message = await page.waitForSelector("#editorUndoBarMessage");
const messageText = await page.evaluate(
el => el.textContent,
message
);
expect(messageText).toContain("Text removed");
await waitForTextToBe(page, "#editorUndoBarMessage", "Text removed");
})
);
});
Expand Down
42 changes: 11 additions & 31 deletions test/integration/highlight_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import {
awaitPromise,
closePages,
FSI,
getAnnotationSelector,
getEditorSelector,
getFirstSerialized,
Expand All @@ -31,6 +32,7 @@ import {
kbSave,
kbUndo,
loadAndWait,
PDI,
scrollIntoView,
selectEditor,
selectEditors,
Expand All @@ -42,6 +44,7 @@ import {
waitForPointerUp,
waitForSelectedEditor,
waitForSerialized,
waitForTextToBe,
waitForTimeout,
} from "./test_utils.mjs";
import fs from "fs";
Expand Down Expand Up @@ -2401,20 +2404,11 @@ describe("Highlight Editor", () => {
await page.waitForSelector(`${editorSelector} button.deleteButton`);
await page.click(`${editorSelector} button.deleteButton`);
await waitForSerialized(page, 0);

await page.waitForFunction(() => {
const messageElement = document.querySelector(
"#editorUndoBarMessage"
);
return messageElement && messageElement.textContent.trim() !== "";
});

const message = await page.waitForSelector("#editorUndoBarMessage");
const messageText = await page.evaluate(
el => el.textContent,
message
await waitForTextToBe(
page,
"#editorUndoBarMessage",
"Highlight removed"
);
expect(messageText).toContain("Highlight removed");
})
);
});
Expand All @@ -2431,25 +2425,11 @@ describe("Highlight Editor", () => {
await page.waitForSelector(`${editorSelector} button.deleteButton`);
await page.click(`${editorSelector} button.deleteButton`);
await waitForSerialized(page, 0);

await page.waitForFunction(() => {
const messageElement = document.querySelector(
"#editorUndoBarMessage"
);
return messageElement && messageElement.textContent.trim() !== "";
});

const message = await page.waitForSelector("#editorUndoBarMessage");
const messageText = await page.evaluate(
el => el.textContent,
message
await waitForTextToBe(
page,
"#editorUndoBarMessage",
`${FSI}2${PDI} annotations removed`
);

// Cleans the message text by removing all non-ASCII characters.
// It eliminates any invisible characters such as directional marks
// that interfere with string comparisons
const cleanMessage = messageText.replaceAll(/\P{ASCII}/gu, "");
expect(cleanMessage).toContain(`2 annotations removed`);
})
);
});
Expand Down
17 changes: 5 additions & 12 deletions test/integration/ink_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
waitForSelectedEditor,
waitForSerialized,
waitForStorageEntries,
waitForTextToBe,
waitForTimeout,
} from "./test_utils.mjs";
import { AnnotationEditorType } from "../../src/shared/util.js";
Expand Down Expand Up @@ -889,19 +890,11 @@ describe("Ink Editor", () => {
await page.waitForSelector(`${editorSelector} button.deleteButton`);
await page.click(`${editorSelector} button.deleteButton`);
await waitForSerialized(page, 0);

await page.waitForFunction(() => {
const messageElement = document.querySelector(
"#editorUndoBarMessage"
);
return messageElement && messageElement.textContent.trim() !== "";
});
const message = await page.waitForSelector("#editorUndoBarMessage");
const messageText = await page.evaluate(
el => el.textContent,
message
await waitForTextToBe(
page,
"#editorUndoBarMessage",
"Drawing removed"
);
expect(messageText).toContain("Drawing removed");
})
);
});
Expand Down
12 changes: 2 additions & 10 deletions test/integration/stamp_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {
waitForPageRendered,
waitForSelectedEditor,
waitForSerialized,
waitForTextToBe,
waitForTimeout,
} from "./test_utils.mjs";
import fs from "fs";
Expand Down Expand Up @@ -1644,16 +1645,7 @@ describe("Stamp Editor", () => {
await page.waitForSelector(`${editorSelector} button.deleteButton`);
await page.click(`${editorSelector} button.deleteButton`);
await waitForSerialized(page, 0);

await page.waitForFunction(() => {
const messageElement = document.querySelector(
"#editorUndoBarMessage"
);
return messageElement && messageElement.textContent.trim() !== "";
});
const message = await page.waitForSelector("#editorUndoBarMessage");
const messageText = await page.evaluate(el => el.textContent, message);
expect(messageText).toContain("Image removed");
await waitForTextToBe(page, "#editorUndoBarMessage", "Image removed");
}
});

Expand Down