Repository: mozilla/pdf.js
File: test/integration/signature_editor_spec.mjs (JavaScript)

Code before:
            page,
            ".canvasWrapper > svg use[href='#path_p1_0']"
          );

          expect(Math.abs(contentWidth / width - contentHeight / height))
            .withContext(
              `In ${browserName} (${contentWidth}x${contentHeight} vs ${width}x${height})`
            )
            .toBeLessThan(0.25);
        })
      );
    });
  });

  describe("Bug 1974257", () => {
    let pages;

    beforeEach(async () => {
      pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
    });

    afterEach(async () => {
      await closePages(pages);
    });

    it("must check that the error panel is correctly removed", async () => {
      await Promise.all(
        pages.map(async ([_, page]) => {
          await switchToSignature(page);

          for (let i = 0; i < 6; i++) {
            await page.click("#editorSignatureAddSignature");
            await page.waitForSelector("#addSignatureDialog", {
              visible: true,
            });
            await page.click("#addSignatureTypeInput");
            await page.type("#addSignatureTypeInput", `PDF.js ${i}`);
            if (i === 5) {
              await page.waitForSelector(
                "#addSignatureSaveCheckbox:not(checked)"
              );
              await page.waitForSelector("#addSignatureSaveCheckbox:disabled");
            } else {
              await page.waitForSelector("#addSignatureSaveCheckbox:checked");
              await page.waitForSelector(
                "#addSignatureSaveCheckbox:not(:disabled)"
              );
            }
            await page.click("#addSignatureAddButton");
            await page.waitForSelector("#addSignatureDialog", {
              visible: false,

Review comment (suggestion):
It looks like this is copy/pasted from another test. My suggestion would be to use `must check that the signature save checkbox is disabled if storage is full`.

Code after:
            page,
            ".canvasWrapper > svg use[href='#path_p1_0']"
          );

          expect(Math.abs(contentWidth / width - contentHeight / height))
            .withContext(
              `In ${browserName} (${contentWidth}x${contentHeight} vs ${width}x${height})`
            )
            .toBeLessThan(0.25);
        })
      );
    });
  });

  describe("Bug 1974257", () => {
    let pages;

    beforeEach(async () => {
      pages = await loadAndWait("empty.pdf", ".annotationEditorLayer");
    });

    afterEach(async () => {
      await closePages(pages);
    });

    it("must check that the signature save checkbox is disabled if storage is full", async () => {
      await Promise.all(
        pages.map(async ([_, page]) => {
          await switchToSignature(page);

          for (let i = 0; i < 6; i++) {
            await page.click("#editorSignatureAddSignature");
            await page.waitForSelector("#addSignatureDialog", {
              visible: true,
            });
            await page.click("#addSignatureTypeInput");
            await page.type("#addSignatureTypeInput", `PDF.js ${i}`);
            if (i === 5) {
              await page.waitForSelector(
                "#addSignatureSaveCheckbox:not(checked)"
              );
              await page.waitForSelector("#addSignatureSaveCheckbox:disabled");
            } else {
              await page.waitForSelector("#addSignatureSaveCheckbox:checked");
              await page.waitForSelector(
                "#addSignatureSaveCheckbox:not(:disabled)"
              );
            }
            await page.click("#addSignatureAddButton");
            await page.waitForSelector("#addSignatureDialog", {
              visible: false,