Skip to content

Commit 2a4f970

Browse files
committed
Fix the "Signature Editor Basic operations must check copy and paste" integration test
This integration test fails intermittently because of concurrent clipboard access due to running the test in parallel in both browsers. It can be reproduced by introducing `await waitForTimeout(1000)` between the copy and paste operations. This commit fixes the issue by running the test sequentially instead, mirroring the change from commit 0e94f2b.
1 parent e738566 commit 2a4f970

1 file changed

Lines changed: 38 additions & 39 deletions

File tree

test/integration/signature_editor_spec.mjs

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -339,45 +339,44 @@ describe("Signature Editor", () => {
339339
});
340340

341341
it("must check copy and paste", async () => {
342-
await Promise.all(
343-
pages.map(async ([browserName, page]) => {
344-
await switchToSignature(page);
345-
await page.click("#editorSignatureAddSignature");
346-
347-
await page.waitForSelector("#addSignatureDialog", {
348-
visible: true,
349-
});
350-
await page.type("#addSignatureTypeInput", "Hello");
351-
await page.waitForSelector(`${addButtonSelector}:not(:disabled)`);
352-
await page.click("#addSignatureAddButton");
353-
354-
const editorSelector = getEditorSelector(0);
355-
await page.waitForSelector(editorSelector, { visible: true });
356-
const originalRect = await getRect(page, editorSelector);
357-
const originalDescription = await page.$eval(
358-
`${editorSelector} .altText.editDescription`,
359-
el => el.title
360-
);
361-
362-
await copy(page);
363-
await paste(page);
364-
365-
const pastedEditorSelector = getEditorSelector(1);
366-
await page.waitForSelector(pastedEditorSelector, { visible: true });
367-
const pastedRect = await getRect(page, pastedEditorSelector);
368-
const pastedDescription = await page.$eval(
369-
`${pastedEditorSelector} .altText.editDescription`,
370-
el => el.title
371-
);
372-
373-
expect(pastedRect)
374-
.withContext(`In ${browserName}`)
375-
.not.toEqual(originalRect);
376-
expect(pastedDescription)
377-
.withContext(`In ${browserName}`)
378-
.toEqual(originalDescription);
379-
})
380-
);
342+
// Run sequentially to avoid clipboard issues.
343+
for (const [browserName, page] of pages) {
344+
await switchToSignature(page);
345+
await page.click("#editorSignatureAddSignature");
346+
347+
await page.waitForSelector("#addSignatureDialog", {
348+
visible: true,
349+
});
350+
await page.type("#addSignatureTypeInput", "Hello");
351+
await page.waitForSelector(`${addButtonSelector}:not(:disabled)`);
352+
await page.click("#addSignatureAddButton");
353+
354+
const editorSelector = getEditorSelector(0);
355+
await page.waitForSelector(editorSelector, { visible: true });
356+
const originalRect = await getRect(page, editorSelector);
357+
const originalDescription = await page.$eval(
358+
`${editorSelector} .altText.editDescription`,
359+
el => el.title
360+
);
361+
362+
await copy(page);
363+
await paste(page);
364+
365+
const pastedEditorSelector = getEditorSelector(1);
366+
await page.waitForSelector(pastedEditorSelector, { visible: true });
367+
const pastedRect = await getRect(page, pastedEditorSelector);
368+
const pastedDescription = await page.$eval(
369+
`${pastedEditorSelector} .altText.editDescription`,
370+
el => el.title
371+
);
372+
373+
expect(pastedRect)
374+
.withContext(`In ${browserName}`)
375+
.not.toEqual(originalRect);
376+
expect(pastedDescription)
377+
.withContext(`In ${browserName}`)
378+
.toEqual(originalDescription);
379+
}
381380
});
382381
});
383382

0 commit comments

Comments
 (0)