feat(ci): run playwright for docker builds

This commit is contained in:
Elian Doran 2025-01-13 00:01:23 +02:00
parent 9fd8e4d030
commit e556137a25
No known key found for this signature in database
2 changed files with 15 additions and 4 deletions

View File

@ -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()

View File

@ -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,
});