Set up Scout in your plugin or package
This page shows the minimum setup to add Scout tests to a plugin/package. For choosing the right import (@kbn/scout vs solution packages), see Scout packages.
-
Generate a working scaffold
Generate a working scaffold (folders, configs, and sample tests) by following the guided setup:
node scripts/scout.js generateThis command will also automatically enable your plugin or package's Scout tests in the CI by updating the
.buildkite/scout_ci_config.ymlfile. -
Write and run tests
Tweak the new Playwright config(s) and write UI tests or API tests.
-
Create the folder layout
Create
test/scout:your-plugin/ └── test/ └── scout/ ├── ui/ ├── api/ └── common/- UI tests (optional)
- API tests (optional)
- shared code (optional)
-
Create Playwright config(s)
Create a config under
test/scout/uiand/ortest/scout/api.Create
playwright.config.ts:import { createPlaywrightConfig } from '@kbn/scout'; export default createPlaywrightConfig({ testDir: './tests', });ImportantUse the conventional name
playwright.config.tsso Scout tooling can discover the config.Then create the
tests/directory next to the config.If many files share one-time setup (archives/ingest/settings), add a global setup hook.
If your UI suites can be isolated, add
parallel.playwright.config.tsundertest/scout/uiand point it atparallel_tests/:import { createPlaywrightConfig } from '@kbn/scout'; export default createPlaywrightConfig({ testDir: './parallel_tests', workers: 2, });ImportantUse the conventional name
parallel.playwright.config.tsso Scout tooling can discover the config.Then create the
parallel_tests/directory next to the config. For parallel suites, prefer defining test suites and test cases usingspaceTestso each worker runs in an isolated Space (see Parallelism).If many files share one-time setup (archives/ingest/settings), add a global setup hook.
-
Enable Scout runs in CI
Ensure your plugin or package is listed in
.buildkite/scout_ci_config.ymlso Scout tests run in CI. If not already in the list, add one line under the appropriateenabledlist:- Plugins: Add
- <plugin_name>underplugins.enabled. The name is the path segment(s) afterplugins/(the plugin folder name, or a slash-separated path for nested plugins). - Packages: Add
- <package_name>underpackages.enabled. The name is the folder name afterpackages/.
plugins: enabled: - <plugin_name> disabled: packages: enabled: - <package_name> disabled: - Plugins: Add
-
Write and run tests
Tweak the new Playwright config(s) and write UI tests or API tests.