Add GitHub workflow to run tests for changes under loop/webui/... (#7)
* Add GitHub workflow for loop/webui tests
This workflow runs npm test in the loop/webui directory
when there are changes to files in that directory.
Co-Authored-By: sketch
* webui: use terser output on ci
diff --git a/.github/workflows/webui_test.yml b/.github/workflows/webui_test.yml
new file mode 100644
index 0000000..86fbcc5
--- /dev/null
+++ b/.github/workflows/webui_test.yml
@@ -0,0 +1,44 @@
+name: WebUI Tests
+on:
+ workflow_call:
+ push:
+ branches-ignore:
+ - "queue-main-**"
+ paths:
+ - 'loop/webui/**'
+ pull_request:
+ paths:
+ - 'loop/webui/**'
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20'
+ cache: 'npm'
+ cache-dependency-path: loop/webui/package-lock.json
+
+ - name: Install dependencies
+ working-directory: ./loop/webui
+ run: npm ci
+
+ - name: Install Playwright browsers
+ working-directory: ./loop/webui
+ run: npx playwright install --with-deps
+
+ - name: Run tests
+ working-directory: ./loop/webui
+ run: npm run test
+
+ - name: Upload test results
+ if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: playwright-report
+ path: loop/webui/playwright-report/
+ retention-days: 7
diff --git a/loop/webui/playwright-ct.config.ts b/loop/webui/playwright-ct.config.ts
index 9c581c4..0dbaa1e 100644
--- a/loop/webui/playwright-ct.config.ts
+++ b/loop/webui/playwright-ct.config.ts
@@ -18,7 +18,7 @@
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
- reporter: 'html',
+ reporter: process.env.CI ? 'dot' : 'list',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */