Skip to content

Commit b4b25a2

Browse files
authored
[25.07.26 / TASK-229] Feature - FE Git Action E2E CI 적용 (#47)
1 parent a5f6f9c commit b4b25a2

File tree

4 files changed

+86
-10
lines changed

4 files changed

+86
-10
lines changed

.github/workflows/process-e2e.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Process E2E Testing
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
process-e2e-test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 23
20+
21+
- name: Install dependencies
22+
run: |
23+
npm install -g pnpm
24+
pnpm install --frozen-lockfile
25+
npx cypress install
26+
27+
- name: Create .env file for Testing
28+
run: |
29+
echo "NEXT_PUBLIC_BASE_URL=http://localhost:3000" >> .env
30+
echo "NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY=sample_key" >> .env
31+
echo "NEXT_PUBLIC_GA_ID=sample_id" >> .env
32+
echo "NEXT_PUBLIC_SENTRY_AUTH_TOKEN=sample_token" >> .env
33+
echo "NEXT_PUBLIC_SENTRY_DSN=sample_dsn" >> .env
34+
35+
- name: Start application server
36+
run: |
37+
pnpm dev &
38+
env:
39+
CI: true
40+
41+
- name: Wait for server
42+
run: npx wait-on http://localhost:3000 --timeout 60000
43+
44+
- name: Run Cypress tests
45+
uses: cypress-io/github-action@v6
46+
with:
47+
browser: chrome
48+
headless: true
49+
record: false
50+
wait-on: 'http://localhost:3000'
51+
wait-on-timeout: 120
52+
install: false
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
NEXT_PUBLIC_BASE_URL: 'http://localhost:3000'
56+
NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY: 'sample_key'
57+
NEXT_PUBLIC_GA_ID: 'sample_id'
58+
NEXT_PUBLIC_SENTRY_AUTH_TOKEN: 'sample_token'
59+
NEXT_PUBLIC_SENTRY_DSN: 'sample_dsn'
60+
61+
# KST 시간을 GitHub Actions 환경 변수에 세팅
62+
- name: Get Current KST Time
63+
run: echo "KST_TIME=$(TZ=Asia/Seoul date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
64+
65+
- name: Upload screenshots
66+
uses: actions/upload-artifact@v4
67+
if: failure()
68+
with:
69+
name: cypress-screenshots
70+
path: cypress/screenshots
71+
72+
- name: Send Slack Notification on Failure
73+
uses: slackapi/[email protected]
74+
if: failure()
75+
with:
76+
payload: |
77+
{
78+
"text": "*❌ FE E2E CI Test was failed*\n\n📅 *Timestamp (KST):* ${{ env.KST_TIME }}\n\n🔗 *Workflow URL:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow>\n\n🔗 *Commit:* <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>\n\n📸 *Screenshots:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts|Download Screenshots>"
79+
}
80+
env:
81+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Temporary Items
5454

5555
# testing
5656
/coverage
57+
/cypress/screenshots
5758

5859
# next.js
5960
/.next/

cypress.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export default defineConfig({
1414
responseTimeout: 10000,
1515
env: {
1616
NEXT_PUBLIC_BASE_URL: 'http://localhost:3000',
17-
NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY: 'test_key',
18-
NEXT_PUBLIC_GA_ID: '',
19-
NEXT_PUBLIC_SENTRY_AUTH_TOKEN: 'test_sentry_token',
20-
NEXT_PUBLIC_SENTRY_DSN: 'test_sentry_dsn',
17+
NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY: 'sample_key',
18+
NEXT_PUBLIC_GA_ID: 'sample_id',
19+
NEXT_PUBLIC_SENTRY_AUTH_TOKEN: 'sample_token',
20+
NEXT_PUBLIC_SENTRY_DSN: 'sample_dsn',
2121
},
2222
/* eslint-disable @typescript-eslint/no-unused-vars */
2323
setupNodeEvents(_on, _config) {

cypress/e2e/leaderboards.cy.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ describe('리더보드 페이지', () => {
4444
cy.get('select').eq(3).select('지난 30일');
4545
});
4646

47-
it('랭킹 순위가 표시되어야 한다', () => {
48-
cy.get('[data-testid="rank"], [class*="rank"]').should('be.visible');
49-
cy.contains('1').should('be.visible');
50-
cy.contains('2').should('be.visible');
51-
});
52-
5347
it('통계 변화량이 표시되어야 한다', () => {
5448
cy.contains('500').should('be.visible');
5549
cy.contains('300').should('be.visible');

0 commit comments

Comments
 (0)