1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Simplify the integration test in adding a function to turn on/off an editing tool

This commit is contained in:
Calixte Denizet 2024-05-24 19:11:37 +02:00
parent 18a7bd60f7
commit b6b02ccff6
5 changed files with 86 additions and 138 deletions

View file

@ -30,6 +30,7 @@ import {
pasteFromClipboard,
scrollIntoView,
serializeBitmapDimensions,
switchToEditor,
waitForAnnotationEditorLayer,
waitForEntryInStorage,
waitForSelectedEditor,
@ -84,6 +85,8 @@ const copyImage = async (page, imagePath, number) => {
await waitForImage(page, getEditorSelector(number));
};
const switchToStamp = switchToEditor.bind(null, "Stamp");
describe("Stamp Editor", () => {
describe("Basic operations", () => {
let pages;
@ -104,7 +107,7 @@ describe("Stamp Editor", () => {
return;
}
await page.click("#editorStamp");
await switchToStamp(page);
await page.click("#editorStampAddImage");
const input = await page.$("#stampEditorFileInput");
@ -181,7 +184,7 @@ describe("Stamp Editor", () => {
return;
}
await page.click("#editorStamp");
await switchToStamp(page);
const names = ["bottomLeft", "bottomRight", "topRight", "topLeft"];
for (let i = 0; i < 4; i++) {
@ -256,7 +259,7 @@ describe("Stamp Editor", () => {
it("must check that the alt-text flow is correctly implemented", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.click("#editorStamp");
await switchToStamp(page);
await copyImage(page, "../images/firefox_logo.png", 0);
@ -425,7 +428,7 @@ describe("Stamp Editor", () => {
it("must check that the dimensions change", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.click("#editorStamp");
await switchToStamp(page);
await copyImage(page, "../images/firefox_logo.png", 0);
@ -593,8 +596,7 @@ describe("Stamp Editor", () => {
it("must check that a stamp can be undone", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.click("#editorStamp");
await page.waitForSelector(".annotationEditorLayer.stampEditing");
await switchToStamp(page);
await copyImage(page, "../images/firefox_logo.png", 0);
await page.waitForSelector(getEditorSelector(0));
@ -626,8 +628,7 @@ describe("Stamp Editor", () => {
it("must check that a stamp can be undone", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.click("#editorStamp");
await page.waitForSelector(".annotationEditorLayer.stampEditing");
await switchToStamp(page);
await copyImage(page, "../images/firefox_logo.png", 0);
await page.waitForSelector(getEditorSelector(0));
@ -672,8 +673,7 @@ describe("Stamp Editor", () => {
it("must check that a stamp can be undone", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.click("#editorStamp");
await page.waitForSelector(".annotationEditorLayer.stampEditing");
await switchToStamp(page);
await copyImage(page, "../images/firefox_logo.png", 0);
await page.waitForSelector(getEditorSelector(0));
@ -713,8 +713,7 @@ describe("Stamp Editor", () => {
it("must check that a resized stamp has its canvas at the right position", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.click("#editorStamp");
await page.waitForSelector(".annotationEditorLayer.stampEditing");
await switchToStamp(page);
await copyImage(page, "../images/firefox_logo.png", 0);
await page.waitForSelector(getEditorSelector(0));