Merge pull request #19949 from timvandermeij/intermittent-stamp-undo

Fix intermittent failure in the stamp editor's undo-related integration tests
This commit is contained in:
Tim van der Meij 2025-05-18 15:17:41 +02:00 committed by GitHub
commit 819671d42f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -631,6 +631,7 @@ describe("Stamp Editor", () => {
}); });
it("must check that the alt-text button is here when pasting in the second tab", async () => { it("must check that the alt-text button is here when pasting in the second tab", async () => {
// Run sequentially to avoid clipboard issues.
for (let i = 0; i < pages1.length; i++) { for (let i = 0; i < pages1.length; i++) {
const [, page1] = pages1[i]; const [, page1] = pages1[i];
await page1.bringToFront(); await page1.bringToFront();
@ -1592,8 +1593,8 @@ describe("Stamp Editor", () => {
}); });
it("must check that deleting an image can be undone using the undo button", async () => { it("must check that deleting an image can be undone using the undo button", async () => {
await Promise.all( // Run sequentially to avoid clipboard issues.
pages.map(async ([browserName, page]) => { for (const [, page] of pages) {
await switchToStamp(page); await switchToStamp(page);
const editorSelector = getEditorSelector(0); const editorSelector = getEditorSelector(0);
@ -1613,13 +1614,12 @@ describe("Stamp Editor", () => {
await waitForSerialized(page, 1); await waitForSerialized(page, 1);
await page.waitForSelector(editorSelector); await page.waitForSelector(editorSelector);
await page.waitForSelector(`${editorSelector} canvas`); await page.waitForSelector(`${editorSelector} canvas`);
}) }
);
}); });
it("must check that the undo deletion popup displays the correct message", async () => { it("must check that the undo deletion popup displays the correct message", async () => {
await Promise.all( // Run sequentially to avoid clipboard issues.
pages.map(async ([browserName, page]) => { for (const [, page] of pages) {
await switchToStamp(page); await switchToStamp(page);
const editorSelector = getEditorSelector(0); const editorSelector = getEditorSelector(0);
@ -1638,18 +1638,14 @@ describe("Stamp Editor", () => {
return messageElement && messageElement.textContent.trim() !== ""; return messageElement && messageElement.textContent.trim() !== "";
}); });
const message = await page.waitForSelector("#editorUndoBarMessage"); const message = await page.waitForSelector("#editorUndoBarMessage");
const messageText = await page.evaluate( const messageText = await page.evaluate(el => el.textContent, message);
el => el.textContent,
message
);
expect(messageText).toContain("Image removed"); expect(messageText).toContain("Image removed");
}) }
);
}); });
it("must check that the popup disappears when a new image is inserted", async () => { it("must check that the popup disappears when a new image is inserted", async () => {
await Promise.all( // Run sequentially to avoid clipboard issues.
pages.map(async ([browserName, page]) => { for (const [, page] of pages) {
await switchToStamp(page); await switchToStamp(page);
const editorSelector = getEditorSelector(0); const editorSelector = getEditorSelector(0);
@ -1670,8 +1666,7 @@ describe("Stamp Editor", () => {
await waitForImage(page, getEditorSelector(1)); await waitForImage(page, getEditorSelector(1));
await waitForSerialized(page, 1); await waitForSerialized(page, 1);
await page.waitForSelector("#editorUndoBar", { hidden: true }); await page.waitForSelector("#editorUndoBar", { hidden: true });
}) }
);
}); });
}); });