diff --git a/.github/workflows/cleanup-cashes.yml b/.github/workflows/cleanup-cashes.yml index b3828f4..1da66c7 100644 --- a/.github/workflows/cleanup-cashes.yml +++ b/.github/workflows/cleanup-cashes.yml @@ -5,6 +5,7 @@ on: paths: - "app/**" - "public/**" + - "test/**" - ".dockerignore" - "bun.lockb" - "Dockerfile" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 74400a2..01ce90d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -9,6 +9,7 @@ on: paths: - "app/**" - "public/**" + - "test/**" - ".dockerignore" - "bun.lockb" - "Dockerfile" @@ -19,6 +20,7 @@ on: paths: - "app/**" - "public/**" + - "test/**" - ".dockerignore" - "bun.lockb" - "Dockerfile" diff --git a/.github/workflows/lambda.yml b/.github/workflows/lambda.yml index 1a9dbdc..6d64e18 100644 --- a/.github/workflows/lambda.yml +++ b/.github/workflows/lambda.yml @@ -10,6 +10,7 @@ on: paths: - "app/**" - "public/**" + - "test/**" - ".dockerignore" - "bun.lockb" - "Dockerfile" diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 0000000..c23da96 --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,64 @@ +name: Playwright Tests + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + paths: + - "app/**" + - "public/**" + - "test/**" + - ".dockerignore" + - "bun.lockb" + - "Dockerfile" + - "package.json" + - "*config.*" + push: + paths: + - "app/**" + - "public/**" + - "test/**" + - ".dockerignore" + - "bun.lockb" + - "Dockerfile" + - "package.json" + - "*config.*" + workflow_dispatch: + +jobs: + test: + timeout-minutes: 30 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ env.SHA }} + env: + SHA: ${{ github.event.pull_request.head.sha || github.sha }} + + - name: Install bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: canary + + - name: Install dependencies + run: bun i + + - name: Build app + run: bun run build + + - name: Install Playwright Browsers + run: bunx playwright install --with-deps + + - name: Run Playwright tests + run: bunx playwright test + + - uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c7bbc8..6da1f50 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,7 @@ on: paths: - "app/**" - "public/**" + - "test/**" - ".dockerignore" - "bun.lockb" - "Dockerfile" @@ -18,6 +19,7 @@ on: paths: - "app/**" - "public/**" + - "test/**" - ".dockerignore" - "bun.lockb" - "Dockerfile" @@ -46,7 +48,7 @@ jobs: - name: Test app run: | - bun test &> >(tee -p test.log) || echo STATUS=$? >> $GITHUB_ENV + bun test:app &> >(tee -p test.log) || echo STATUS=$? >> $GITHUB_ENV { echo 'RESULT<) diff --git a/test/e2e/index.test.ts b/test/e2e/index.test.ts new file mode 100644 index 0000000..2a637ee --- /dev/null +++ b/test/e2e/index.test.ts @@ -0,0 +1,10 @@ +import { expect, test } from "@playwright/test" + +const title: RegExp = /Create Next App/ + +test("has title", async ({ page }) => { + await page.goto("/") + + // Expect a title "to contain" a substring. + await expect(page).toHaveTitle(title) +})