import { defineConfig, devices } from '@playwright/test'; import { getEnvironmentConfig } from './tests/helpers/environment'; /** * Playwright configuration for PassDashboard test automation * @see https://playwright.dev/docs/test-configuration * * Environment (dev/staging/production) and credentials are resolved once, * centrally, in tests/helpers/environment.ts - see that file and * .env.test.example for how to switch environments locally or in CI. */ const env = getEnvironmentConfig(); console.log(`[playwright.config] Running against ${env.envName} (${env.baseURL})`); export default defineConfig({ testDir: './tests', fullyParallel: false, forbidOnly: !!process.env.CI, retries: 2, workers: 1, reporter: [ ['html'], ['allure-playwright', { outputFolder: 'allure-results', detail: true, suiteTitle: true, }], ], use: { baseURL: env.baseURL, trace: 'off', screenshot: 'off', video: 'off', actionTimeout: 30000, navigationTimeout: 90000, // Pin the browser clock to the platform's market timezone (UTC+3). // The report date range is timezone-sensitive: picking 2026-07-31 on a // UTC machine made the app request 2026-08-01 instead, which comes back // 204 No Content, so no file ever downloads. CI runners are UTC while // developers here run UTC+3, which is exactly why these download tests // passed locally and failed only in CI. Pinning it makes both agree and // matches how the product is actually used. timezoneId: 'Asia/Riyadh', }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] }, // Run terminals before management so removed cashier frees up a terminal testMatch: [ '**/auth.spec.ts', '**/dashboard.spec.ts', '**/terminals.spec.ts', '**/transactions.spec.ts', '**/discounts.spec.ts', '**/refunds.spec.ts', '**/settlement.spec.ts', '**/management.spec.ts', '**/settings.spec.ts', '**/roles.spec.ts', ], }, ], });