Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
51bc908
refactor: prop앞에 $추가
seongwon030 Jan 31, 2026
4dcf2b8
fix: styled-components 커스텀 prop에 $ 접두사 적용 (DOM 경고 방지)
seongwon030 Feb 1, 2026
39657ad
chore: e2e 테스트 스크립트/Playwright 추가 및 MSW 설정
seongwon030 Feb 1, 2026
916687b
chore: playwright 설정 추가 및 e2e 실행 옵션 정리
seongwon030 Feb 1, 2026
8108572
chore: package-lock json 추가
seongwon030 Feb 1, 2026
c2920e9
fix: MSW 비활성화 시 서비스워커 자동 해제
seongwon030 Feb 1, 2026
ad67a1b
fix: MSW 서비스워커 스크립트 최신화
seongwon030 Feb 1, 2026
9b26475
feat: e2e mock 데이터 추가
seongwon030 Feb 1, 2026
580ae33
test: 지원하기 플로우 e2e 테스트 추가
seongwon030 Feb 1, 2026
c080912
chore: gitingore 업데이트
seongwon030 Feb 1, 2026
22e91e9
fix: TS 설정 보완
seongwon030 Feb 1, 2026
d2b044e
feat: 프론트엔드 테스트 ci 추가
seongwon030 Feb 1, 2026
b06ef5d
fix: 단위테스트 시 e2e 파일 제외
seongwon030 Feb 1, 2026
1b0f8f8
fix: Playwright에서 서비스워커 차단 및 MSW 시작 실패 처리
seongwon030 Feb 1, 2026
2e229dd
feat: Mixpanel 비활성화 시 mock 함수 적용
seongwon030 Feb 1, 2026
943f3c5
feat: e2e 서버 실행 시 Mixpanel 비활성화 환경변수 추가
seongwon030 Feb 1, 2026
728d5dc
chore: 환경변수 주입
seongwon030 Feb 1, 2026
f7dfc6b
refactor: 주석제거
seongwon030 Feb 1, 2026
7ff6b66
chore: 개발서버 주소 직접 지정
seongwon030 Feb 1, 2026
112da33
chore: ci 파일에 서버주소 제거
seongwon030 Feb 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions .github/workflows/front-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Frontend CI

on:
pull_request:
branches: [main, develop-fe]
paths:
- "frontend/**"
push:
branches: [main, develop-fe]
paths:
- "frontend/**"

defaults:
run:
working-directory: frontend

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: "frontend/.nvmrc"
cache: "npm"
cache-dependency-path: "frontend/package-lock.json"

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: "frontend/.nvmrc"
cache: "npm"
cache-dependency-path: "frontend/package-lock.json"

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test -- --coverage

- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: frontend/coverage/
retention-days: 7

e2e:
name: E2E Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: "frontend/.nvmrc"
cache: "npm"
cache-dependency-path: "frontend/package-lock.json"

- name: Install dependencies
run: npm ci

- name: Install Playwright browsers
run: npx playwright install --with-deps chromium

- name: Run E2E tests
run: npm run test:e2e -- --project=chromium
env:
CI: true

- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 7

- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: frontend/test-results/
retention-days: 7

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: "frontend/.nvmrc"
cache: "npm"
cache-dependency-path: "frontend/package-lock.json"

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build:prod
5 changes: 4 additions & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ build-storybook.log
*storybook.log
coverage/
# Sentry Config File
.env.sentry-build-plugin
.env.sentry-build-plugin

playwright-report/
test-results/
157 changes: 157 additions & 0 deletions frontend/e2e/apply-flow.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import { expect, test } from '@playwright/test';
import {
MOCK_CLUB_ID,
MOCK_FORM_ID,
mockApplicationFormResponse,
mockApplicationOptionsResponse,
mockClubDetailResponse,
mockClubSearchResponse,
} from './fixture/mock-data';

// 팝업 닫기 헬퍼 함수
async function closePopupIfExists(page: import('@playwright/test').Page) {
const popup = page.locator('[aria-modal="true"]');
const isPopupVisible = await popup.isVisible().catch(() => false);

if (isPopupVisible) {
await page.keyboard.press('Escape');
await page.waitForTimeout(300);

if (await popup.isVisible().catch(() => false)) {
const closeButton = popup.locator('button').first();
if (await closeButton.isVisible().catch(() => false)) {
await closeButton.click({ force: true });
await page.waitForTimeout(300);
}
}
}
}

