Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/skills/scout-api-testing/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ description: Use when creating, updating, debugging, or reviewing Scout API test
- `x-pack/solutions/search/**` -> `@kbn/scout-search`
- `x-pack/solutions/security/**` -> `@kbn/scout-security`
- Prefer a single top-level `apiTest.describe(...)` per file and avoid nested `describe` blocks; multiple top-level `describe`s are supported, but files get hard to read quickly.
- Tags: add `{ tag: ... }` on the suite (or individual tests) so CI/discovery can select the right test target (for example `tags.deploymentAgnostic` or `[...tags.stateful.classic]`). Unlike UI tests, API tests don’t currently validate tags at runtime.
- Tags: add `{ tag: ... }` on the suite (or individual tests) so CI/discovery can select the right test target. For **solution** modules, prefer explicit targets (e.g. `[...tags.stateful.classic, ...tags.serverless.observability.complete]` in Observability); reserve `tags.deploymentAgnostic` mainly for **platform** specs that truly need every deployment-agnostic target (see `scout-migrate-from-ftr`). Unlike UI tests, API tests don’t currently validate tags at runtime.
Copy link
Copy Markdown
Member

@csr csr Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point on the deployment agnostic tag, I've updated the docs to reflect this info too: #260229

(will continue the review as soon I find the time)

- If the module provides Scout fixtures, import `apiTest` from `<module-root>/test/scout*/api/fixtures` to get module-specific extensions. Importing directly from the module’s Scout package is also fine when you don’t need extensions.
- Browser fixtures are disabled for `apiTest` (no `page`, `browserAuth`, `pageObjects`).

Expand Down
31 changes: 31 additions & 0 deletions .agents/skills/scout-create-scaffold/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ description: Generate or repair a Scout test scaffold for a Kibana plugin/packag

# Create Scout Scaffold (Generator-First)

## Related skills

- **`scout-migrate-from-ftr`** — After generating files, wire TypeScript for CI using **Pattern A** or **Pattern B** (*Where Scout tests are typechecked* in that skill). This skill documents layout; the migration skill has the full rules (relative imports, `kbn_references`, `node scripts/type_check --project …`).

## Inputs to Collect

- Module root (repo-relative path to the plugin/package directory, e.g. `x-pack/platform/plugins/shared/maps`)
Expand Down Expand Up @@ -59,6 +63,33 @@ Notes:
- `test/<scout-root>/ui/parallel_tests/example_two.spec.ts`
- `test/<scout-root>/ui/parallel_tests/global.setup.ts`

The generator **does not** create **`tsconfig.json`** files. Playwright runs without them, but **`node scripts/type_check`** (CI) must still include Scout specs in a TS project—see **TypeScript layout** below.

## TypeScript layout (`check_types`)

Pick **one** pattern and wire it after `scout.js generate` completes:

### Pattern A — plugin root includes Scout (e.g. `discover_enhanced`)

- In the **plugin or package root** `tsconfig.json`, add **`test/<scout-root>/**/*`** (or broader **`test/**/*`**) to **`include`**.
- Add **`kbn_references`** for the Scout stack you use:
- Platform / generic: **`@kbn/scout`**.
- Observability: **`@kbn/scout-oblt`**; for API tests using synthtrace workers, also **`@kbn/scout-synthtrace`**, **`@kbn/synthtrace-client`** (and **`@kbn/rison`** for UI if needed).
- Match sibling plugins in the same solution for consistency.
- **Do not** add nested `test/<scout-root>/{ui,api}/tsconfig.json` when using this pattern (one program for plugin + Scout).
- **Allows** relative imports from specs/fixtures into **`server/`** or **`common/`** when the test needs shared registration constants or light server utilities.

### Pattern B — dedicated `tsconfig.json` under `test/<scout-root>/{ui,api}/`

- Add **`test/<scout-root>/api/tsconfig.json`** and/or **`test/<scout-root>/ui/tsconfig.json`** with **`extends`**, **`include`**: `["**/*"]`, and scoped **`kbn_references`** (see SLO, `data_views`, infra Scout modules for examples).
- Keeps the **main** plugin typecheck smaller.
- **Does not** allow relative imports that climb into **`../../../../server/...`** or **`public/...`** from those folders—TypeScript will treat `server/**` as part of the wrong composite project (`TS6059` / `TS6307`). Use **`fixtures/constants.ts`**, **`common/`**, or switch to **Pattern A**.

### After wiring either pattern

1. Run **`yarn kbn bootstrap`** so `packages/kbn-ts-projects/config-paths.json` picks up added or removed `tsconfig.json` paths.
2. Validate with **`node scripts/type_check --project <path-to-tsconfig.json>`** (plugin root `tsconfig.json` for **A**, or `test/<scout-root>/api/tsconfig.json` / UI sibling for **B**).

## After Generating

- Custom server config sets:
Expand Down
Loading
Loading