Parallelism
Scout supports parallel execution using Playwright workers. Parallel runs are usually faster, but they require good isolation and predictable setup.
Note
Parallelism happens at the file level: Playwright runs test files in parallel workers. Tests in the same file still run in order.
- All workers share the same Kibana + Elasticsearch deployment.
- Each worker gets an isolated Kibana space via the
scoutSpacefixture (used withspaceTest). - The space is cleaned up when the worker finishes.
- Parallel: UI suites that can share pre-ingested data and isolate state per space.
- Sequential: suites that require a “clean” cluster state or need global mutations that aren’t space-scoped.
Add a config that points at a parallel_tests/ directory and sets workers:
import { createPlaywrightConfig } from '@kbn/scout';
export default createPlaywrightConfig({
testDir: './parallel_tests',
workers: 2,
runGlobalSetup: true,
});
Use a global setup hook to load shared data once before workers start.
Use spaceTest to access scoutSpace:
import { spaceTest, tags } from '@kbn/scout';
spaceTest.describe('My parallel suite', { tag: tags.deploymentAgnostic }, () => {
spaceTest.beforeAll(async ({ scoutSpace }) => {
// space-scoped setup (saved objects, ui settings, ...)
});
spaceTest('does something', async ({ pageObjects, browserAuth }) => {
await browserAuth.loginAsViewer();
// ...
});
});
Parallel execution for API tests is not currently supported.
- Load shared ES data once (global setup) and avoid mutating it in tests.
- Clean up space-scoped changes (saved objects / UI settings) in
afterAll. - If a suite can’t be isolated, keep it sequential.