Skip to content
Merged
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
5bca97f
add: playwright 자동화 ci 스크립트 추가 및 작동 테스트
qkrwoghd04 Jul 29, 2025
82f27ab
fix: vitest와의 충돌로 테스트 실패하는 부분 수정
qkrwoghd04 Jul 29, 2025
3041995
add: playwright 관련 설정 초기화
qkrwoghd04 Jul 29, 2025
44dc1e5
test(e2e): 팀소개 페이지 진입 및 구독 버튼 인터랙션 테스트 추가
qkrwoghd04 Jul 29, 2025
94eefd7
fix: playwright ci 과정에서 npm run start로 개발 서버를 띄우려 해서 에러 발생 - 해결
qkrwoghd04 Jul 29, 2025
ecaad9d
fix: page.mouse.wheel() 함수가 모바일 환경에서는 지원하지 않은 문제 해결
qkrwoghd04 Jul 29, 2025
0b4b559
test: Playwright E2E 테스트 및 Lighthouse 성능 리포트 워크플로우 통합
qkrwoghd04 Jul 29, 2025
5aaf0ad
fix: contentRequest 파일 삭제로 발생하던 오류 해결
qkrwoghd04 Jul 29, 2025
b1b6689
fix: contentRequest 파일 삭제로 발생하던 오류 해결
qkrwoghd04 Jul 29, 2025
2812c65
fix: lighthouse 데스크탑 환경으로 적용
qkrwoghd04 Jul 29, 2025
b732794
refactor: playwright와 lighthouse가 리포트만 업로드하고 끝나는 것이 아닌, 요약해서 코멘트로 남기게 처리
qkrwoghd04 Jul 29, 2025
f16039d
refactor: playwright와 lighthouse가 리포트만 업로드하고 끝나는 것이 아닌, 요약해서 코멘트로 남기게 처리
qkrwoghd04 Jul 29, 2025
670bec2
refactor: playwright와 lighthouse가 리포트만 업로드하고 끝나는 것이 아닌, 요약해서 코멘트로 남기게 처리
qkrwoghd04 Jul 29, 2025
490d2bf
refactor: playwright와 lighthouse가 리포트만 업로드하고 끝나는 것이 아닌, 요약해서 코멘트로 남기게 처리
qkrwoghd04 Jul 29, 2025
0cd04eb
refactor: playwright와 lighthouse가 리포트만 업로드하고 끝나는 것이 아닌, 요약해서 코멘트로 남기게 처리
qkrwoghd04 Jul 29, 2025
f104d30
test: Playwright 리포터 설정을 config 파일로 이전해 JSON 결과 안정화
qkrwoghd04 Jul 29, 2025
4991e35
test: Playwright 리포터 설정을 config 파일로 이전해 JSON 결과 안정화
qkrwoghd04 Jul 29, 2025
b1ce386
test: Playwright 리포터 설정을 config 파일로 이전해 JSON 결과 안정화
qkrwoghd04 Jul 29, 2025
3f15ec8
modify: playwright report 형식 json으로 수정
qkrwoghd04 Jul 30, 2025
e294543
modify: playwright report 형식 json으로 수정
qkrwoghd04 Jul 30, 2025
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
120 changes: 120 additions & 0 deletions .github/workflows/E2ETest_Lighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Playwright + Lighthouse

on:
pull_request:
branches: [main]

jobs:
e2e-and-lighthouse:
timeout-minutes: 60
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
# 1. 소스 체크아웃
- uses: actions/checkout@v4

# 2. Node 설치
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'

# 3. 의존성 설치
- name: Install dependencies
run: npm ci

# 4. Playwright 브라우저 설치
- name: Install Playwright Browsers
run: npx playwright install --with-deps

# 5. 프로젝트 빌드
- name: Build project
run: npm run build

# 6. Playwright 테스트 실행 (JSON 리포트 저장)
Comment on lines +30 to +35
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Playwright/Lighthouse failures will short-circuit the rest of the job

Both “Run Playwright tests” (line 28) and “Run Lighthouse CI” (line 31) will exit with a non-zero status when tests or assertions fail.
Because continue-on-error: isn’t set, the subsequent parsing steps (and the PR comment) will be skipped, leaving no feedback artefacts when they are most useful.

