From 906a41f18cef0f7587ae153d434b80bf0535d099 Mon Sep 17 00:00:00 2001 From: Daniel Ip Date: Sat, 22 Jun 2024 16:18:34 +0100 Subject: [PATCH] Add playwright config and github worklow to run e2e test (#606) * add playwright config and github worklow to run e2e test * Add dev branch E2E test status to README.md * Update README.md --- .github/workflows/playwright.yml | 34 ++++++++++++++++++++++++++++++++ README.md | 1 + playwright.config.ts | 7 +++++++ 3 files changed, 42 insertions(+) create mode 100644 .github/workflows/playwright.yml create mode 100644 playwright.config.ts diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 00000000..9b3796a8 --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,34 @@ +name: Playwright Tests +on: + push: + branches: [main, dev] + pull_request: + branches: [main, dev] + workflow_dispatch: + +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@master + with: + node-version: 18 + - name: Install dependencies + run: npm install + - name: Install Playwright Browsers + run: npx playwright install --with-deps + - name: Build + run: npm run build + - name: Run Playwright tests + run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:playwright + # if: matrix.os == 'ubuntu-latest' + # - run: npm run test + # if: matrix.os != 'ubuntu-latest' + - uses: actions/upload-artifact@v4 + if: always() + with: + name: test-output + path: test-output/ + retention-days: 30 diff --git a/README.md b/README.md index f9a424c2..e7774965 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Downloads](https://img.shields.io/github/downloads/ChurchApps/freeshow/total)](https://github.com/ChurchApps/freeshow/releases) [![Licence](https://img.shields.io/badge/licence-GPL-blue.svg)](https://github.com/ChurchApps/freeshow/blob/main/LICENSE) +[![Playwright Tests](https://github.com/ChurchApps/FreeShow/actions/workflows/playwright.yml/badge.svg?branch=dev)](https://github.com/ChurchApps/FreeShow/actions/workflows/playwright.yml) # FreeShow diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 00000000..dbe73119 --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from "@playwright/test" + +export default defineConfig({ + // 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot' + // default 'line' when running locally + reporter: [[process.env.CI ? "html" : "line", { outputFolder: "test-output/playwright-report" }]], +})