2025-03-26 12:59:39 +00:00
|
|
|
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'),
|
2025-03-26 12:59:39 +00:00
|
|
|
// 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/
|
2025-03-26 12:59:39 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'chromium',
|
|
|
|
|
use: {
|
2025-03-26 17:44:25 +00:00
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
|
storageState: 'src/test/integration/playwright/.auth/user.json',
|
2025-03-26 12:59:39 +00:00
|
|
|
},
|
|
|
|
|
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,
|
|
|
|
|
},
|
|
|
|
|
});
|