diff --git a/packages/@react-spectrum/ai/chromatic/Lightbox.stories.tsx b/packages/@react-spectrum/ai/chromatic/Lightbox.stories.tsx index 09cc4b793f8..3badc4574f5 100644 --- a/packages/@react-spectrum/ai/chromatic/Lightbox.stories.tsx +++ b/packages/@react-spectrum/ai/chromatic/Lightbox.stories.tsx @@ -11,7 +11,7 @@ */ import {Attachment, AttachmentList, AttachmentPreview} from '../src/AttachmentList'; -import {expect, userEvent, within} from 'storybook/test'; +import {expect, userEvent, waitFor, within} from 'storybook/test'; import {Image} from '@react-spectrum/s2/Image'; import { LightboxCarousel, @@ -86,7 +86,8 @@ export const Dialog: Story = { chromaticProvider: { colorSchemes: ['light'], locales: ['en-US'] - } + }, + chromatic: {delay: 300} }, render: () => ( @@ -107,7 +108,7 @@ export const Dialog: Story = { play: async ({canvasElement}) => { await userEvent.click(within(canvasElement).getByLabelText('Photo 2')); let dialog = await within(canvasElement.ownerDocument.body).findByRole('dialog'); - await expect(dialog).toBeVisible(); + await waitFor(() => expect(dialog).toBeVisible()); await within(dialog).findByRole('img', {name: 'Photo 2'}); } };