2022-11-17 20:00:54 +03:00
|
|
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
2024-10-24 21:15:08 +03:00
|
|
|
const os = require('os');
|
|
|
|
|
|
|
|
const getWorkerCount = () => {
|
|
|
|
if (process.env.CI) {
|
|
|
|
return '100%';
|
|
|
|
}
|
|
|
|
if (process.env.PLAYWRIGHT_SLOWMO) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
let cpuCount;
|
|
|
|
try {
|
|
|
|
cpuCount = os.cpus().length;
|
|
|
|
} catch (err) {
|
|
|
|
cpuCount = 1;
|
|
|
|
}
|
|
|
|
// Stripe limits to 5 new accounts per second
|
|
|
|
// If we go higher than 5, we'll get rate limited and tests will fail
|
|
|
|
return Math.min(5, cpuCount - 1);
|
|
|
|
};
|
2022-11-24 20:46:58 +03:00
|
|
|
|
2022-11-17 20:00:54 +03:00
|
|
|
const config = {
|
2024-02-21 20:47:44 +03:00
|
|
|
timeout: 75 * 1000,
|
2023-02-22 14:54:26 +03:00
|
|
|
expect: {
|
|
|
|
timeout: 10000
|
|
|
|
},
|
2024-03-27 21:57:53 +03:00
|
|
|
// save trace on fail
|
2023-10-13 14:42:39 +03:00
|
|
|
retries: process.env.CI ? 2 : 0,
|
2024-10-24 21:15:08 +03:00
|
|
|
workers: getWorkerCount(),
|
2023-10-13 14:42:39 +03:00
|
|
|
reporter: process.env.CI ? [['list', {printSteps: true}], ['html']] : [['list', {printSteps: true}]],
|
2022-11-17 20:00:54 +03:00
|
|
|
use: {
|
2024-03-27 21:57:53 +03:00
|
|
|
trace: 'retain-on-failure',
|
2022-11-24 18:11:40 +03:00
|
|
|
// Use a single browser since we can't simultaneously test multiple browsers
|
2022-11-22 17:12:27 +03:00
|
|
|
browserName: 'chromium',
|
2022-12-01 04:30:24 +03:00
|
|
|
headless: !process.env.PLAYWRIGHT_DEBUG,
|
2023-10-13 14:42:39 +03:00
|
|
|
// Port doesn't matter, overriden by baseURL fixture for each worker
|
|
|
|
baseURL: 'http://127.0.0.1:2368'
|
2022-12-01 03:34:19 +03:00
|
|
|
},
|
2023-03-16 17:34:11 +03:00
|
|
|
// separated tests to projects for better logging to console
|
|
|
|
// portal tests are much more stable when running in the separate DB from admin tests
|
|
|
|
projects: [
|
|
|
|
{
|
|
|
|
name: 'admin',
|
|
|
|
testDir: 'test/e2e-browser/admin'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'portal',
|
2023-10-13 14:42:39 +03:00
|
|
|
testDir: 'test/e2e-browser/portal',
|
|
|
|
fullyParallel: true
|
2023-03-16 17:34:11 +03:00
|
|
|
}
|
2023-10-13 14:42:39 +03:00
|
|
|
]
|
2022-11-24 20:46:58 +03:00
|
|
|
};
|
|
|
|
|
2022-11-17 20:00:54 +03:00
|
|
|
module.exports = config;
|