mirror of
https://github.com/IT4Change/boilerplate-frontend.git
synced 2025-12-13 07:35:53 +00:00
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
import { within, userEvent } from '@storybook/testing-library'
|
|
import ExamplePage from './ExamplePage.vue'
|
|
|
|
const meta = {
|
|
title: 'Example/Page',
|
|
component: ExamplePage,
|
|
render: () => ({
|
|
components: { ExamplePage },
|
|
template: '<example-page />',
|
|
}),
|
|
parameters: {
|
|
// More on how to position stories at: https://storybook.js.org/docs/vue/configure/story-layout
|
|
layout: 'fullscreen',
|
|
},
|
|
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs
|
|
tags: ['autodocs'],
|
|
} satisfies Meta<typeof ExamplePage>
|
|
|
|
export default meta
|
|
type Story = StoryObj<typeof meta>
|
|
|
|
// More on interaction testing: https://storybook.js.org/docs/vue/writing-tests/interaction-testing
|
|
export const LoggedIn: Story = {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
play: async ({ canvasElement }: any) => {
|
|
const canvas = within(canvasElement)
|
|
const loginButton = await canvas.getByRole('button', {
|
|
name: /Log in/i,
|
|
})
|
|
await userEvent.click(loginButton)
|
|
},
|
|
}
|
|
|
|
export const LoggedOut: Story = {}
|