Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

1.3 KB
Raw Blame
/// <reference types="node" />
import { defineConfig, type ReporterDescription } from '@playwright/test';
import { BASE_URL as baseURL } from './tests/api/paths';

/**
 * Playwright config for the API integration suite (tests/api).
 *
 * The suite only uses the `request` fixture — no browser is launched. It expects
 * a running umami server (normally started by scripts/test-api.ts via
 * docker-compose.test.yml) at PLAYWRIGHT_BASE_URL or http://localhost:3100.
 */

const reporters: ReporterDescription[] = [['list'], ['./tests/api/coverage/reporter.ts']];

if (process.env.CI) {
  reporters.push(['html', { open: 'never', outputFolder: 'playwright-report/api' }]);
}

export default defineConfig({
  testDir: './tests/api',
  testMatch: '**/*.spec.ts',
  outputDir: 'test-results/api',
  // Specs share one seeded database and a few mutable globals (the shared users,
  // the global 2FA requirement toggled by admin.spec.ts), so they must run serially.
  fullyParallel: false,
  workers: 1,
  // Specs are deterministic and share coverage state; retries would only hide flakes.
  retries: 0,
  forbidOnly: !!process.env.CI,
  timeout: 30_000,
  globalSetup: './tests/api/global-setup.ts',
  reporter: reporters,
  use: {
    baseURL,
    trace: 'off',
  },
  projects: [{ name: 'api' }],
});