Skip to content
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

feat: when pr, e2e test github actions ci #487

Merged
merged 6 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions .github/workflows/e2eTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: E2E Tests - Playwright
on:
pull_request:
branches: [main, master]
jobs:
tests:
timeout-minutes: 600
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/view
steps:
- uses: actions/checkout@v2 # v3 is not available as of my last update in January 2022
- uses: actions/setup-node@v3
with:
node-version: 18.16.0

# Add Playwright GitHub Action
- name: Setup Playwright
uses: microsoft/playwright-github-action@v1
Comment on lines +19 to +20
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


- name: Install dependencies
run: npm i

- name: npx playwright install
run: npx playwright install

- name: Run Playwright tests
run: npm run test:e2e
13 changes: 0 additions & 13 deletions packages/view/tests/home.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,4 @@ test.describe("home", () => {
test("has title", async ({ page }) => {
await expect(page).toHaveTitle(/Githru/);
});

test("check BranchSelector", async ({ page }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

요건 왜 지워졌나용?

Copy link
Contributor Author

@2taesung 2taesung Sep 20, 2023

Choose a reason for hiding this comment

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

일주일 전 소원님이 작업하신 내용과 충돌이 발생했는데
해당 테스트 코드의 목적과 완전 달라져 삭제했습니다.

  • 기존
    하드코딩으로
const branchList = ['dev', 'feat', 'edit'];
  • 변경(현재)
    동적으로 전체 commit들의 branch 종류들을 가져와 branchList에 할당.

그래서 동적으로 데이터를 가져오기 때문에 실제 e2e test에서 결과를 정적으로 체크함에 어려움이 있었습니다. 해결책으로 모킹을 여러 방면으로 고민해봤으나 e2e test에서 함수나 컴포넌트를 모킹하는 방식은 옳은 방법이 아닌 것 같아. 방법에 더 고민이 필요해 제거했습니다!

만약 CI가 이미 있었다면 소원님이 작업하시면서 해당 내용이 failed가 떠서 당시에 바로 의논해볼 수 있었을 것 같아. 'CI가 필요했었구나!' 라는 생각이 추가로 들었습니다! 참고로 소원님이 작업해주신 방향이 맞다고 생각하고 그에 맞게 대응할 수 있는 테스트를 고민해봐야할 것 같습니다!!

await expect(page.getByText("Branches:")).toBeVisible();

const options = await page.locator("section").getByRole("combobox").locator("option");
const optionValues = await options.evaluateAll((elements) =>
elements.map((option) => (option as HTMLOptionElement).value)
);

expect(optionValues).toContain("dev");
expect(optionValues).toContain("feat");
expect(optionValues).toContain("edit");
});
});
Loading