Pulse/tests/integration/playwright.config.ts
rcourtman f907440f6b fix(ai): improve AI settings UX with validation and smart fallbacks
Backend:
- Add smart provider fallback when selected model's provider isn't configured
- Automatically switch to a model from a configured provider instead of failing
- Log warning when fallback occurs for visibility

Frontend (AISettings.tsx):
- Add helper functions to check if model's provider is configured
- Group model dropdown: configured providers first, unconfigured marked with ⚠️
- Add inline warning when selecting model from unconfigured provider
- Validate on save that model's provider is configured (or being added)
- Warn before clearing last configured provider (would disable AI)
- Warn before clearing provider that current model uses
- Add patrol interval validation (must be 0 or >= 10 minutes)
- Show red border + inline error for invalid patrol intervals 1-9
- Update patrol interval hint: '(0=off, 10+ to enable)'

These changes prevent confusing '500 Internal Server Error' and
'AI is not enabled or configured' errors when model/provider mismatch.
2025-12-17 18:30:19 +00:00

84 lines
2.1 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
/**
* Playwright configuration for Pulse update integration tests
* See https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
testDir: './tests',
/* Run tests in files in parallel */
fullyParallel: false, // Update tests should run sequentially
/* 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 ? 2 : 0,
/* Opt out of parallel tests on CI */
workers: 1, // Update tests modify global state
/* Reporter to use */
reporter: [
['html', { outputFolder: 'playwright-report' }],
['list'],
['junit', { outputFile: 'test-results/junit.xml' }]
],
/* Shared test timeout */
timeout: 60000, // Updates can take time
expect: {
timeout: 10000,
},
/* Shared settings for all projects */
use: {
/* Base URL for all tests */
baseURL: process.env.PULSE_BASE_URL || process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:7655',
/* Allow testing against self-signed TLS when explicitly enabled */
ignoreHTTPSErrors: ['1', 'true', 'yes', 'on'].includes(
String(process.env.PULSE_E2E_INSECURE_TLS || '').trim().toLowerCase(),
),
/* Collect trace when retrying the failed test */
trace: 'on-first-retry',
/* Screenshot on failure */
screenshot: 'only-on-failure',
/* Video on failure */
video: 'retain-on-failure',
/* Default navigation timeout */
navigationTimeout: 15000,
/* Default action timeout */
actionTimeout: 10000,
},
/* Configure projects for different browsers */
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
},
},
// Uncomment to test on Firefox and WebKit
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
],
/* Run local dev server before starting the tests */
// We use docker-compose instead, managed via npm scripts
webServer: undefined,
});