import { defineConfig, devices } from '@playwright/test';

/**
 * Playwright E2E config cho Canifa AI Backend Static Pages
 * Test Lead Flow, Product Description, và các trang admin.
 */
export default defineConfig({
  testDir: '.',
  timeout: 60000,
  fullyParallel: false,   // Run sequentially — pages share state
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: 1,
  reporter: [['html', { open: 'never' }], ['list']],
  use: {
    baseURL: process.env.BASE_URL || 'http://localhost:5000',
    trace: 'on-first-retry',
    screenshot: 'only-on-failure',
    video: 'retain-on-failure',
  },
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },
  ],
});
