0ab652b768
refs https://github.com/TryGhost/Toolbox/issues/479 - e2e and integration test suites are running on port 2369. Playwright was not following this convention, without good reason. - Port 2368 is the default port for development and production processes, so using it for test environment is not ideal
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
const {execSync} = require('child_process');
|
|
|
|
const getWebhookSecret = () => {
|
|
const command = `stripe listen --print-secret ${process.env.CI ? `--api-key ${process.env.STRIPE_SECRET_KEY}` : ''}`.trim();
|
|
const webhookSecret = execSync(command);
|
|
return webhookSecret.toString().trim();
|
|
};
|
|
|
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
|
|
|
const config = {
|
|
timeout: 60 * 1000,
|
|
workers: 1,
|
|
use: {
|
|
// Use a single browser since we can't simultaneously test multiple browsers
|
|
browserName: 'chromium',
|
|
headless: !process.env.PLAYWRIGHT_DEBUG,
|
|
baseURL: process.env.TEST_URL ?? 'http://localhost:2369',
|
|
// TODO: Where to put this
|
|
storageState: 'playwright-state.json'
|
|
},
|
|
globalSetup: './test/e2e-browser/utils/global-setup'
|
|
};
|
|
|
|
if (!process.env.TEST_URL) {
|
|
config.webServer = {
|
|
// TODO: Replace yarn start
|
|
command: 'yarn start',
|
|
env: {
|
|
NODE_ENV: 'development',
|
|
WEBHOOK_SECRET: getWebhookSecret()
|
|
},
|
|
reuseExistingServer: false,
|
|
url: 'http://localhost:2369'
|
|
};
|
|
}
|
|
|
|
module.exports = config;
|