test.describe('지원하기 플로우', () => {
test.beforeEach(async ({ context }) => {
// context.route는 서비스 워커를 통과하는 요청도 가로챌 수 있음

// 모든 API 요청을 하나의 핸들러에서 URL 기반으로 분기 처리
await context.route(
(url) => url.href.includes('/api/club'),
async (route) => {
const url = route.request().url();
const method = route.request().method();
console.log(`[MOCK] ${method} ${url}`);

// 지원서 폼 데이터 (GET) + 지원 제출 (POST)
if (url.includes(`/api/club/${MOCK_CLUB_ID}/apply/${MOCK_FORM_ID}`)) {
if (method === 'POST') {
await route.fulfill({ status: 200, body: '' });
} else {
await route.fulfill({ json: mockApplicationFormResponse });
}
return;
}

// 지원서 옵션 목록 (GET /api/club/{clubId}/apply)
if (
url.includes(`/api/club/${MOCK_CLUB_ID}/apply`) &&
!url.includes(`/apply/`)
) {
await route.fulfill({ json: mockApplicationOptionsResponse });
return;
}

// 동아리 검색 (GET /api/club/search/)
if (url.includes('/api/club/search')) {
await route.fulfill({ json: mockClubSearchResponse });
return;
}

// 동아리 상세 (GET /api/club/{clubId}) — 위에서 매칭되지 않은 나머지
if (
url.includes(`/api/club/${MOCK_CLUB_ID}`) &&
!url.includes('/apply') &&
!url.includes('/search')
) {
await route.fulfill({ json: mockClubDetailResponse });
return;
}

// 매칭되지 않는 API 요청은 통과
await route.continue();
},
);
});

test('메인페이지 → 동아리 카드 클릭 → 상세 → 지원하기 → 폼 작성 → 제출', async ({
page,
}) => {
// 브라우저 콘솔 에러 로깅
page.on('console', (msg) => {
if (msg.type() === 'error') {
console.log(`[BROWSER ERROR] ${msg.text()}`);
}
});
page.on('pageerror', (err) => {
console.log(`[PAGE ERROR] ${err.message}`);
});

// Step 1: 메인페이지 진입
await page.goto('/');
await page.waitForLoadState('networkidle');
await closePopupIfExists(page);

await expect(page.getByText(/전체 \d+개의 동아리/)).toBeVisible({
timeout: 10000,
});

// Step 2: 동아리 카드 클릭 → 상세페이지 이동
await page.getByText('테스트 동아리').first().click();

await expect(page).toHaveURL(new RegExp(`/clubDetail/${MOCK_CLUB_ID}`), {
timeout: 10000,
});

// Step 3: 상세페이지에서 동아리명 확인 및 지원하기 버튼 확인
await expect(page.getByText('테스트 동아리').first()).toBeVisible({
timeout: 10000,
});

const applyButton = page.getByText('지원하기');
await expect(applyButton).toBeVisible({ timeout: 10000 });

// Step 4: 지원하기 버튼 클릭 → 지원서 폼 페이지 이동
await applyButton.click();

await expect(page).toHaveURL(
new RegExp(`/application/${MOCK_CLUB_ID}/${MOCK_FORM_ID}`),
{ timeout: 10000 },
);

// Step 5: 지원서 폼 확인 및 답변 입력
await expect(
page.getByText('2026년 1학기 신입부원 모집').first(),
).toBeVisible({ timeout: 10000 });

// NAME 질문: 이름 입력
const nameInput = page.getByPlaceholder('답변입력란(최대 100자)').first();
await nameInput.fill('홍길동');

// SHORT_TEXT 질문: 지원 동기 입력
const motivationInput = page
.getByPlaceholder('답변입력란(최대 100자)')
.nth(1);
await motivationInput.fill('동아리 활동에 관심이 많습니다.');

// CHOICE 질문: 선택지 클릭
await page.getByText('프로그래밍').click();

// Step 6: 제출하기 클릭 → alert 확인 → 상세페이지 복귀
page.on('dialog', async (dialog) => {
await dialog.accept();
});

await page.getByText('제출하기').click();

await expect(page).toHaveURL(new RegExp(`/clubDetail/${MOCK_CLUB_ID}`), {
timeout: 10000,
});
});
});
Loading
Loading