import type { Meta, StoryObj } from '@storybook/angular'; import { moduleMetadata } from '@storybook/angular'; import { within, userEvent } from '@storybook/testing-library'; import { CommonModule } from '@angular/common'; import Button from './button.component'; import Header from './header.component'; import Page from './page.component'; const meta: Meta = { title: 'Example/Page', component: Page, parameters: { // More on StoryFn layout: https://storybook.js.org/docs/angular/configure/story-layout layout: 'fullscreen', }, decorators: [ moduleMetadata({ declarations: [Button, Header], imports: [CommonModule], }), ], }; export default meta; type Story = StoryObj; export const LoggedOut: Story = { render: (args: Page) => ({ props: args, }), }; // More on interaction testing: https://storybook.js.org/docs/angular/writing-tests/interaction-testing export const LoggedIn: Story = { render: (args: Page) => ({ props: args, }), play: async ({ canvasElement }) => { const canvas = within(canvasElement); const loginButton = await canvas.getByRole('button', { name: /Log in/i, }); await userEvent.click(loginButton); }, };