diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..a570636 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,36 @@ +name: Run Playwright Tests +on: + pull_request: + branches: + - master + +jobs: + test_setup: + name: Test Setup + runs-on: ubuntu-latest + outputs: + preview_url: ${{ steps.waitForVercelPreviewDeployment.outputs.url }} + steps: + - name: Wait for Vercel preview deployment to be ready + uses: patrickedqvist/wait-for-vercel-preview@v1.3.1 + id: waitForVercelPreviewDeployment + with: + token: ${{ secrets.GITHUB_TOKEN }} + max_timeout: 300 + test_e2e: + needs: test_setup + name: Playwright tests + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - name: Prepare testing env + uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '16' + - run: npm ci + - run: npx playwright install --with-deps + - name: Run tests + run: npm run test:e2e + env: + PLAYWRIGHT_TEST_BASE_URL: ${{ needs.test_setup.outputs.preview_url }} diff --git a/.husky/pre-commit b/.husky/pre-commit index d611957..75de76e 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" npm run lint && npx lint-staged --concurrent false diff --git a/package.json b/package.json index 3dc00f1..51094f4 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "eslint": "^8", "eslint-config-next": "14.0.1", "eslint-config-prettier": "^9.0.0", - "husky": "^8.0.3", + "husky": "^8.0.0", "lint-staged": "^15.0.2", "postcss": "^8", "prettier": "^3.0.3",