From e8cd6ceb08b0e232cb0a042485d83240f08379f4 Mon Sep 17 00:00:00 2001 From: Qaisar Irfan Date: Tue, 11 Feb 2025 19:31:08 +0500 Subject: [PATCH] ci: configure gitHub actions to run tests after pr merge --- .github/workflows/e2e.yml | 19 +++++++++++----- .../recommendedVideoCard.test.tsx.snap | 22 +++++++++---------- .../recommendedVideoCard.test.tsx | 2 +- src/jest/utils/testUtils.tsx | 16 ++++++++++++++ 4 files changed, 42 insertions(+), 17 deletions(-) create mode 100644 src/jest/utils/testUtils.tsx diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 6653f2b..84a8c13 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,9 +1,9 @@ -name: E2E tests +name: Unit Tests & E2E + on: push: branches: [main, dev] - pull_request: - branches: [main, dev] + jobs: test: timeout-minutes: 60 @@ -17,9 +17,18 @@ jobs: run: npm ci - name: Install Playwright Browsers run: npx playwright install --with-deps - - name: Run Playwright tests + - name: Run Unit & Integration Tests with Coverage + run: npm run test:cov + - name: Upload Coverage Report + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: coverage/ + retention-days: 30 + - name: Run Playwright E2E Tests run: npx playwright test - - uses: actions/upload-artifact@v4 + - name: Upload Playwright Report + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: name: playwright-report diff --git a/src/components/RecommendedVideoCard/__snapshots__/recommendedVideoCard.test.tsx.snap b/src/components/RecommendedVideoCard/__snapshots__/recommendedVideoCard.test.tsx.snap index 2c0f374..9f5b974 100644 --- a/src/components/RecommendedVideoCard/__snapshots__/recommendedVideoCard.test.tsx.snap +++ b/src/components/RecommendedVideoCard/__snapshots__/recommendedVideoCard.test.tsx.snap @@ -3,9 +3,9 @@ exports[`RecommendedVideoCard should matches snapshot 1`] = `
Sample Video Title

Jan 01, 2024 @@ -41,7 +41,7 @@ exports[`RecommendedVideoCard should matches snapshot 1`] = `

@@ -50,7 +50,7 @@ exports[`RecommendedVideoCard should matches snapshot 1`] = ` >