861e14503b
## Summary - Fix `isProductionDatabase()` to allow CI database (`euchre_camp_ci`) - Add database schema reset before CI test runs - Create `global.teardown.ts` for cleanup (CI: full reset, dev/prod: selective cleanup) - Add `acceptance-tests` job to PR workflow with CI database - Create `sync-prod-to-dev.js` script for one-way prod→dev sync - Add `just` recipes: `sync-dev`, `test-prod`, `reset-ci-db` - Store credentials in `.credentials` (gitignored) with unique CI user ## Testing Verified against CI database: - Schema reset works - Migrations apply correctly - Test users created successfully - 219 tests pass (slow but working) ## Next Steps - Set `CI_DATABASE_URL` as Gitea repository variable Reviewed-on: #35 Co-authored-by: David Gwilliam <dhgwilliam@gmail.com> Co-committed-by: David Gwilliam <dhgwilliam@gmail.com>
76 lines
2.2 KiB
TypeScript
76 lines
2.2 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
export default defineConfig({
|
|
testDir: './e2e',
|
|
timeout: 30000,
|
|
expect: {
|
|
timeout: 5000
|
|
},
|
|
// Run tests sequentially to avoid database conflicts
|
|
fullyParallel: false,
|
|
// Fail the build on CI if you accidentally left test.only in the source code.
|
|
forbidOnly: !!process.env.CI,
|
|
// Retry on CI only.
|
|
retries: process.env.CI ? 1 : 0,
|
|
// Use 2 workers in CI for parallel project execution; 1 locally
|
|
workers: process.env.CI ? 2 : 1,
|
|
// Reporter to use
|
|
reporter: 'html',
|
|
// Global setup and teardown
|
|
globalSetup: require.resolve('./e2e/global.setup'),
|
|
globalTeardown: require.resolve('./e2e/global.teardown'),
|
|
// Use base URL for relative navigation
|
|
use: {
|
|
baseURL: process.env.CI ? 'https://euchre-ci.notsosm.art' : 'http://localhost:3000',
|
|
// Collect trace when retrying the failed test.
|
|
trace: 'on-first-retry',
|
|
// Capture screenshot only on failure
|
|
screenshot: 'only-on-failure',
|
|
},
|
|
// Configure projects
|
|
projects: [
|
|
// Setup project - runs before all other projects
|
|
{
|
|
name: 'setup',
|
|
testMatch: /global\.setup\.ts/,
|
|
},
|
|
// Main Chromium project with regular user authentication
|
|
{
|
|
name: 'chromium',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
// Use prepared auth state for regular user tests
|
|
storageState: 'playwright/.auth/user.json',
|
|
},
|
|
dependencies: ['setup'],
|
|
},
|
|
// Admin user project
|
|
{
|
|
name: 'chromium-admin',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
// Use prepared auth state for admin tests
|
|
storageState: 'playwright/.auth/admin.json',
|
|
},
|
|
dependencies: ['setup'],
|
|
},
|
|
// Unauthenticated project - for tests that don't require login
|
|
{
|
|
name: 'chromium-unauth',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
// No authentication state
|
|
storageState: undefined,
|
|
},
|
|
dependencies: ['setup'],
|
|
},
|
|
],
|
|
// Run your local dev server before starting the tests
|
|
webServer: process.env.CI ? undefined : {
|
|
command: 'bun run dev',
|
|
url: 'http://localhost:3000',
|
|
timeout: 120000,
|
|
reuseExistingServer: !process.env.CI,
|
|
},
|
|
});
|