Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pages/copy-to-clipboard/motion.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export default function CopyToClipboardMotionPage() {
Copy fails
</Toggle>
}
screenshotArea={{}}
// Extra space so the popovers around the first triggers are inside the screenshot area.
screenshotArea={{ style: { paddingBlockStart: 60, paddingInlineStart: 60 } }}
>
<SpaceBetween size="m">
<CopyToClipboard
Expand Down
32 changes: 31 additions & 1 deletion test/definitions/visual/copy-to-clipboard.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { TestSuite } from '../types';
import { TestDefinition, TestSuite } from '../types';

const motionPath = 'copy-to-clipboard/motion';
const triggerSelector = (testId: string) => `[data-testid="${testId}"] button`;

const suite: TestSuite = {
description: 'CopyToClipboard',
Expand All @@ -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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a follow up: can we make the "disable motion" feature work properly so we don't need this timer? Currently, only sets some css timing to 0 globally, which does not actually disable all motion.

},
},
{
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[]
),
],
};

Expand Down
Loading