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

const port = Number(process.env.WEBSITE_PORT ?? '4321');
const baseURL = `http://127.0.0.1:${port}`;

export default defineConfig({
    testDir: './tests/smoke',
    fullyParallel: true,
    retries: process.env.CI ? 2 : 0,
    reporter: [['list']],
    use: {
        baseURL,
        trace: 'on-first-retry',
    },
    projects: [
        {
            name: 'chromium',
            use: {
                ...devices['Desktop Chrome'],
            },
        },
    ],
    webServer: {
        command: `WEBSITE_PORT=${port} corepack pnpm dev`,
        port,
        reuseExistingServer: !process.env.CI,
        timeout: 120000,
    },
});
