import '../../src/i18n'; import type { Meta, StoryObj } from '@storybook/react-vite'; import { expect, fn, userEvent, within } from 'storybook/test'; import { AuthStatusPage } from '../../src/pages/auth/AuthStatusPage'; const meta: Meta = { title: 'Authentication/Session status', component: AuthStatusPage, parameters: { layout: 'fullscreen' }, tags: ['autodocs'], args: { onRetry: fn() }, }; export default meta; type Story = StoryObj; export const Checking: Story = {}; export const SessionCheckFailure: Story = { args: { failed: true }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement); await expect(canvas.getByRole('alert')).toHaveTextContent( "Couldn't check your session. Try again.", ); await userEvent.click(canvas.getByRole('button', { name: 'Retry' })); await expect(args.onRetry).toHaveBeenCalledTimes(1); }, };