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

/**
 * Configuração Playwright para os testes de user-history (tests-e2e).
 *
 * Projeto isolado: aponta para o portal em execução via BASE_URL.
 * Roda em série (workers: 1) porque as histórias partilham o mesmo
 * banco de dados real do portal.
 */
export default defineConfig({
  testDir: './tests',
  timeout: 90_000,
  fullyParallel: false,
  workers: 1,
  retries: 1,

  reporter: [
    ['list'],
    ['html', { open: 'never', outputFolder: 'reports' }],
  ],

  use: {
    baseURL: process.env.BASE_URL ?? 'http://localhost:10011',
    viewport: { width: 1440, height: 900 },
    screenshot: 'only-on-failure',
    trace: 'retain-on-failure',
    video: 'retain-on-failure',
  },

  projects: [
    { name: 'chromium', use: { browserName: 'chromium' } },
  ],
});