-      - name: Run Playwright tests
-        run: npx playwright test --reporter=json > playwright-result.json
+      - name: Run Playwright tests
+        run: npx playwright test --reporter=json > playwright-result.json
+        continue-on-error: true
...
-      - name: Run Lighthouse CI
-        run: npx lhci autorun --config=./lighthouserc.json --output=json
+      - name: Run Lighthouse CI
+        run: npx lhci autorun --config=./lighthouserc.json --output=json
+        continue-on-error: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# 5. 프로젝트 빌드
- name: Build project
run: npm run build
# 6. Playwright 테스트 실행 (JSON 리포트 저장)
# 6. Playwright 테스트 실행 (JSON 리포트 저장)
- name: Run Playwright tests
run: npx playwright test --reporter=json > playwright-result.json
continue-on-error: true
# 7. Run Lighthouse CI
- name: Run Lighthouse CI
run: npx lhci autorun --config=./lighthouserc.json --output=json
continue-on-error: true
🤖 Prompt for AI Agents
In .github/workflows/E2ETest_Lighthouse.yml around lines 28 to 33, the steps
"Run Playwright tests" and "Run Lighthouse CI" can fail and stop the entire job,
preventing later steps like parsing results and posting PR comments from
running. To fix this, add `continue-on-error: true` to these steps so the
workflow continues even if tests fail, ensuring feedback steps always run.

- name: Run Playwright tests
run: npx playwright test

# 7. Lighthouse CI 실행 (JSON 리포트 저장)
- name: Run Lighthouse CI
run: npx lhci autorun --config=./lighthouserc.json --output=json

# 8. Lighthouse 결과 파싱
- name: Parse Lighthouse Scores
id: lighthouse
run: |
report_path=$(jq -r '.[0].jsonPath' lhci-report/manifest.json)
result=$(cat $report_path | jq '{
perf: (.categories.performance.score * 100),
access: (.categories.accessibility.score * 100),
seo: (.categories.seo.score * 100),
lcp: (.audits["largest-contentful-paint"].numericValue / 1000)
}')
echo "result<<EOF" >> $GITHUB_OUTPUT
echo "$result" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

# 9. Playwright 결과 파싱
- name: Parse Playwright Results
id: playwright
run: |
passed=$(jq '.stats.expected' playwright-result.json)
failed=$(jq '.stats.unexpected' playwright-result.json)
total=$((passed + failed))
echo "passed=$passed" >> $GITHUB_OUTPUT
echo "failed=$failed" >> $GITHUB_OUTPUT
echo "total=$total" >> $GITHUB_OUTPUT

# 10. PR 코멘트 작성
- name: Comment on PR
uses: actions/github-script@v7
env:
RESULT: ${{ steps.lighthouse.outputs.result }}
PASSED: ${{ steps.playwright.outputs.passed }}
FAILED: ${{ steps.playwright.outputs.failed }}
TOTAL: ${{ steps.playwright.outputs.total }}
with:
script: |
const lh = JSON.parse(process.env.RESULT);
const passed = Number(process.env.PASSED);
const failed = Number(process.env.FAILED);
const total = Number(process.env.TOTAL);

const body = `
### E2E Test & Lighthouse Report

| Category | Result |
|---------------|--------|
| **Tests** | |
| Total | \`${total}\` |
| ✅ Passed | \`${passed}\` |
| ❌ Failed | \`${failed}\` |
| **Lighthouse**| |
| 🚀 Performance | \`${lh.perf}\` |
| ♿ Accessibility| \`${lh.access}\` |
| 🔎 SEO | \`${lh.seo}\` |
| LCP | \`${lh.lcp.toFixed(2)}s\` |
`;

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});

# 11. 리포트 아티팩트 업로드 (HTML 파일)
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report
retention-days: 30

- uses: actions/upload-artifact@v4
if: always()
with:
name: lighthouse-report
path: lhci-report
retention-days: 30
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ dev-dist
*.njsproj
*.sln
*.sw?

# Playwright
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
22 changes: 22 additions & 0 deletions lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"ci": {
"collect": {
"url": ["http://localhost:4173"],
"startServerCommand": "npm run preview",
"numberOfRuns": 1,
"settings": {
"preset": "desktop"
}
},
"assert": {
"assertions": {
"categories:performance": ["warn", { "minScore": 0.8 }],
"categories:accessibility": ["warn", { "minScore": 0.8 }]
}
},
"upload": {
"target": "filesystem",
"outputDir": "./lhci-report"
}
}
}
Loading