Skip to content

Modern Docker Management, Designed for Everyone

tests: add both sqlite and postgres e2e tests

Kyle Mendellc2a39c8099cf
diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml
index 047e1dca8..b17de0a51 100644
--- a/.github/workflows/e2e-tests.yml
+++ b/.github/workflows/e2e-tests.yml
@@ -57,6 +57,17 @@ jobs:
actions: write
runs-on: ubuntu-latest
needs: build
+ strategy:
+ fail-fast: false
+ matrix:
+ database:
+ - name: sqlite
+ compose_file: setup/compose.yaml
+ port: 3000
+ - name: postgres
+ compose_file: setup/compose-postgres.yaml
+ port: 3001
+ name: E2E Tests (${{ matrix.database.name }})
steps:
- uses: actions/checkout@v4
@@ -122,12 +133,15 @@ jobs:
- name: Run Playwright E2E tests
run: pnpm --filter arcane-tests test
+ env:
+ COMPOSE_FILE: ${{ matrix.database.compose_file }}
+ BASE_URL: http://localhost:${{ matrix.database.port }}
- name: Upload Playwright HTML report
if: always()
uses: actions/upload-artifact@v4
with:
- name: playwright-report
+ name: playwright-report-${{ matrix.database.name }}
path: tests/.report
include-hidden-files: true
retention-days: 15
diff --git a/tests/playwright.config.ts b/tests/playwright.config.ts
index baa4ff7a8..2a077aec6 100644
--- a/tests/playwright.config.ts
+++ b/tests/playwright.config.ts
@@ -1,6 +1,8 @@
import { defineConfig, devices } from '@playwright/test';
const authFile = '.auth/login.json';
+const baseURL = process.env.BASE_URL || 'http://localhost:3000';
+const composeFile = process.env.COMPOSE_FILE || 'setup/compose.yaml';
export default defineConfig({
testDir: '.',
@@ -12,7 +14,7 @@ export default defineConfig({
? [['html', { outputFolder: '.report' }], ['github']]
: [['line'], ['html', { open: 'never', outputFolder: '.report' }]],
use: {
- baseURL: 'http://localhost:3000',
+ baseURL,
trace: 'on-first-retry',
video: 'retain-on-failure',
},
@@ -29,8 +31,8 @@ export default defineConfig({
},
],
webServer: {
- command: 'docker compose -f setup/compose.yaml up --abort-on-container-exit',
- url: 'http://localhost:3000',
+ command: `docker compose -f ${composeFile} up --abort-on-container-exit`,
+ url: baseURL,
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
diff --git a/tests/setup/compose-postgres.yaml b/tests/setup/compose-postgres.yaml
new file mode 100644
index 000000000..ecc37a540
--- /dev/null
+++ b/tests/setup/compose-postgres.yaml
@@ -0,0 +1,41 @@
+services:
+ postgres:
+ image: postgres:17-alpine
+ environment:
+ POSTGRES_DB: arcane_test
+ POSTGRES_USER: arcane
+ POSTGRES_PASSWORD: arcane_test_password
+ volumes:
+ - postgres-data:/var/lib/postgresql/data
+ healthcheck:
+ test: ['CMD-SHELL', 'pg_isready -U arcane -d arcane_test']
+ interval: 2s
+ timeout: 5s
+ retries: 10
+
+ arcane:
+ image: arcane:playwright-tests
+ user: root
+ ports:
+ - '3001:3552'
+ environment:
+ - APP_ENV=test
+ - DATABASE_URL=postgres://arcane:arcane_test_password@postgres:5432/arcane_test?sslmode=disable
+ - ENCRYPTION_KEY=3JDIgolks2tJ9ymm1AdqzlYMWu0DUWyt
+ - JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ - arcane_data:/app/data
+ - ./projects:/app/data/projects
+ depends_on:
+ postgres:
+ condition: service_healthy
+ build:
+ args:
+ - BUILD_TAGS=playwright
+ context: ../..
+ dockerfile: Dockerfile
+
+volumes:
+ arcane_data:
+ postgres-data: