-
Notifications
You must be signed in to change notification settings - Fork 1
playwright ci 설정 초기화 및 테스트 #112
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5bca97f
add: playwright 자동화 ci 스크립트 추가 및 작동 테스트
qkrwoghd04 82f27ab
fix: vitest와의 충돌로 테스트 실패하는 부분 수정
qkrwoghd04 3041995
add: playwright 관련 설정 초기화
qkrwoghd04 44dc1e5
test(e2e): 팀소개 페이지 진입 및 구독 버튼 인터랙션 테스트 추가
qkrwoghd04 94eefd7
fix: playwright ci 과정에서 npm run start로 개발 서버를 띄우려 해서 에러 발생 - 해결
qkrwoghd04 ecaad9d
fix: page.mouse.wheel() 함수가 모바일 환경에서는 지원하지 않은 문제 해결
qkrwoghd04 0b4b559
test: Playwright E2E 테스트 및 Lighthouse 성능 리포트 워크플로우 통합
qkrwoghd04 5aaf0ad
fix: contentRequest 파일 삭제로 발생하던 오류 해결
qkrwoghd04 b1b6689
fix: contentRequest 파일 삭제로 발생하던 오류 해결
qkrwoghd04 2812c65
fix: lighthouse 데스크탑 환경으로 적용
qkrwoghd04 b732794
refactor: playwright와 lighthouse가 리포트만 업로드하고 끝나는 것이 아닌, 요약해서 코멘트로 남기게 처리
qkrwoghd04 f16039d
refactor: playwright와 lighthouse가 리포트만 업로드하고 끝나는 것이 아닌, 요약해서 코멘트로 남기게 처리
qkrwoghd04 670bec2
refactor: playwright와 lighthouse가 리포트만 업로드하고 끝나는 것이 아닌, 요약해서 코멘트로 남기게 처리
qkrwoghd04 490d2bf
refactor: playwright와 lighthouse가 리포트만 업로드하고 끝나는 것이 아닌, 요약해서 코멘트로 남기게 처리
qkrwoghd04 0cd04eb
refactor: playwright와 lighthouse가 리포트만 업로드하고 끝나는 것이 아닌, 요약해서 코멘트로 남기게 처리
qkrwoghd04 f104d30
test: Playwright 리포터 설정을 config 파일로 이전해 JSON 결과 안정화
qkrwoghd04 4991e35
test: Playwright 리포터 설정을 config 파일로 이전해 JSON 결과 안정화
qkrwoghd04 b1ce386
test: Playwright 리포터 설정을 config 파일로 이전해 JSON 결과 안정화
qkrwoghd04 3f15ec8
modify: playwright report 형식 json으로 수정
qkrwoghd04 e294543
modify: playwright report 형식 json으로 수정
qkrwoghd04 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 리포트 저장) | ||
| - 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 결과 파싱 | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.📝 Committable suggestion
🤖 Prompt for AI Agents