Skip to content

Commit

Permalink
test: 로그인 페이지 인터렉션 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
dmswn1004 committed May 16, 2024
1 parent f7d5b11 commit 1993127
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/stories/LoginPage/LoginPage.stories.tsx
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();
},
};

0 comments on commit 1993127

Please sign in to comment.