Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
50527ae
feature: E2E 워크플로우 추가
six-standard Jul 25, 2025
6045cb3
refactor: 메세지 개선 및 오류 해결
six-standard Jul 25, 2025
eda3cd9
refactor: 임시 수정
six-standard Jul 25, 2025
378e66c
fix: 액션 env 값 관련 오류 해결
six-standard Jul 26, 2025
2ddaf34
fix: 액션에서 서버 실행 후 무한 대기하는 오류 해결
six-standard Jul 26, 2025
f70099a
fix: 액션에서 서버 실행시 정상적으로 대기하도록 수정
six-standard Jul 26, 2025
c90cf04
fix: cypress 캐시 관련 오류 해결
six-standard Jul 26, 2025
8693ee5
fix: cypress 캐시 설치 관련 오류 해결
six-standard Jul 26, 2025
e249c8c
refactor: 스크린샷 폴더 gitignore
six-standard Jul 26, 2025
66e135e
refactor: 필요없는 케이스 삭제
six-standard Jul 26, 2025
60ea5ce
refactor: 풀 리퀘스트시에만 실행되도록 수정
six-standard Jul 26, 2025
f6d329b
refactor: 필요없는 브랜치 제거
six-standard Jul 26, 2025
344170e
refactor: gitignore 코드 위치 변경
six-standard Jul 28, 2025
b5b4d17
refactor: 실패 시 슬랙에 메세지 전송
six-standard Jul 28, 2025
bd1fea6
refactor: 원래 env 값과의 차이점 추가
six-standard Jul 28, 2025
5deb2f2
refactor: 테스트
six-standard Jul 28, 2025
7eb9e96
refactor: 알림 테스트
six-standard Jul 28, 2025
fd8f17d
refactor: 메세지 전송 방식 변경
six-standard Jul 28, 2025
5a679b9
refactor: 메세지 형태 수정
six-standard Jul 28, 2025
7de9646
refactor: 테스트
six-standard Jul 28, 2025
5522f1d
refactor: 메세지 마지막 수정
six-standard Jul 28, 2025
8a7e079
refactor: 아티팩트 URL 추가
six-standard Jul 28, 2025
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
81 changes: 81 additions & 0 deletions .github/workflows/process-e2e.yaml

Choose a reason for hiding this comment

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

실패시 slack 오도록 하는건 어떻게 되었나요? 노션에 내용 있길래 여쭤봅니다~~

Copy link
Member Author

Choose a reason for hiding this comment

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

반영했습니다!

Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Process E2E Testing

on:
pull_request:
branches:
- main

jobs:
process-e2e-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 23
Comment on lines +16 to +19

Choose a reason for hiding this comment

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

코드래빗 코멘트처럼 LTS로 바꾸거나, api 리포지토리의 CI 처럼 여러 노드 버전에서 돌리는 게 좋을 것 같네요!
그런데 기존 FE 워크플로우를 보니 동일하게 23 버전으로 돌리긴 하네요. 기준님 생각은 어떠신가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

애초에 해당 CI의 초반 코드를 해당 플로우의 코드에서 가져와서 23 버전으로 맞춘 것 같네요.
그래도 지금까지 플로우에서 큰 문제가 없었던 만큼, 우선 23 버전으로 두는 게 괜찮을 것 같습니다!


- name: Install dependencies
run: |
npm install -g pnpm
pnpm install --frozen-lockfile
npx cypress install

- name: Create .env file for Testing
run: |
echo "NEXT_PUBLIC_BASE_URL=http://localhost:3000" >> .env
echo "NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY=sample_key" >> .env
echo "NEXT_PUBLIC_GA_ID=sample_id" >> .env
echo "NEXT_PUBLIC_SENTRY_AUTH_TOKEN=sample_token" >> .env
echo "NEXT_PUBLIC_SENTRY_DSN=sample_dsn" >> .env

- name: Start application server
run: |
pnpm dev &
env:
CI: true

- name: Wait for server
run: npx wait-on http://localhost:3000 --timeout 60000

- name: Run Cypress tests
uses: cypress-io/github-action@v6
with:
browser: chrome
headless: true
record: false
wait-on: 'http://localhost:3000'
wait-on-timeout: 120
install: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEXT_PUBLIC_BASE_URL: 'http://localhost:3000'
NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY: 'sample_key'
NEXT_PUBLIC_GA_ID: 'sample_id'
NEXT_PUBLIC_SENTRY_AUTH_TOKEN: 'sample_token'
NEXT_PUBLIC_SENTRY_DSN: 'sample_dsn'

