Ghost/ghost/core/playwright.config.js
Steve Larson 78d2a5e3c0
🐛 Fixed flaky browser tests (#19929)
ref https://linear.app/tryghost/issue/CFR-13
- enabled saving traces on browser test failure; this makes troubleshooting a lot easier
- updated handling in offers tests to ensure the tier has fully loaded in the UI (not just `networkidle`)
- updated publishing test to examine the publish button reaction to the save action response instead of a 300ms pause

In general, our tests use a lot of watching for 'networkidle' - and sometimes just raw timeouts - which do not scale well into running tests on CI. In particular, 'networkidle' does not work if we're expecting to see React components' state updates propagate and re-render. We should always instead look to the content which encapsulates the response and the UI updates. This is something we should tackle on a larger scale.
2024-03-27 13:57:53 -05:00

36 lines
1.1 KiB
JavaScript

/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
timeout: 75 * 1000,
expect: {
timeout: 10000
},
// save trace on fail
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? '100%' : (process.env.PLAYWRIGHT_SLOWMO ? 1 : undefined),
reporter: process.env.CI ? [['list', {printSteps: true}], ['html']] : [['list', {printSteps: true}]],
use: {
trace: 'retain-on-failure',
// Use a single browser since we can't simultaneously test multiple browsers
browserName: 'chromium',
headless: !process.env.PLAYWRIGHT_DEBUG,
// Port doesn't matter, overriden by baseURL fixture for each worker
baseURL: 'http://127.0.0.1:2368'
},
// 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',
testDir: 'test/e2e-browser/portal',
fullyParallel: true
}
]
};
module.exports = config;