2024-03-18 10:04:06 +03:00
|
|
|
import assert from 'node:assert';
|
|
|
|
|
2024-02-05 07:10:17 +03:00
|
|
|
import { testResultDir } from '@affine-test/kit/playwright';
|
2023-04-25 02:53:36 +03:00
|
|
|
import type { PlaywrightTestConfig } 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 = {
|
2023-07-03 13:46:47 +03:00
|
|
|
testDir: './e2e',
|
2023-04-25 02:53:36 +03:00
|
|
|
fullyParallel: true,
|
2024-08-09 10:33:15 +03:00
|
|
|
workers: 1,
|
2023-04-25 02:53:36 +03:00
|
|
|
timeout: process.env.CI ? 50_000 : 30_000,
|
2024-08-02 07:07:32 +03:00
|
|
|
expect: {
|
2024-08-05 06:11:44 +03:00
|
|
|
timeout: process.env.CI ? 15_000 : 5_000,
|
2024-08-02 07:07:32 +03:00
|
|
|
},
|
2024-02-05 07:10:17 +03:00
|
|
|
outputDir: testResultDir,
|
2023-04-25 02:53:36 +03:00
|
|
|
use: {
|
|
|
|
viewport: { width: 1440, height: 800 },
|
2024-08-02 07:07:32 +03:00
|
|
|
trace: 'on-first-retry',
|
2023-04-25 02:53:36 +03:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
if (process.env.CI) {
|
|
|
|
config.retries = 3;
|
|
|
|
config.workers = '50%';
|
|
|
|
}
|
|
|
|
|
2024-03-18 10:04:06 +03:00
|
|
|
if (process.env.DEV_SERVER_URL) {
|
|
|
|
const devServerUrl = new URL(process.env.DEV_SERVER_URL);
|
|
|
|
assert(
|
|
|
|
devServerUrl.origin === 'http://localhost:8080',
|
|
|
|
'DEV_SERVER_URL must be http://localhost:8080'
|
|
|
|
);
|
|
|
|
config.webServer = [
|
|
|
|
{
|
|
|
|
command: 'yarn run start:web-static',
|
|
|
|
port: 8080,
|
|
|
|
timeout: 120 * 1000,
|
|
|
|
reuseExistingServer: !process.env.CI,
|
|
|
|
env: {
|
|
|
|
COVERAGE: process.env.COVERAGE || 'false',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2023-04-25 02:53:36 +03:00
|
|
|
export default config;
|