Skip to content

Commit a90ad7b

Browse files
committed
feat: easy / hard 를 구분하여 테스트를 실행할 수 있도록 함
1 parent beaf85f commit a90ad7b

File tree

10 files changed

+503
-989
lines changed

10 files changed

+503
-989
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,45 @@ on:
1010
workflow_dispatch:
1111

1212
jobs:
13-
unit:
13+
hard-basic:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
ref: ${{ github.event.pull_request.head.sha }}
20+
- uses: pnpm/action-setup@v4
21+
with:
22+
version: latest
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 22
26+
cache: 'pnpm'
27+
- run: |
28+
pnpm install
29+
pnpm run test:hard:basic
30+
hard-advanced:
31+
timeout-minutes: 60
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v3
35+
with:
36+
fetch-depth: 0
37+
ref: ${{ github.event.pull_request.head.sha }}
38+
- uses: pnpm/action-setup@v4
39+
with:
40+
version: latest
41+
- uses: actions/setup-node@v4
42+
with:
43+
node-version: 22
44+
cache: 'pnpm'
45+
- name: Install dependencies
46+
run: |
47+
pnpm install
48+
npx playwright install --with-deps
49+
pnpm run test:hard:advanced
50+
easy-basic:
51+
timeout-minutes: 60
1452
runs-on: ubuntu-latest
1553
steps:
1654
- uses: actions/checkout@v3
@@ -27,8 +65,9 @@ jobs:
2765
- name: Install dependencies
2866
run: |
2967
pnpm install
30-
pnpm run test
31-
e2e:
68+
npx playwright install --with-deps
69+
pnpm run test:easy:basic
70+
easy-advanced:
3271
timeout-minutes: 60
3372
runs-on: ubuntu-latest
3473
steps:
@@ -47,4 +86,4 @@ jobs:
4786
run: |
4887
pnpm install
4988
npx playwright install --with-deps
50-
pnpm run test:e2e
89+
pnpm run test:easy:advanced

e2e/E2EHelpers.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export class E2EHelpers {
2+
constructor(page) {
3+
this.page = page;
4+
}
5+
6+
// 페이지 로딩 대기
7+
async waitForPageLoad() {
8+
await this.page.waitForSelector('[data-testid="products-grid"], #products-grid', { timeout: 10000 });
9+
await this.page.waitForFunction(() => {
10+
const text = document.body.textContent;
11+
return text.includes("총") && text.includes("개");
12+
});
13+
}
14+
15+
// 상품을 장바구니에 추가
16+
async addProductToCart(productName) {
17+
await this.page.click(
18+
`text=${productName} >> xpath=ancestor::*[contains(@class, 'product-card')] >> .add-to-cart-btn`,
19+
);
20+
await this.page.waitForSelector("text=장바구니에 추가되었습니다", { timeout: 5000 });
21+
}
22+
23+
// 장바구니 모달 열기
24+
async openCartModal() {
25+
await this.page.click("#cart-icon-btn");
26+
await this.page.waitForSelector(".cart-modal-overlay", { timeout: 5000 });
27+
}
28+
}

0 commit comments

Comments
 (0)