Manuel Bustillo
a623c6733b
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m31s
Add copyright notice / copyright_notice (pull_request) Successful in 1m48s
Playwright Tests / test (pull_request) Successful in 3m39s
Build Nginx-based docker image / build-static-assets (pull_request) Successful in 6m35s
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/react';
|
|
import { expect, userEvent, within } from '@storybook/test';
|
|
|
|
import { Page } from './Page';
|
|
|
|
const meta = {
|
|
title: 'Example/Page',
|
|
component: Page,
|
|
parameters: {
|
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
layout: 'fullscreen',
|
|
},
|
|
} satisfies Meta<typeof Page>;
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const LoggedOut: Story = {};
|
|
|
|
// More on interaction testing: https://storybook.js.org/docs/writing-tests/interaction-testing
|
|
export const LoggedIn: Story = {
|
|
play: async ({ canvasElement }) => {
|
|
const canvas = within(canvasElement);
|
|
const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
|
await expect(loginButton).toBeInTheDocument();
|
|
await userEvent.click(loginButton);
|
|
await expect(loginButton).not.toBeInTheDocument();
|
|
|
|
const logoutButton = canvas.getByRole('button', { name: /Log out/i });
|
|
await expect(logoutButton).toBeInTheDocument();
|
|
},
|
|
};
|