Some checks failed
lotterLaravel CI / test (push) Has been cancelled
添加LOTTERY_E2E环境变量来控制E2E测试相关功能, 包括绕过验证码、登录限制和钱包API URL验证, 同时更新composer.json以包含E2E专用的提供者和服务。
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
const API_URL = process.env.PLAYWRIGHT_API_URL ?? 'http://127.0.0.1:8000';
|
|
const ADMIN_URL = process.env.PLAYWRIGHT_ADMIN_URL ?? 'http://localhost:3801';
|
|
const FRONT_URL = process.env.PLAYWRIGHT_FRONT_URL ?? 'http://localhost:3800';
|
|
const ARTIFACT_DIR = 'artifacts';
|
|
|
|
export default defineConfig({
|
|
testDir: './tests',
|
|
globalSetup: './global-setup.ts',
|
|
fullyParallel: false,
|
|
workers: 1,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 1 : 0,
|
|
reporter: [
|
|
['list'],
|
|
['json', { outputFile: `${ARTIFACT_DIR}/test-results/results.json` }],
|
|
['html', { outputFolder: `${ARTIFACT_DIR}/playwright-report`, open: 'never' }],
|
|
],
|
|
outputDir: `${ARTIFACT_DIR}/test-output`,
|
|
timeout: 60_000,
|
|
expect: { timeout: 10_000 },
|
|
use: {
|
|
trace: 'retain-on-failure',
|
|
screenshot: 'only-on-failure',
|
|
video: 'retain-on-failure',
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'api',
|
|
testMatch: 'tests/api/**/*.spec.ts',
|
|
use: {
|
|
baseURL: API_URL,
|
|
extraHTTPHeaders: { 'Accept-Language': 'zh-CN' },
|
|
...devices['Desktop Chrome'],
|
|
},
|
|
},
|
|
{
|
|
name: 'admin-ui',
|
|
testMatch: 'tests/ui/admin*.spec.ts',
|
|
use: {
|
|
baseURL: ADMIN_URL,
|
|
...devices['Desktop Chrome'],
|
|
},
|
|
},
|
|
{
|
|
name: 'front-ui',
|
|
testMatch: 'tests/ui/front*.spec.ts',
|
|
use: {
|
|
baseURL: FRONT_URL,
|
|
...devices['Desktop Chrome'],
|
|
},
|
|
},
|
|
],
|
|
});
|