docs/extend/scout/parallelism.md
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. ::::::
scoutSpace fixture (used with spaceTest).:::::::::::{stepper}
::::::::::{step} Create a parallel config
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,
});
::::::::::
::::::::::{step} Pre-ingest shared data (recommended)
Use a global setup hook to load shared data once before workers start.
::::::::::
::::::::::{step} Use spaceTest (creates one Space per worker) or test (all workers use the default Space)
Use spaceTest to access scoutSpace (Scout will use a dedicated Space for each single parallel worker) or simply use test (Scout will reuse the default space for all workers):
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();
// ...
});
});
::::::::::
:::::::::::
API tests can run in parallel workers (set workers > 1 in your API Playwright config), but Scout does not provide Space-per-worker isolation for API tests. All parallel workers will reuse the same (default) Space.
If you run API tests in parallel, isolate state yourself:
workerInfo.parallelIndex in index/role/object names)afterAll / afterEachafterAll.