From aef7a6b0384b175edcbff164037344d2bcf57b5c Mon Sep 17 00:00:00 2001 From: Yu Yu Date: Wed, 21 Oct 2026 11:08:00 +0200 Subject: [PATCH 1/2] test: Add visual tests for the CopyToClipboard One Theme glyph swap --- pages/copy-to-clipboard/motion.page.tsx | 3 +- test/definitions/visual/copy-to-clipboard.ts | 32 +++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/pages/copy-to-clipboard/motion.page.tsx b/pages/copy-to-clipboard/motion.page.tsx index a4a1067752c..e0b14755e5d 100644 --- a/pages/copy-to-clipboard/motion.page.tsx +++ b/pages/copy-to-clipboard/motion.page.tsx @@ -37,7 +37,8 @@ export default function CopyToClipboardMotionPage() { Copy fails } - screenshotArea={{}} + // Extra space so the popover above the first trigger is inside the screenshot area. + screenshotArea={{ style: { paddingBlockStart: 60 } }} > `[data-testid="${testId}"] button`; const suite: TestSuite = { description: 'CopyToClipboard', @@ -21,6 +24,33 @@ const suite: TestSuite = { await page.scrollIntoView('[data-testid="scroll-me"]'); }, }, + // One Theme swaps the copy glyph for a status glyph after a copy; capture that end state while it is held. + ...['copy-button', 'copy-icon', 'copy-inline'].flatMap( + testId => + [ + { + description: `One Theme glyph swap - ${testId} after successful copy`, + path: motionPath, + screenshotType: 'screenshotArea', + queryParams: { theme: 'one-theme' }, + setup: async ({ page }) => { + await page.click(triggerSelector(testId)); + // Wait out the popover's settle animation so it is captured at rest. + await page.waitForJsTimers(300); + }, + }, + { + description: `One Theme glyph swap - ${testId} after failed copy`, + path: motionPath, + screenshotType: 'screenshotArea', + queryParams: { theme: 'one-theme', copyFails: 'true' }, + setup: async ({ page }) => { + await page.click(triggerSelector(testId)); + await page.waitForJsTimers(300); + }, + }, + ] as TestDefinition[] + ), ], }; From ae6df9f725401da8f12fe9599da11af84800e96e Mon Sep 17 00:00:00 2001 From: Yu Yu Date: Wed, 28 Oct 2026 13:41:11 +0100 Subject: [PATCH 2/2] test: Pad the motion page on the left so popovers are fully captured --- pages/copy-to-clipboard/motion.page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/copy-to-clipboard/motion.page.tsx b/pages/copy-to-clipboard/motion.page.tsx index e0b14755e5d..5285248e060 100644 --- a/pages/copy-to-clipboard/motion.page.tsx +++ b/pages/copy-to-clipboard/motion.page.tsx @@ -37,8 +37,8 @@ export default function CopyToClipboardMotionPage() { Copy fails } - // Extra space so the popover above the first trigger is inside the screenshot area. - screenshotArea={{ style: { paddingBlockStart: 60 } }} + // Extra space so the popovers around the first triggers are inside the screenshot area. + screenshotArea={{ style: { paddingBlockStart: 60, paddingInlineStart: 60 } }} >