2022-12-01 03:34:19 +03:00
|
|
|
const {execSync} = require('child_process');
|
|
|
|
|
|
|
|
const getWebhookSecret = () => {
|
2022-12-02 18:46:59 +03:00
|
|
|
const command = `stripe listen --print-secret ${process.env.CI ? `--api-key ${process.env.STRIPE_SECRET_KEY}` : ''}`.trim();
|
2022-12-01 15:05:20 +03:00
|
|
|
const webhookSecret = execSync(command);
|
2022-12-01 03:34:19 +03:00
|
|
|
return webhookSecret.toString().trim();
|
|
|
|
};
|
|
|
|
|
2022-11-17 20:00:54 +03:00
|
|
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
2022-11-24 20:46:58 +03:00
|
|
|
|
2022-11-17 20:00:54 +03:00
|
|
|
const config = {
|
2022-11-24 18:11:40 +03:00
|
|
|
timeout: 60 * 1000,
|
2022-11-22 17:12:27 +03:00
|
|
|
workers: 1,
|
2022-11-17 20:00:54 +03:00
|
|
|
use: {
|
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,
|
2022-12-01 03:34:19 +03:00
|
|
|
baseURL: process.env.TEST_URL ?? 'http://localhost:2368',
|
|
|
|
// TODO: Where to put this
|
2022-12-01 04:30:24 +03:00
|
|
|
storageState: 'playwright-state.json'
|
2022-12-01 03:34:19 +03:00
|
|
|
},
|
|
|
|
globalSetup: './test/e2e-browser/utils/global-setup'
|
2022-11-24 20:46:58 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
if (!process.env.TEST_URL) {
|
|
|
|
config.webServer = {
|
2022-12-01 03:34:19 +03:00
|
|
|
// TODO: Replace yarn start
|
2022-11-24 18:11:40 +03:00
|
|
|
command: 'yarn start',
|
|
|
|
env: {
|
2022-12-01 03:34:19 +03:00
|
|
|
NODE_ENV: 'development',
|
|
|
|
WEBHOOK_SECRET: getWebhookSecret()
|
2022-11-24 18:11:40 +03:00
|
|
|
},
|
2022-12-05 16:39:10 +03:00
|
|
|
reuseExistingServer: false,
|
2022-11-24 18:11:40 +03:00
|
|
|
url: 'http://localhost:2368'
|
2022-11-24 20:46:58 +03:00
|
|
|
};
|
|
|
|
}
|
2022-11-17 20:00:54 +03:00
|
|
|
|
|
|
|
module.exports = config;
|