diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..53e97c9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,54 @@ +name: Test + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + test: + name: Lint, type-check, and test + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.14.1 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Lint + run: pnpm exec eslint . + + - name: Type-check + run: pnpm compile + + - name: Unit tests + run: pnpm test:unit + + - name: Install Playwright browsers + run: pnpm exec playwright install --with-deps chromium + + - name: E2E tests + run: pnpm test:e2e diff --git a/playwright.config.ts b/playwright.config.ts index 6c2ec8f..f316d90 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,20 +1,5 @@ -import { existsSync } from 'node:fs' -import process from 'node:process' import { defineConfig } from '@playwright/test' -const chromiumExecutablePath = [ - process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE, - 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', - 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', - 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe', - 'C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe', - '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', - '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge', - '/usr/bin/google-chrome', - '/usr/bin/chromium', - '/usr/bin/chromium-browser', -].find((value): value is string => Boolean(value && existsSync(value))) - export default defineConfig({ testDir: './tests/e2e', timeout: 60_000, @@ -25,9 +10,6 @@ export default defineConfig({ reporter: 'list', use: { browserName: 'chromium', - launchOptions: chromiumExecutablePath - ? { executablePath: chromiumExecutablePath } - : undefined, trace: 'retain-on-failure', }, })