Skip to content

Build your personal knowledge base with Trilium Notes

feat(ci): run playwright for docker builds

Elian Dorane556137a2575
diff --git a/.github/workflows/main-docker.yml b/.github/workflows/main-docker.yml
index 44043f73ef..13d57701b8 100644
--- a/.github/workflows/main-docker.yml
+++ b/.github/workflows/main-docker.yml
@@ -68,7 +68,7 @@ jobs:
- name: Validate container run output
run: |
- CONTAINER_ID=$(docker run -d --log-driver=journald --rm --name trilium_local ${{ env.TEST_TAG }})
+ CONTAINER_ID=$(docker run -d --log-driver=journald --rm --network=host --name trilium_local ${{ env.TEST_TAG }})
echo "Container ID: $CONTAINER_ID"
- name: Wait for the healthchecks to pass
@@ -79,6 +79,17 @@ jobs:
require-status: running
require-healthy: true
+ - name: Install Playwright Browsers
+ run: npx playwright install --with-deps
+ - name: Run Playwright tests
+ run: TRILIUM_DOCKER=1 npx playwright test
+ - uses: actions/upload-artifact@v4
+ if: ${{ !cancelled() }}
+ with:
+ name: playwright-report
+ path: playwright-report/
+ retention-days: 30
+
# Print the entire log of the container thus far, regardless if the healthcheck failed or succeeded
- name: Print entire log
if: always()
diff --git a/playwright.config.ts b/playwright.config.ts
index 86de95af08..1e0668cb44 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -28,7 +28,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
- baseURL: SERVER_URL,
+ baseURL: (!process.env.TRILIUM_DOCKER ? SERVER_URL : "http://127.0.0.1:8080"),
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
@@ -73,9 +73,9 @@ export default defineConfig({
],
/* Run your local dev server before starting the tests */
- webServer: {
+ webServer: !process.env.TRILIUM_DOCKER ? {
command: 'npm run integration-mem-db-dev',
url: SERVER_URL,
// reuseExistingServer: !process.env.CI,
- },
+ } : undefined,
});