mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
0ac587e94a
ref https://linear.app/ghost/issue/PLG-230 closes https://linear.app/ghost/issue/PLG-256 Adding an in-reply-to reference link/snippet to reply forms was proving difficult with the previous setup due the amount of data that needed to be passed up and down a deeply nested component tree. This refactor lays the groundwork for making that easier and aims to make form autoclose behaviour more centralised by keeping the open form state in app context and the opening/closing of forms in actions so there's less need for messy local state and to drill functions down the component tree. - replaces `openFormCount` context state with an `openCommentForms` array - keeping detailed open form references in the application state means the display of forms is centrally managed rather than managed via local state inside components - it simplifies some of the problems faced with the `<PublishedComment>` component that previously managed form display. That component is re-used for both the top-level comment as well as replies even though replying on a reply puts the top-level comment into reply mode meaning we had a mess of local state and passed-through functions to work around the component having varying behaviour depending on nesting level - `openFormCount` is still available on the application state via `useMemo` on the provider meaning the implementation of `openCommentForms` is hidden from app code that just needs to know if forms are open - removes `<AutocloseForm>` as the autoclose behaviour is now controlled via the `openCommentForm` action - updated `<Form>` so it manages the "has unsaved changes" properties on `openFormComments` ready for use by `openCommentForm`'s autoclosing behaviour
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import {defineConfig, devices} from '@playwright/test';
|
|
|
|
export const E2E_PORT = 7175;
|
|
|
|
/**
|
|
* See https://playwright.dev/docs/test-configuration.
|
|
*/
|
|
export default defineConfig({
|
|
testDir: './test/e2e',
|
|
/* Run tests in files in parallel */
|
|
fullyParallel: true,
|
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
forbidOnly: !!process.env.CI,
|
|
/* Retry on CI only */
|
|
retries: process.env.CI ? 2 : 0,
|
|
/* Hardcode to use all cores in CI */
|
|
workers: process.env.CI ? '100%' : undefined,
|
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
reporter: 'html',
|
|
timeout: process.env.PLAYWRIGHT_SLOWMO ? 100000 : 20000,
|
|
expect: {
|
|
timeout: process.env.PLAYWRIGHT_SLOWMO ? 100000 : 5000
|
|
},
|
|
|
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
use: {
|
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
launchOptions: {
|
|
slowMo: parseInt(process.env.PLAYWRIGHT_SLOWMO ?? '') || 0,
|
|
// force GPU hardware acceleration
|
|
// (even in headless mode)
|
|
args: ['--use-gl=egl']
|
|
}
|
|
},
|
|
|
|
/* Configure projects for major browsers */
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: {...devices['Desktop Chrome']}
|
|
},
|
|
|
|
...(process.env.ALL_BROWSERS ? [{
|
|
name: 'firefox',
|
|
use: {...devices['Desktop Firefox']}
|
|
},
|
|
|
|
{
|
|
name: 'webkit',
|
|
use: {...devices['Desktop Safari']}
|
|
}] : [])
|
|
],
|
|
|
|
/* Run local dev server before starting the tests */
|
|
webServer: {
|
|
command: `yarn dev:test`,
|
|
url: `http://localhost:${E2E_PORT}/comments-ui.min.js`,
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 20000
|
|
}
|
|
});
|