diff --git a/test/integration/highlight_editor_spec.mjs b/test/integration/highlight_editor_spec.mjs index e99db2c81..f71a3d2e0 100644 --- a/test/integration/highlight_editor_spec.mjs +++ b/test/integration/highlight_editor_spec.mjs @@ -55,11 +55,11 @@ describe("Highlight Editor", () => { describe("Editor must be removed without exception", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -101,11 +101,11 @@ describe("Highlight Editor", () => { describe("Editor must keep selected", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -145,7 +145,7 @@ describe("Highlight Editor", () => { describe("The default color must have the correct value", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "tracemonkey.pdf", ".annotationEditorLayer", @@ -155,7 +155,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -190,7 +190,7 @@ describe("Highlight Editor", () => { describe("Invisible editor must change its color", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "tracemonkey.pdf", ".annotationEditorLayer", @@ -200,7 +200,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -278,7 +278,7 @@ describe("Highlight Editor", () => { describe("Highlight data serialization", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "tracemonkey.pdf", ".annotationEditorLayer", @@ -288,7 +288,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -335,7 +335,7 @@ describe("Highlight Editor", () => { describe("Color picker and keyboard", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "tracemonkey.pdf", ".annotationEditorLayer", @@ -348,7 +348,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -449,7 +449,7 @@ describe("Highlight Editor", () => { describe("Text highlights aren't draggable", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "tracemonkey.pdf", ".annotationEditorLayer", @@ -459,7 +459,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -502,11 +502,11 @@ describe("Highlight Editor", () => { describe("Color picker and click outside", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -543,11 +543,11 @@ describe("Highlight Editor", () => { describe("Color picker can annoy the user when selecting some text", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -580,7 +580,7 @@ describe("Highlight Editor", () => { describe("Free highlight thickness can be changed", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "empty.pdf", ".annotationEditorLayer", @@ -590,7 +590,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -660,11 +660,11 @@ describe("Highlight Editor", () => { describe("Highlight with the keyboard", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -723,7 +723,7 @@ describe("Highlight Editor", () => { describe("Free highlight is drawn at the right place after having been rotated (bug 1879108)", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "empty.pdf", ".annotationEditorLayer", @@ -733,7 +733,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -807,7 +807,7 @@ describe("Highlight Editor", () => { describe("Highlight links", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "bug1868759.pdf", ".annotationEditorLayer", @@ -817,7 +817,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -852,7 +852,7 @@ describe("Highlight Editor", () => { describe("Highlight forms", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "issue12233.pdf", ".annotationEditorLayer", @@ -862,7 +862,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -902,7 +902,7 @@ describe("Highlight Editor", () => { describe("Send a message when some text is selected", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "tracemonkey.pdf", `.page[data-page-number = "1"] .endOfContent`, @@ -919,7 +919,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -982,7 +982,7 @@ describe("Highlight Editor", () => { describe("Highlight and caret browsing", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "tracemonkey.pdf", ".annotationEditorLayer", @@ -1002,16 +1002,6 @@ describe("Highlight Editor", () => { }); afterEach(async () => { - for (const [, page] of pages) { - await page.evaluate(() => { - window.uiManager.reset(); - }); - // Disable editing mode. - await switchToHighlight(page, /* disable */ true); - } - }); - - afterAll(async () => { await closePages(pages); }); @@ -1154,11 +1144,11 @@ describe("Highlight Editor", () => { describe("Editor must be removed in using the space key on the delete button", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1189,11 +1179,11 @@ describe("Highlight Editor", () => { describe("Thickness must be enabled when there's no selected highlights", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1244,11 +1234,11 @@ describe("Highlight Editor", () => { describe("Quadpoints must be correct", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1280,11 +1270,11 @@ describe("Highlight Editor", () => { describe("Quadpoints must be correct when they're in a translated page", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("issue18360.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1316,11 +1306,11 @@ describe("Highlight Editor", () => { describe("Editor must be unselected when the color picker is Escaped", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1348,11 +1338,11 @@ describe("Highlight Editor", () => { describe("Highlight editor mustn't be moved when close to the page limits", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("empty.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1386,11 +1376,11 @@ describe("Highlight Editor", () => { describe("Show/hide all the highlights", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1455,7 +1445,7 @@ describe("Highlight Editor", () => { describe("Highlight from floating highlight button", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "tracemonkey.pdf", ".annotationEditorLayer", @@ -1465,7 +1455,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1507,11 +1497,11 @@ describe("Highlight Editor", () => { describe("Text layer must have the focus before highlights", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1550,11 +1540,11 @@ describe("Highlight Editor", () => { describe("Undo a highlight", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1587,7 +1577,7 @@ describe("Highlight Editor", () => { describe("Delete a highlight and undo it an other page", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "tracemonkey.pdf", ".annotationEditorLayer", @@ -1600,7 +1590,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1649,7 +1639,7 @@ describe("Highlight Editor", () => { describe("Delete a highlight, scroll and undo it", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "tracemonkey.pdf", ".annotationEditorLayer", @@ -1662,7 +1652,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1706,7 +1696,7 @@ describe("Highlight Editor", () => { describe("Use a toolbar overlapping an other highlight", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "tracemonkey.pdf", ".annotationEditorLayer", @@ -1719,7 +1709,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1783,11 +1773,11 @@ describe("Highlight Editor", () => { describe("Draw a free highlight with the pointer hovering an existing highlight", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1849,11 +1839,11 @@ describe("Highlight Editor", () => { describe("Select text with the pointer hovering an existing highlight", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("tracemonkey.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1919,7 +1909,7 @@ describe("Highlight Editor", () => { describe("Highlight with the floating button in a pdf containing a FreeText", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "file_pdfjs_test.pdf", ".annotationEditorLayer", @@ -1929,7 +1919,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -1961,7 +1951,7 @@ describe("Highlight Editor", () => { describe("Highlight (edit existing in double clicking on it)", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "highlights.pdf", ".annotationEditorLayer", @@ -1974,7 +1964,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -2008,14 +1998,14 @@ describe("Highlight Editor", () => { describe("Highlight (delete an existing annotation)", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "highlight_popup.pdf", ".annotationEditorLayer" ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -2052,7 +2042,7 @@ describe("Highlight Editor", () => { describe("Free Highlight (edit existing in double clicking on it)", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "highlights.pdf", ".annotationEditorLayer", @@ -2065,7 +2055,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -2101,14 +2091,14 @@ describe("Highlight Editor", () => { describe("Highlight editor mustn't throw when disabled", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "annotation-highlight.pdf", ".annotationEditorLayer" ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -2134,7 +2124,7 @@ describe("Highlight Editor", () => { describe("Free Highlight with an image in the struct tree", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait( "bug1708040.pdf", ".annotationEditorLayer", @@ -2144,7 +2134,7 @@ describe("Highlight Editor", () => { ); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -2623,11 +2613,11 @@ describe("Highlight Editor", () => { describe("Highlight mustn't trigger a scroll when edited", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("issue18911.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); }); @@ -2678,11 +2668,11 @@ describe("Highlight Editor", () => { describe("Highlight must be rotated when existing in the pdf", () => { let pages; - beforeAll(async () => { + beforeEach(async () => { pages = await loadAndWait("issue19424.pdf", ".annotationEditorLayer"); }); - afterAll(async () => { + afterEach(async () => { await closePages(pages); });