2023-03-17 10:51:00 +03:00
|
|
|
import { resolve } from 'node:path';
|
|
|
|
|
2023-03-07 14:24:41 +03:00
|
|
|
import type {
|
|
|
|
PlaywrightTestConfig,
|
|
|
|
PlaywrightWorkerOptions,
|
|
|
|
} from '@playwright/test';
|
2022-12-30 16:40:15 +03:00
|
|
|
// import { devices } from '@playwright/test';
|
2022-11-10 15:51:06 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Read environment variables from file.
|
|
|
|
* https://github.com/motdotla/dotenv
|
|
|
|
*/
|
|
|
|
// require('dotenv').config();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* See https://playwright.dev/docs/test-configuration.
|
|
|
|
*/
|
|
|
|
const config: PlaywrightTestConfig = {
|
2023-03-24 01:15:40 +03:00
|
|
|
testDir: './tests/parallels',
|
2023-03-07 14:24:41 +03:00
|
|
|
fullyParallel: true,
|
|
|
|
timeout: process.env.CI ? 50_000 : 30_000,
|
2022-11-10 15:51:06 +03:00
|
|
|
use: {
|
2023-03-17 10:51:00 +03:00
|
|
|
baseURL: 'http://localhost:8080/',
|
2023-03-07 14:24:41 +03:00
|
|
|
browserName:
|
|
|
|
(process.env.BROWSER as PlaywrightWorkerOptions['browserName']) ??
|
|
|
|
'chromium',
|
2022-12-30 16:40:15 +03:00
|
|
|
viewport: { width: 1440, height: 800 },
|
|
|
|
actionTimeout: 5 * 1000,
|
2023-02-06 17:26:01 +03:00
|
|
|
locale: 'en-US',
|
2022-12-30 16:40:15 +03:00
|
|
|
// 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/).
|
2022-11-10 15:51:06 +03:00
|
|
|
trace: 'on-first-retry',
|
2022-12-30 16:40:15 +03:00
|
|
|
// Record video only when retrying a test for the first time.
|
|
|
|
video: 'on-first-retry',
|
2022-11-10 15:51:06 +03:00
|
|
|
},
|
2022-12-30 16:40:15 +03:00
|
|
|
forbidOnly: !!process.env.CI,
|
2023-03-07 14:24:41 +03:00
|
|
|
workers: 4,
|
2023-03-31 05:00:19 +03:00
|
|
|
retries: 3,
|
2023-03-07 14:24:41 +03:00
|
|
|
// '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',
|
2022-11-10 15:51:06 +03:00
|
|
|
|
2023-03-17 10:51:00 +03:00
|
|
|
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',
|
|
|
|
},
|
2023-02-05 13:41:18 +03:00
|
|
|
},
|
2023-03-25 06:25:27 +03:00
|
|
|
{
|
2023-03-28 21:55:35 +03:00
|
|
|
// Intentionally not building the storybook, reminds you to run it by yourself.
|
|
|
|
command: 'yarn run start:storybook',
|
2023-03-25 06:25:27 +03:00
|
|
|
port: 6006,
|
|
|
|
timeout: 120 * 1000,
|
|
|
|
reuseExistingServer: !process.env.CI,
|
|
|
|
env: {
|
|
|
|
COVERAGE: process.env.COVERAGE || 'false',
|
|
|
|
ENABLE_DEBUG_PAGE: '1',
|
|
|
|
},
|
|
|
|
},
|
2023-03-17 10:51:00 +03:00
|
|
|
{
|
2023-03-20 10:05:02 +03:00
|
|
|
command: 'yarn build && yarn start -p 8080',
|
2023-03-17 10:51:00 +03:00
|
|
|
port: 8080,
|
|
|
|
timeout: 120 * 1000,
|
|
|
|
reuseExistingServer: !process.env.CI,
|
|
|
|
env: {
|
|
|
|
COVERAGE: process.env.COVERAGE || 'false',
|
|
|
|
ENABLE_DEBUG_PAGE: '1',
|
2023-04-03 14:13:43 +03:00
|
|
|
ENABLE_SUBPAGE: '1',
|
|
|
|
ENABLE_CHANGELOG: '1',
|
2023-04-12 08:26:42 +03:00
|
|
|
API_SERVER_PROFILE: 'local',
|
2023-03-17 10:51:00 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2022-11-10 15:51:06 +03:00
|
|
|
};
|
|
|
|
|
2023-03-07 14:24:41 +03:00
|
|
|
if (process.env.CI) {
|
|
|
|
config.retries = 3;
|
|
|
|
config.workers = '50%';
|
|
|
|
}
|
|
|
|
|
2022-11-10 15:51:06 +03:00
|
|
|
export default config;
|