- name: Upload screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
Comment on lines +65 to +70
Copy link
Member

Choose a reason for hiding this comment

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

"artifact" 까진 너무 좋은데 이걸 저장해서 어디에 사용하나요?! next step 이 없는게 아쉽네요.
ps) artifact 링크를 slack hook 으로 전송 가능함!

Copy link
Member Author

Choose a reason for hiding this comment

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

반영했습니다!
(실패 메세지에 artifact 링크가 포함되도록 수정했어요)


slackNotify:
runs-on: ubuntu-latest

steps:
- name: Notify message to slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.GIT_ACTION_SLACK_WEBHOOK }}
SLACK_CHANNEL: ${{ secrets.GIT_ACTION_SLACK_CHANNEL }}
SLACK_COLOR: ${{ job.status }} # 또는 'green', '#ff00ff' 처럼 직접 색상 지정
SLACK_USERNAME: Github
SLACK_ICON: https://cdn-icons-png.flaticon.com/512/25/25231.png
SLACK_TITLE: E2E Test
SLACK_MESSAGE: 'E2E CI 테스트가 실패했습니다. Artifact를 확인해주세요.'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Temporary Items

# testing
/coverage
/cypress/screenshots

# next.js
/.next/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ RUN pnpm install --no-frozen-lockfile --prod

EXPOSE 3000

CMD ["pm2-runtime", "start", "ecosystem.config.js"]
CMD ["pm2-runtime", "start", "ecosystem.config.js"]
8 changes: 4 additions & 4 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export default defineConfig({
responseTimeout: 10000,
env: {
NEXT_PUBLIC_BASE_URL: 'http://localhost:3000',
NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY: 'test_key',
NEXT_PUBLIC_GA_ID: '',
NEXT_PUBLIC_SENTRY_AUTH_TOKEN: 'test_sentry_token',
NEXT_PUBLIC_SENTRY_DSN: 'test_sentry_dsn',
NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY: 'sample_key',
NEXT_PUBLIC_GA_ID: 'sample_id',
NEXT_PUBLIC_SENTRY_AUTH_TOKEN: 'sample_token',
NEXT_PUBLIC_SENTRY_DSN: 'sample_dsn',
Comment on lines +17 to +20
Copy link
Member

Choose a reason for hiding this comment

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

저번에 물어 본다는 것을 놓쳤는데

센트리 DSN 경우 node run-time 에서 모듈 올릴때 유효하지 않은 경우 뻑나거든요!
근데 cypress 는 이게 skip 이 되나봐요?!

Copy link
Member Author

@six-standard six-standard Jul 28, 2025

Choose a reason for hiding this comment

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

네 맞습니다
sentry 자체가 production에서만 실행되게 적용해두어서 테스트 환경에서는 실행되지 않습니다.

스크린샷 2025-07-28 오후 9 20 05 프론트엔드 프로젝트의 root 경로에 있는 sentry.**.config.ts 파일들에서 확인해보실 수 있습니다!
},
/* eslint-disable @typescript-eslint/no-unused-vars */
setupNodeEvents(_on, _config) {
Expand Down
6 changes: 0 additions & 6 deletions cypress/e2e/leaderboards.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ describe('리더보드 페이지', () => {
cy.get('select').eq(3).select('지난 30일');
});

it('랭킹 순위가 표시되어야 한다', () => {
cy.get('[data-testid="rank"], [class*="rank"]').should('be.visible');
cy.contains('1').should('be.visible');
cy.contains('2').should('be.visible');
});

Comment on lines -47 to -52
Copy link
Member

Choose a reason for hiding this comment

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

사용자랑 게시글 모두 보이니까 굳이 랭킹은 스킵한거죠?

Copy link
Member Author

Choose a reason for hiding this comment

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

네 맞습니다!
랭킹 값이 렌더되면 유저 랭킹 순위는 무조건 표시되어서 (map의 인덱스 값 사용) 큰 문제가 없을 것 같아 제거했습니다

it('통계 변화량이 표시되어야 한다', () => {
cy.contains('500').should('be.visible');
cy.contains('300').should('be.visible');
Expand Down
Loading