Playwright E2E Tests #713
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright E2E Tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
schedule: | |
# 18:30 GMT+8 every day | |
- cron: '30 10 * * *' | |
jobs: | |
wait-for-deployment: | |
uses: ./.github/workflows/vercel-deployment.yml | |
if: (github.event_name == 'push' || github.event_name == 'pull_request') && (github.actor != 'dependabot[bot]') | |
secrets: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
playwright-e2e-test-stage: | |
name: Playwright E2E Tests (Stage Deployment) | |
needs: wait-for-deployment | |
timeout-minutes: 60 | |
runs-on: macos-12 # use macos for page visual test | |
if: contains(github.ref, 'refs/pull') | |
env: | |
NEXT_PUBLIC_APP_ENV: stage | |
VERCEL_URL: ${{ needs.wait-for-deployment.outputs.vercel-deployment-url }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
- name: Install dependencies | |
run: npm ci --legacy-peer-deps | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npm run test:e2e:page; npm run test:e2e:api; | |
- uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: stage-deployment-page-api-test-report | |
path: | | |
e2e-page-report | |
e2e-api-report | |
artifacts/e2e-test-results | |
retention-days: 14 | |
playwright-e2e-test-production: | |
name: Playwright E2E Tests (Production Deployment) | |
needs: wait-for-deployment | |
timeout-minutes: 60 | |
runs-on: macos-12 # use macos for page visual test | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
env: | |
NEXT_PUBLIC_APP_ENV: production | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
- name: Install dependencies | |
run: npm ci --legacy-peer-deps | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npm run test:e2e:page; npm run test:e2e:api; | |
- uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: production-deployment-page-api-test-report | |
path: | | |
e2e-page-report | |
e2e-api-report | |
artifacts/e2e-test-results | |
retention-days: 14 | |
playwright-e2e-test-production-schedule: | |
name: Playwright E2E Tests (Production Schedule) | |
timeout-minutes: 60 | |
runs-on: macos-12 # use macos for page visual test | |
if: github.ref == 'refs/heads/main' && github.event_name == 'schedule' | |
env: | |
NEXT_PUBLIC_APP_ENV: production | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
- name: Install dependencies | |
run: npm ci --legacy-peer-deps | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npm run test:e2e:page; npm run test:e2e:api; | |
- uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: production-schedule-page-api-test-report | |
path: | | |
e2e-page-report | |
e2e-api-report | |
artifacts/e2e-test-results | |
retention-days: 14 |