enso/app/ide-desktop/lib/dashboard/playwright-component.config.ts
somebody1234 3c31155fe9
Dashboard tests (#7656)
- Implements https://github.com/enso-org/cloud-v2/issues/631
- Tests for dashboard (`app/ide-desktop/lib/dashboard/`):
- End-to-end tests
- Unit tests
- Component tests

The purpose of this PR is to introduce the testing framework - more tests can be added later in separate PRs.

# Important Notes
To test, run `npm run test` in `app/ide-desktop`, or `app/ide-desktop/lib/dashboard/`. All tests should pass.

Individual test types can be run using `npm run test-unit`, `npm run test-component` and `npm run test-e2e` in `app/ide-desktop/lib/dashboard/`.
Individual end-to-end tests can be run using `npx playwright test -c playwright-e2e.config.ts test-e2e/<file name>.spec.ts` in `app/ide-desktop/lib/dashboard/`.

End-to-end tests require internet access to pass (for things like fonts).

This PR *does* check in screenshots to guard against visual regessions (and/or to make visual changes obvious)
2023-10-11 10:24:33 +00:00

49 lines
1.6 KiB
TypeScript

/** @file Playwright component testing configuration. */
import * as componentTesting from '@playwright/experimental-ct-react'
import vitePluginYaml from '@modyfi/vite-plugin-yaml'
// This is an autogenerated file.
/* eslint-disable @typescript-eslint/strict-boolean-expressions, @typescript-eslint/no-magic-numbers */
export default componentTesting.defineConfig({
testDir: './test-component',
snapshotDir: './__snapshots__',
timeout: 10_000,
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
...(process.env.CI ? { workers: 1 } : {}),
projects: [
{
name: 'chromium',
use: { ...componentTesting.devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...componentTesting.devices['Desktop Firefox'] },
},
...(process.env.CI
? []
: [
{
name: 'webkit',
use: { ...componentTesting.devices['Desktop Safari'] },
},
]),
],
use: {
trace: 'on-first-retry',
ctPort: 3100,
ctViteConfig: {
plugins: [vitePluginYaml()],
define: {
// These are constants, and MUST be `CONSTANT_CASE`.
// eslint-disable-next-line @typescript-eslint/naming-convention
['REDIRECT_OVERRIDE']: 'undefined',
// eslint-disable-next-line @typescript-eslint/naming-convention
['process.env.NODE_ENV']: JSON.stringify('production'),
},
},
},
})