-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import Login from '@/pages/LogIn'; | ||
import { userEvent, within } from '@storybook/testing-library'; | ||
import { expect } from '@storybook/test'; | ||
|
||
const meta: Meta<typeof Login> = { | ||
title: 'Page/Login', | ||
component: Login, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Login>; | ||
|
||
export const Template: Story = { | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
|
||
const emailInput = canvas.getAllByRole('textbox')[0]; | ||
await userEvent.type(emailInput, '[email protected]', { delay: 100 }); | ||
|
||
const passwordInput = canvas.getByPlaceholderText('비밀번호'); | ||
await userEvent.type(passwordInput, 'test1234', { delay: 100 }); | ||
|
||
const loginButton = canvas.getByRole('button', { name: '로그인' }); | ||
await expect(loginButton).toBeEnabled(); | ||
|
||
const signUpButton = canvas.getByRole('button', { name: '회원가입' }); | ||
await expect(signUpButton).toBeInTheDocument(); | ||
}, | ||
}; |