mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-27 07:32:08 +03:00
91 lines
2.6 KiB
TypeScript
91 lines
2.6 KiB
TypeScript
import { resolve } from 'node:path';
|
|
|
|
import type {
|
|
PlaywrightTestConfig,
|
|
PlaywrightWorkerOptions,
|
|
} from '@playwright/test';
|
|
// import { devices } from '@playwright/test';
|
|
|
|
/**
|
|
* Read environment variables from file.
|
|
* https://github.com/motdotla/dotenv
|
|
*/
|
|
// require('dotenv').config();
|
|
|
|
/**
|
|
* See https://playwright.dev/docs/test-configuration.
|
|
*/
|
|
const config: PlaywrightTestConfig = {
|
|
testDir: './tests/parallels',
|
|
fullyParallel: true,
|
|
timeout: process.env.CI ? 50_000 : 30_000,
|
|
use: {
|
|
baseURL: 'http://localhost:8080/',
|
|
browserName:
|
|
(process.env.BROWSER as PlaywrightWorkerOptions['browserName']) ??
|
|
'chromium',
|
|
permissions: ['clipboard-read', 'clipboard-write'],
|
|
viewport: { width: 1440, height: 800 },
|
|
actionTimeout: 5 * 1000,
|
|
locale: 'en-US',
|
|
// Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer
|
|
// You can open traces locally(`npx playwright show-trace trace.zip`)
|
|
// or in your browser on [Playwright Trace Viewer](https://trace.playwright.dev/).
|
|
trace: 'on-first-retry',
|
|
// Record video only when retrying a test for the first time.
|
|
video: 'on-first-retry',
|
|
},
|
|
forbidOnly: !!process.env.CI,
|
|
workers: 4,
|
|
retries: 1,
|
|
// 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot'
|
|
// default 'list' when running locally
|
|
// See https://playwright.dev/docs/test-reporters#github-actions-annotations
|
|
reporter: process.env.CI ? 'github' : 'list',
|
|
|
|
webServer: [
|
|
{
|
|
command: 'cargo run -p affine-cloud',
|
|
port: 3000,
|
|
timeout: 10 * 1000,
|
|
reuseExistingServer: true,
|
|
cwd: process.env.OCTOBASE_CWD ?? resolve(process.cwd(), 'apps', 'server'),
|
|
env: {
|
|
SIGN_KEY: 'test123',
|
|
RUST_LOG: 'debug',
|
|
JWST_DEV: '1',
|
|
},
|
|
},
|
|
{
|
|
// Intentionally not building the storybook, reminds you to run it by yourself.
|
|
command: 'yarn run start:storybook',
|
|
port: 6006,
|
|
timeout: 120 * 1000,
|
|
reuseExistingServer: !process.env.CI,
|
|
env: {
|
|
COVERAGE: process.env.COVERAGE || 'false',
|
|
ENABLE_DEBUG_PAGE: '1',
|
|
},
|
|
},
|
|
// Intentionally not building the web, reminds you to run it by yourself.
|
|
{
|
|
command: 'yarn start -p 8080',
|
|
port: 8080,
|
|
timeout: 120 * 1000,
|
|
reuseExistingServer: !process.env.CI,
|
|
env: {
|
|
COVERAGE: process.env.COVERAGE || 'false',
|
|
ENABLE_DEBUG_PAGE: '1',
|
|
API_SERVER_PROFILE: 'local',
|
|
},
|
|
},
|
|
],
|
|
};
|
|
|
|
if (process.env.CI) {
|
|
config.retries = 3;
|
|
config.workers = '50%';
|
|
}
|
|
|
|
export default config;
|