API-Explorer-II/playwright.config.ts

50 lines
1.3 KiB
TypeScript
Raw Normal View History

import { defineConfig, devices } from '@playwright/test';
import dotenv from 'dotenv';
import path from 'path';
// Read from ".env" file.
dotenv.config({ path: path.resolve(__dirname, '.env') });
export default defineConfig({
// Look for test files in the "tests" directory, relative to this configuration file.
testDir: 'src/test/integration',
globalSetup: require.resolve('./src/test/integration/global.setup.ts'),
2025-03-26 14:55:08 +00:00
globalTeardown: require.resolve('./src/test/integration/global.teardown.ts'),
// Reporter to use
reporter: 'html',
use: {
// Base URL to use in actions like `await page.goto('/')`.
baseURL: process.env.VITE_OBP_API_EXPLORER_HOST,
// Collect trace when retrying the failed test.
trace: 'on-first-retry',
},
// Configure projects for major browsers.
projects: [
{
name: 'setup',
2025-03-26 14:55:08 +00:00
testMatch: /.*\.setup\.ts/,
teardown: 'teardown',
},
{
name: 'teardown',
testMatch: /.*\.teardown\.ts/
},
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
},
dependencies: ['setup'],
},
],
// Run your local dev server before starting the tests.
webServer: {
command: 'vite',
url: process.env.VITE_OBP_API_EXPLORER_HOST,
reuseExistingServer: !process.env.CI,
},
});