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

// Avoid Node warning: "NO_COLOR env is ignored due to FORCE_COLOR"
if (process.env.NO_COLOR !== undefined) {
  delete process.env.FORCE_COLOR;
}

export default defineConfig({
  testDir: './scripts',
  testMatch: /e2e-.*\.spec\.ts$/,
  fullyParallel: false,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: 1,
  reporter: 'list',
  timeout: 30000,
  use: {
    baseURL: process.env.EXPLORER_URL || 'https://blockscout.defi-oracle.io',
    trace: 'on-first-retry',
    screenshot: 'only-on-failure',
    video: 'on-first-retry',
  },
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },
  ],
});
