feat(client): add cookie-backed authentication UI
- Add session-aware login, logout and protected navigation. - Send cookie credentials for API and run-event requests with localized UI stories.
This commit is contained in:
1 parent
9e4b692444
commit
92141a25fb
26 files changed
+1191
-12
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import '../../src/i18n';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
import { expect, fn, userEvent, within } from 'storybook/test';
|
||||
import { SignOutControl } from '../../src/pages/auth/SignOutControl';
|
||||
|
||||
const meta: Meta<typeof SignOutControl> = {
|
||||
title: 'Authentication/Sign out',
|
||||
component: SignOutControl,
|
||||
parameters: { layout: 'centered' },
|
||||
tags: ['autodocs'],
|
||||
args: { onSignOut: fn() },
|
||||
};
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof SignOutControl>;
|
||||
|
||||
export const Ready: Story = {};
|
||||
|
||||
export const Pending: Story = {
|
||||
args: { pending: true },
|
||||
play: async ({ canvasElement }) => {
|
||||
const button = within(canvasElement).getByRole('button', { name: 'Signing out…' });
|
||||
await expect(button).toBeDisabled();
|
||||
},
|
||||
};
|
||||
|
||||
export const FailureAndRetry: Story = {
|
||||
args: { failed: true },
|
||||
play: async ({ canvasElement, args }) => {
|
||||
const canvas = within(canvasElement);
|
||||
await expect(canvas.getByRole('alert')).toHaveTextContent("Couldn't sign out. Try again.");
|
||||
await userEvent.click(canvas.getByRole('button', { name: 'Retry' }));
|
||||
await expect(args.onSignOut).toHaveBeenCalledTimes(1);
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user