From 1993127e874f3942ff1430698e1b0da7476c87a8 Mon Sep 17 00:00:00 2001 From: EunJu JO Date: Thu, 16 May 2024 16:31:43 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=9D=B8=ED=84=B0=EB=A0=89=EC=85=98=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stories/LoginPage/LoginPage.stories.tsx | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/stories/LoginPage/LoginPage.stories.tsx diff --git a/src/stories/LoginPage/LoginPage.stories.tsx b/src/stories/LoginPage/LoginPage.stories.tsx new file mode 100644 index 00000000..dc5ad66e --- /dev/null +++ b/src/stories/LoginPage/LoginPage.stories.tsx @@ -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 = { + title: 'Page/Login', + component: Login, + tags: ['autodocs'], +}; + +export default meta; + +type Story = StoryObj; + +export const Template: Story = { + play: async ({ canvasElement }) => { + const canvas = within(canvasElement); + + const emailInput = canvas.getAllByRole('textbox')[0]; + await userEvent.type(emailInput, 'test@test.com', { 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(); + }, +};