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

// Default to HTTPS since symfony serve uses TLS by default
process.env.APP_URL = process.env.APP_URL ?? 'http://localhost:8000';

export default defineConfig({
  testDir: './tests/acceptance_test',
  fullyParallel: false,
  retries: 1,
  workers: 1,
  timeout: 45000,
  expect: {
    timeout: 15000,
  },
  reporter: [
    ['list'],
    ['html', { outputFolder: 'tests/acceptance_test/reports', open: 'never' }],
  ],
  use: {
    trace: 'retain-on-failure',
    screenshot: process.env.PW_RECORD === '1' ? 'on' : 'only-on-failure',
    video: process.env.PW_RECORD === '1' ? 'on' : 'off',
    headless: true,
    ignoreHTTPSErrors: true,
    navigationTimeout: 30000,
    actionTimeout: 15000,
  },
  projects: [
    {
      name: 'front',
      testDir: './tests/acceptance_test/front',
    },
    {
      name: 'wfbo',
      testDir: './tests/acceptance_test/wfbo',
    },
  ],
});
