- Replace 'any' types with proper TypeScript interfaces in auth setup/teardown - Remove conflicting custom Playwright type declarations that were overriding official types - Fix ES module compatibility by replacing require() with proper import paths - Add proper generic typing to Playwright test fixtures - Fix test discovery in auth debug configuration - Add comprehensive auth debug setup documentation Fixes: - 3 lint warnings about explicit 'any' usage - 45+ TypeScript compilation errors from type conflicts - ES module import errors in auth configuration - Test fixture typing issues All e2e tests now pass lint and type checking with zero warnings.
159 lines
4.1 KiB
TypeScript
159 lines
4.1 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
/**
|
|
* Specialized Playwright configuration for authentication debug tests
|
|
* Optimized for debugging auth flows with extended timeouts and detailed reporting
|
|
*/
|
|
export default defineConfig({
|
|
testDir: './',
|
|
testMatch: 'tests/e2e/auth-debug.spec.ts',
|
|
|
|
/* Run tests in files in parallel */
|
|
fullyParallel: false, // Auth tests should run sequentially to avoid conflicts
|
|
|
|
/* 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: process.env.CI ? 1 : 1, // Auth tests work better with single worker
|
|
|
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
reporter: [
|
|
['html', { outputFolder: 'playwright-report-auth' }],
|
|
['json', { outputFile: 'playwright-report-auth.json' }],
|
|
['list'],
|
|
['junit', { outputFile: 'playwright-auth-results.xml' }],
|
|
],
|
|
|
|
/* Shared settings for all the projects below. */
|
|
use: {
|
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
baseURL: 'http://localhost:8080',
|
|
|
|
/* Collect trace when retrying the failed test. */
|
|
trace: 'retain-on-failure',
|
|
|
|
/* Take screenshot on failure */
|
|
screenshot: 'only-on-failure',
|
|
|
|
/* Record video on failure */
|
|
video: 'retain-on-failure',
|
|
|
|
/* Extended timeouts for auth operations */
|
|
actionTimeout: 15000,
|
|
navigationTimeout: 30000,
|
|
|
|
/* Ignore HTTPS errors */
|
|
ignoreHTTPSErrors: true,
|
|
|
|
/* Accept downloads */
|
|
acceptDownloads: false,
|
|
|
|
/* Viewport settings */
|
|
viewport: { width: 1280, height: 720 },
|
|
|
|
/* Locale for testing */
|
|
locale: 'en-US',
|
|
|
|
/* Timezone for consistent testing */
|
|
timezoneId: 'America/New_York',
|
|
},
|
|
|
|
/* Configure projects for major browsers */
|
|
projects: [
|
|
{
|
|
name: 'auth-debug-chromium',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
// Additional Chrome flags for debugging
|
|
launchOptions: {
|
|
args: [
|
|
'--disable-web-security',
|
|
'--disable-features=VizDisplayCompositor',
|
|
'--no-sandbox',
|
|
'--disable-dev-shm-usage',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
|
|
{
|
|
name: 'auth-debug-firefox',
|
|
use: {
|
|
...devices['Desktop Firefox'],
|
|
// Firefox specific settings
|
|
launchOptions: {
|
|
firefoxUserPrefs: {
|
|
'security.tls.insecure_fallback_hosts': 'localhost',
|
|
'network.stricttransportsecurity.preloadlist': false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
{
|
|
name: 'auth-debug-webkit',
|
|
use: { ...devices['Desktop Safari'] },
|
|
},
|
|
|
|
/* Test against mobile viewports for responsive auth */
|
|
{
|
|
name: 'auth-debug-mobile-chrome',
|
|
use: { ...devices['Pixel 5'] },
|
|
},
|
|
{
|
|
name: 'auth-debug-mobile-safari',
|
|
use: { ...devices['iPhone 12'] },
|
|
},
|
|
],
|
|
|
|
/* Global setup and teardown */
|
|
globalSetup: './auth-debug-setup.ts',
|
|
globalTeardown: './auth-debug-teardown.ts',
|
|
|
|
/* Test timeout for auth operations */
|
|
timeout: 60000, // 1 minute per test
|
|
expect: {
|
|
timeout: 10000, // 10 seconds for assertions
|
|
},
|
|
|
|
/* Run your local dev server before starting the tests */
|
|
webServer: [
|
|
{
|
|
command: 'bun run dev',
|
|
port: 8080,
|
|
timeout: 120000,
|
|
reuseExistingServer: !process.env.CI,
|
|
stdout: 'pipe',
|
|
stderr: 'pipe',
|
|
env: {
|
|
NODE_ENV: 'test',
|
|
VITE_COUCHDB_URL: 'http://localhost:5984',
|
|
VITE_COUCHDB_USERNAME: 'admin',
|
|
VITE_COUCHDB_PASSWORD: 'password',
|
|
},
|
|
},
|
|
{
|
|
command: 'docker-compose -f docker/docker-compose.yaml up -d',
|
|
timeout: 60000,
|
|
reuseExistingServer: !process.env.CI,
|
|
},
|
|
],
|
|
|
|
/* Output directories */
|
|
outputDir: 'test-results-auth/',
|
|
|
|
/* Metadata for reporting */
|
|
metadata: {
|
|
testType: 'Authentication Debug',
|
|
environment: process.env.NODE_ENV || 'test',
|
|
version: process.env.APP_VERSION || 'development',
|
|
author: 'Medication Reminder App Team',
|
|
description:
|
|
'Comprehensive authentication flow debugging and validation tests',
|
|
},
|
|
});
|