Isolate the freetext editor integration tests

To avoid being able to introduce dependencies between tests this commit
makes sure that we close the document between tests so that we can't
accidentally rely on state set by a previous test.
This commit is contained in:
Tim van der Meij 2025-04-13 14:14:50 +02:00
parent f043760b54
commit 5011d96a62
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -431,11 +431,11 @@ describe("FreeText Editor", () => {
describe("FreeText (multiselection)", () => { describe("FreeText (multiselection)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("aboutstacks.pdf", ".annotationEditorLayer"); pages = await loadAndWait("aboutstacks.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -588,11 +588,11 @@ describe("FreeText Editor", () => {
describe("FreeText (bugs)", () => { describe("FreeText (bugs)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -726,7 +726,7 @@ describe("FreeText Editor", () => {
describe("issue 15789", () => { describe("issue 15789", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("issue15789.pdf", ".annotationEditorLayer"); pages = await loadAndWait("issue15789.pdf", ".annotationEditorLayer");
pages = await Promise.all( pages = await Promise.all(
pages.map(async ([browserName, page]) => { pages.map(async ([browserName, page]) => {
@ -736,7 +736,7 @@ describe("FreeText Editor", () => {
); );
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -817,11 +817,11 @@ describe("FreeText Editor", () => {
describe("FreeText (move existing)", () => { describe("FreeText (move existing)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("freetexts.pdf", ".annotationEditorLayer"); pages = await loadAndWait("freetexts.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -852,11 +852,11 @@ describe("FreeText Editor", () => {
describe("FreeText (update existing)", () => { describe("FreeText (update existing)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("freetexts.pdf", ".annotationEditorLayer"); pages = await loadAndWait("freetexts.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -949,11 +949,11 @@ describe("FreeText Editor", () => {
describe("FreeText (update existing and popups)", () => { describe("FreeText (update existing and popups)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("freetexts.pdf", "[data-annotation-id='32R']"); pages = await loadAndWait("freetexts.pdf", "[data-annotation-id='32R']");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1004,11 +1004,11 @@ describe("FreeText Editor", () => {
describe("FreeText (update existing but not empty ones)", () => { describe("FreeText (update existing but not empty ones)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("issue14438.pdf", ".annotationEditorLayer"); pages = await loadAndWait("issue14438.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1027,11 +1027,11 @@ describe("FreeText Editor", () => {
describe("FreeText (delete existing)", () => { describe("FreeText (delete existing)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("freetexts.pdf", ".annotationEditorLayer"); pages = await loadAndWait("freetexts.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1088,11 +1088,11 @@ describe("FreeText Editor", () => {
describe("FreeText (copy/paste existing)", () => { describe("FreeText (copy/paste existing)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("freetexts.pdf", ".annotationEditorLayer"); pages = await loadAndWait("freetexts.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1116,11 +1116,11 @@ describe("FreeText Editor", () => {
describe("FreeText (edit existing in double clicking on it)", () => { describe("FreeText (edit existing in double clicking on it)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("freetexts.pdf", ".annotationEditorLayer"); pages = await loadAndWait("freetexts.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1151,14 +1151,14 @@ describe("FreeText Editor", () => {
describe("FreeText with popup", () => { describe("FreeText with popup", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait( pages = await loadAndWait(
"annotation-freetext.pdf", "annotation-freetext.pdf",
".annotationEditorLayer" ".annotationEditorLayer"
); );
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1233,11 +1233,11 @@ describe("FreeText Editor", () => {
describe("FreeText rotation", () => { describe("FreeText rotation", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1333,11 +1333,11 @@ describe("FreeText Editor", () => {
describe("FreeText (remove)", () => { describe("FreeText (remove)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1397,11 +1397,11 @@ describe("FreeText Editor", () => {
describe("FreeText (open existing)", () => { describe("FreeText (open existing)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("issue16633.pdf", ".annotationEditorLayer"); pages = await loadAndWait("issue16633.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1522,7 +1522,7 @@ describe("FreeText Editor", () => {
describe("FreeText (open existing and rotated)", () => { describe("FreeText (open existing and rotated)", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait( pages = await loadAndWait(
"rotated_freetexts.pdf", "rotated_freetexts.pdf",
".annotationEditorLayer", ".annotationEditorLayer",
@ -1530,7 +1530,7 @@ describe("FreeText Editor", () => {
); );
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1690,11 +1690,11 @@ describe("FreeText Editor", () => {
describe("Keyboard shortcuts when the editor layer isn't focused", () => { describe("Keyboard shortcuts when the editor layer isn't focused", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1897,7 +1897,7 @@ describe("FreeText Editor", () => {
describe("Focus must go on the current page", () => { describe("Focus must go on the current page", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait( pages = await loadAndWait(
"tracemonkey.pdf", "tracemonkey.pdf",
".annotationEditorLayer", ".annotationEditorLayer",
@ -1913,7 +1913,7 @@ describe("FreeText Editor", () => {
); );
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -1962,11 +1962,11 @@ describe("FreeText Editor", () => {
describe("Freetext must stay focused after having been moved", () => { describe("Freetext must stay focused after having been moved", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2037,11 +2037,11 @@ describe("FreeText Editor", () => {
describe("Move several FreeTexts", () => { describe("Move several FreeTexts", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2089,7 +2089,7 @@ describe("FreeText Editor", () => {
describe("Don't unselect all when scrolling", () => { describe("Don't unselect all when scrolling", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait( pages = await loadAndWait(
"tracemonkey.pdf", "tracemonkey.pdf",
".annotationEditorLayer", ".annotationEditorLayer",
@ -2104,7 +2104,7 @@ describe("FreeText Editor", () => {
); );
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2152,11 +2152,11 @@ describe("FreeText Editor", () => {
describe("FreeText on several pages", () => { describe("FreeText on several pages", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2221,11 +2221,11 @@ describe("FreeText Editor", () => {
describe("Deleted FreeText", () => { describe("Deleted FreeText", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2280,11 +2280,11 @@ describe("FreeText Editor", () => {
describe("FreeText accessibility", () => { describe("FreeText accessibility", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("bug1823296.pdf", ".annotationEditorLayer"); pages = await loadAndWait("bug1823296.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2327,11 +2327,11 @@ describe("FreeText Editor", () => {
describe("Bug 1854818: mouse events in a selected FreeText editor", () => { describe("Bug 1854818: mouse events in a selected FreeText editor", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2474,11 +2474,11 @@ describe("FreeText Editor", () => {
describe("Avoid to steal keyboard events", () => { describe("Avoid to steal keyboard events", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2528,11 +2528,11 @@ describe("FreeText Editor", () => {
describe("Delete a freetext in using the delete button", () => { describe("Delete a freetext in using the delete button", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2571,11 +2571,11 @@ describe("FreeText Editor", () => {
describe("Delete two freetexts in using the delete button and the keyboard", () => { describe("Delete two freetexts in using the delete button and the keyboard", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2625,11 +2625,11 @@ describe("FreeText Editor", () => {
describe("Consecutive white spaces in Freetext without appearance", () => { describe("Consecutive white spaces in Freetext without appearance", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("bug1871353.pdf", ".annotationEditorLayer"); pages = await loadAndWait("bug1871353.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2656,11 +2656,11 @@ describe("FreeText Editor", () => {
describe("Consecutive white spaces in Freetext with appearance", () => { describe("Consecutive white spaces in Freetext with appearance", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("bug1871353.1.pdf", ".annotationEditorLayer"); pages = await loadAndWait("bug1871353.1.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2687,11 +2687,11 @@ describe("FreeText Editor", () => {
describe("Freetext with several lines", () => { describe("Freetext with several lines", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2721,11 +2721,11 @@ describe("FreeText Editor", () => {
describe("Freetext UI when undoing/redoing", () => { describe("Freetext UI when undoing/redoing", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2788,11 +2788,11 @@ describe("FreeText Editor", () => {
describe("Annotation editor layer visibility", () => { describe("Annotation editor layer visibility", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2822,11 +2822,11 @@ describe("FreeText Editor", () => {
describe("Delete a freetext and undo it on another page", () => { describe("Delete a freetext and undo it on another page", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2872,11 +2872,11 @@ describe("FreeText Editor", () => {
describe("Delete a freetext, scroll and undo it", () => { describe("Delete a freetext, scroll and undo it", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -2917,11 +2917,11 @@ describe("FreeText Editor", () => {
describe("Paste some html", () => { describe("Paste some html", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -3040,14 +3040,14 @@ describe("FreeText Editor", () => {
describe("Update a freetext and scroll", () => { describe("Update a freetext and scroll", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait( pages = await loadAndWait(
"tracemonkey_freetext.pdf", "tracemonkey_freetext.pdf",
".annotationEditorLayer" ".annotationEditorLayer"
); );
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });
@ -3170,11 +3170,11 @@ describe("FreeText Editor", () => {
describe("Freetext and shift+enter", () => { describe("Freetext and shift+enter", () => {
let pages; let pages;
beforeAll(async () => { beforeEach(async () => {
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
}); });
afterAll(async () => { afterEach(async () => {
await closePages(pages); await closePages(pages);
}); });