-
Notifications
You must be signed in to change notification settings - Fork 0
Feature: E2E 테스트 #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Feature: E2E 테스트 #154
Changes from all commits
781231a
34f0089
8e8e104
30182b7
dc31555
cd006bd
118a1a4
1795d6a
9e12cc8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Playwright Tests | ||
on: | ||
workflow_run: | ||
workflows: | ||
- CICD Web | ||
types: | ||
- completed | ||
|
||
|
||
jobs: | ||
test: | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
env: | ||
WEB_URL: ${{ github.event.workflow_run.outputs.deployment_url }} | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: pnpm | ||
- name: pnpm install | ||
run: pnpm install --frozen-lockfile --prefer-offline | ||
|
||
- name: setting environment variables | ||
run: | | ||
echo "${{ secrets.SHARED_ENV_FILE }}" >> packages/shared/.env | ||
echo WEB_URL=${{ env.WEB_URL }} >> packages/shared/.env | ||
|
||
echo "${{ secrets.WEB_ENV_FILE }}" > packages/web/.env | ||
echo NEXT_PUBLIC_WEB_URL=${{ env.WEB_URL }} >> packages/web/.env | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: | | ||
turbo telemetry disable | ||
pnpm run test | ||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ name: CICD Extension | |
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
build-extension: | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,9 +1,10 @@ | ||||||||||||||||||||||||||||||||||||||
'use server'; | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
import { SUPABASE } from '@extension/shared/constants'; | ||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 테스트 계정 정보의 보안 처리가 필요합니다
Also applies to: 7-7 |
||||||||||||||||||||||||||||||||||||||
import { Button } from '@src/components/ui'; | ||||||||||||||||||||||||||||||||||||||
import type { LanguageType } from '@src/modules/i18n'; | ||||||||||||||||||||||||||||||||||||||
import useTranslation from '@src/modules/i18n/util.server'; | ||||||||||||||||||||||||||||||||||||||
import { signInWithOAuth } from '@src/modules/supabase/util.server'; | ||||||||||||||||||||||||||||||||||||||
import { signInWithEmail, signInWithOAuth } from '@src/modules/supabase/util.server'; | ||||||||||||||||||||||||||||||||||||||
import Image from 'next/image'; | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
interface LoginSectionProps extends LanguageType {} | ||||||||||||||||||||||||||||||||||||||
|
@@ -19,21 +20,26 @@ export default async function LoginSection({ lng }: LoginSectionProps) { | |||||||||||||||||||||||||||||||||||||
<form className="flex w-full flex-col gap-4 px-4"> | ||||||||||||||||||||||||||||||||||||||
{/* 'use server' 함수를 사용하기 위해 bind 사용 */} | ||||||||||||||||||||||||||||||||||||||
<Button | ||||||||||||||||||||||||||||||||||||||
data-testid="kakao-login-button" | ||||||||||||||||||||||||||||||||||||||
formAction={signInWithOAuth.bind(null, 'kakao')} | ||||||||||||||||||||||||||||||||||||||
className="h-12 bg-[rgb(247,228,76)] text-black hover:bg-[rgb(247,228,76)]"> | ||||||||||||||||||||||||||||||||||||||
<Image src="/images/svgs/kakao.svg" width={16} height={16} alt="kakao" /> | ||||||||||||||||||||||||||||||||||||||
{t('login.kakaoLogin')} | ||||||||||||||||||||||||||||||||||||||
</Button> | ||||||||||||||||||||||||||||||||||||||
{/* 'use server' 함수를 사용하기 위해 bind 사용 */} | ||||||||||||||||||||||||||||||||||||||
<Button formAction={signInWithOAuth.bind(null, 'google')} className="h-12 bg-white text-black hover:bg-white"> | ||||||||||||||||||||||||||||||||||||||
<Button | ||||||||||||||||||||||||||||||||||||||
data-testid="google-login-button" | ||||||||||||||||||||||||||||||||||||||
formAction={signInWithOAuth.bind(null, 'google')} | ||||||||||||||||||||||||||||||||||||||
className="h-12 bg-white text-black hover:bg-white"> | ||||||||||||||||||||||||||||||||||||||
<Image src="/images/svgs/google.svg" width={16} height={16} alt="google" /> | ||||||||||||||||||||||||||||||||||||||
{t('login.googleLogin')} | ||||||||||||||||||||||||||||||||||||||
</Button> | ||||||||||||||||||||||||||||||||||||||
{/* <Button | ||||||||||||||||||||||||||||||||||||||
<Button | ||||||||||||||||||||||||||||||||||||||
data-testid="test-login-button" | ||||||||||||||||||||||||||||||||||||||
formAction={signInWithEmail.bind(null, SUPABASE.testEmail, SUPABASE.testPassword)} | ||||||||||||||||||||||||||||||||||||||
className="h-12 bg-green-300 text-black hover:bg-green-300"> | ||||||||||||||||||||||||||||||||||||||
테스트 계정으로 로그인 | ||||||||||||||||||||||||||||||||||||||
</Button> */} | ||||||||||||||||||||||||||||||||||||||
{t('login.testLogin')} | ||||||||||||||||||||||||||||||||||||||
</Button> | ||||||||||||||||||||||||||||||||||||||
Comment on lines
+37
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 테스트 계정 로그인 버튼의 환경별 표시 여부 제어가 필요합니다 테스트 계정 로그인 버튼은 개발 환경에서만 표시되어야 합니다. 다음과 같은 조건부 렌더링을 추가하는 것이 좋습니다: +const isDevelopment = process.env.NODE_ENV === 'development';
// ...
+{isDevelopment && (
<Button
data-testid="test-login-button"
formAction={signInWithEmail.bind(null, SUPABASE.testEmail, SUPABASE.testPassword)}
className="h-12 bg-green-300 text-black hover:bg-green-300">
{t('login.testLogin')}
</Button>
+)} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||
</form> | ||||||||||||||||||||||||||||||||||||||
</section> | ||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import { expect, test } from './fixtures'; | ||
|
||
test.describe('Login Page', () => { | ||
test.describe('Memo Page', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('http://localhost:3000'); | ||
await page.getByRole('button', { name: '테스트 계정으로 로그인' }).click(); | ||
await page.getByTestId('test-login-button').click(); | ||
await page.waitForURL(/.*memos/); | ||
}); | ||
|
||
test.describe('가이드 기능', () => { | ||
test('메모 페이지 최초 접속시, 가이드를 볼 수 있다.', async ({ page }) => { | ||
expect(page.locator('#driver-popover-description')).toHaveText( | ||
'메모를 한 번 해볼까요?\nOption + S를 눌러 사이드 패널을 열어보세요 !', | ||
"Ready to start? Press 'Option + S' to open the side panel", | ||
); | ||
Comment on lines
+13
to
14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 가이드 텍스트의 국제화 처리가 필요합니다 하드코딩된 영어 텍스트를 i18n 시스템을 통해 관리하는 것이 좋습니다. 이는 다국어 지원을 용이하게 만들 것입니다. |
||
}); | ||
|
||
test('사이드 패널을 열 시, 다음 가이드 페이지로 이동한다.', async ({ page, baseURL }) => { | ||
await page.goto('https://blog.toss.im/article/toss-team-culture'); | ||
await page.locator('#open-side-panel').click(); | ||
|
@@ -21,9 +22,10 @@ test.describe('Login Page', () => { | |
await page.waitForTimeout(1000); | ||
|
||
expect(page.locator('#driver-popover-description')).toContainText( | ||
'이제 이 사이드 패널에서 메모를 기록하실 수 있답니다.', | ||
"Great job!\nNow you can write memos in the side panel.\nDon't worry, memos are saved automatically", | ||
); | ||
}); | ||
|
||
test('새로고침 버튼을 누르면, 가이드가 종료된다.', async ({ page }) => { | ||
await page.locator('.driver-popover-next-btn').click(); | ||
await page.locator('.driver-popover-next-btn').click(); | ||
|
@@ -43,7 +45,7 @@ test.describe('Login Page', () => { | |
test('사이드 패널에서 메모를 저장하면 메모를 확인할 수 있다.', async ({ page, sidePanelPage }) => { | ||
const text = String(new Date()); | ||
await sidePanelPage.locator('#memo-textarea').fill(text); | ||
await sidePanelPage.locator('#memo-textarea').press('ControlOrMeta+s'); | ||
await sidePanelPage.waitForTimeout(500); | ||
|
||
await page.reload(); | ||
expect(page.getByText(text)).toBeVisible(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
환경 변수 파일 생성 방식 개선 필요
환경 변수를 파일에 직접 추가하는 방식은 보안상 위험할 수 있습니다. GitHub Actions의
secrets
기능을 더 안전하게 활용하는 방법을 고려해보세요.📝 Committable suggestion