
Scout Ui Testing
- 2 installs
- 21.2k repo stars
- Updated August 5, 2026
- elastic/kibana
scout-ui-testing skill documents Use when creating, updating, debugging, or reviewing Scout UI tests in Kibana (Playwright + Scout fixtures), including page objects, browser authentication, parallel UI tests (spaceTest/s
About
scout-ui-testing skill documents Use when creating, updating, debugging, or reviewing Scout UI tests in Kibana (Playwright + Scout fixtures), including page objects, browser authentication, parallel UI tests (spaceTest/scoutSpace), a11y checks, and flake control.. name: scout-ui-testing description: Use when creating, updating, debugging, or reviewing Scout UI tests in Kibana (Playwright + Scout fixtures), including page objects, browser authentication, parallel UI tests (spaceTest/scoutSpace), a11y checks, and flake control.
- Use when creating, updating, debugging, or reviewing Scout UI tests in Kibana (Playwright + Scout fixtures), including p
- Use APIs for setup/teardown: prefer `apiServices`/`kbnClient`/`esArchiver` in hooks over clicking through the UI.
- Platform-specific setup patterns for scout-ui-testing.
- Evidence-backed steps from upstream SKILL.md.
- When-to-use criteria for scout-ui-testing versus alternatives.
Scout Ui Testing by the numbers
- 2 all-time installs (skills.sh)
- Ranked #1,788 of 2,203 Security skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
scout-ui-testing capabilities & compatibility
- Capabilities
- scout ui testing quick start · scout ui testing when to use guidance · scout ui testing integration patterns
- Works with
- elasticsearch
- Use cases
- security audit
What scout-ui-testing says it does
**Sequential UI**: `<module-root>/test/scout*/ui/tests/**/*.spec.ts`.
Use the Scout package that matches the module root:
npx skills add https://github.com/elastic/kibana --skill scout-ui-testingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 2 |
|---|---|
| repo stars | ★ 21.2k |
| Last updated | August 5, 2026 |
| Repository | elastic/kibana ↗ |
How do I use scout-ui-testing correctly?
Use when creating, updating, debugging, or reviewing Scout UI tests in Kibana (Playwright + Scout fixtures), including page objects, browser authentication, parallel UI tests (spaceTest/scoutSpace), a
Who is it for?
Teams implementing scout-ui-testing workflows from the catalog.
Skip if: Skip when requirements clearly match a different specialized stack.
When should I use this skill?
User asks about scout-ui-testing, use when creating, updating, debugging, or reviewing scout ui tests in kibana (playwright .
What you get
Working scout-ui-testing setup with validated configuration and next steps.
Files
Scout UI Testing
Pick the right test mode
- Sequential UI:
<module-root>/test/scout*/ui/tests/**/*.spec.ts. - Parallel UI:
<module-root>/test/scout*/ui/parallel_tests/**/*.spec.tsand (recommended) usespaceTest+scoutSpace(one Kibana space per worker). If you run withworkers > 1but keep usingtest, you won't get space isolation. - Use the Scout package that matches the module root:
src/platform/**orx-pack/platform/**->@kbn/scoutx-pack/solutions/observability/**->@kbn/scout-obltx-pack/solutions/search/**->@kbn/scout-searchx-pack/solutions/security/**->@kbn/scout-security
Imports
- Test framework + tags:
import { tags } from '@kbn/scout';(or the module's Scout package) - Test fixture:
import { test } from '../fixtures';(orimport { test } from '@kbn/scout';when not extending) - Assertions:
import { expect } from '@kbn/scout/ui';(or@kbn/scout-oblt/ui, etc.) — not from the main entry expectis not exported from the main@kbn/scoutentry. Use the/uisubpath for UI tests.
Non-negotiable conventions
- Tags are required: Scout validates UI test tags at runtime. Ensure each test has at least one supported tag (typically by tagging the top-level
test.describe(...)/spaceTest.describe(...), e.g.tags.deploymentAgnostic,tags.stateful.classic, ortags.performance). - No `@` in test titles: Playwright treats
@wordin test/describe titles as tags. Do not use@followed by word characters in titles (e.g.,@timestamp,@elastic). This causes Scout tag validation to fail with "Unsupported tag(s) found". Rephrase the title instead (e.g., usetimestamp fieldinstead of@timestamp). - Prefer one suite per file: keep a single top-level
test.describe(...)(sequential) orspaceTest.describe(...)(parallel) and avoid nesteddescribeblocks where possible. - UI actions live in page objects; assertions stay in the spec.
- Use APIs for setup/teardown: prefer
apiServices/kbnClient/esArchiverin hooks over clicking through the UI.
Auth (UI)
- Use
browserAuth— available methods:loginAsAdmin(),loginAsPrivilegedUser(),loginAsViewer(),loginAs(role),loginWithCustomRole(role). - Prefer least privilege: use
loginAsViewer()orloginWithCustomRole()overloginAsAdmin(). - Avoid
loginAsAdmin()unless the test is explicitly about admin-only behavior.
Page objects (UI)
- Prefer
page.testSubj.locator(...), role/label locators; avoid brittle CSS. - Keep selectors + interactions inside the page object class. Do not use `expect` assertions in page objects — use
waitForSelectorfor waiting on elements. Assertions belong in test specs only. - Keep route mocks out of page objects — page objects are for UI interactions only. Put
page.route()mocks in a dedicatedfixtures/mocks.tsfile as standalone functions that acceptpageas a parameter. Seecloud_security_posture/test/scout_cspm_agentless/ui/fixtures/mocks.tsfor the reference pattern. - Don't make API calls from page objects (use
apiServices/kbnClientin hooks instead). - Register plugin page objects by extending the
pageObjectsfixture intest/scout*/ui/fixtures/index.ts. - Use `readonly` class fields for static locators — assign them in the constructor, not as getter methods. Use methods only for parameterized locators/actions. See
DashboardAppinkbn-scoutfor the reference pattern. - Scout provides EUI component wrappers for stable interactions with common EUI widgets:
EuiComboBoxWrapper,EuiDataGridWrapper,EuiSelectableWrapper,EuiCheckBoxWrapper,EuiFieldTextWrapper,EuiCodeBlockWrapper,EuiSuperSelectWrapper,EuiToastWrapper. Import them from@kbn/scoutand use them as class members in page objects. - Avoid `.first()`, `.nth()`, `.last()` — the
playwright/no-nth-methodslint rule flags these. Instead, usedata-test-subjattributes or other targeted selectors. If the component lacks adata-test-subj, add one rather than disabling the rule. - Do not disable eslint rules — avoid
eslint-disablecomments in test files. Fix the underlying issue (e.g., use targeted selectors instead of positional ones, adddata-test-subjto the components) rather than suppressing the lint rule.
Parallel UI specifics (spaceTest)
- Use
spaceTestso you can accessscoutSpacefor worker-isolated saved objects + UI settings. - Pre-ingest shared ES data in
parallel_tests/global.setup.tsviaglobalSetupHook(...). - Only worker fixtures are available there (no
page,browserAuth,pageObjects). - Cleanup space-scoped mutations in
afterAll(scoutSpace.savedObjects.cleanStandardList(), unset UI settings you set).
Extending fixtures
Most modules extend the base test (or spaceTest) in test/scout*/ui/fixtures/index.ts to add custom page objects and auth helpers:
import { test as baseTest } from '@kbn/scout'; // or the module's Scout package
import type { ScoutTestFixtures, ScoutWorkerFixtures, ScoutPage } from '@kbn/scout';
class MyPluginPage {
constructor(private readonly page: ScoutPage) {}
async goto() { await this.page.gotoApp('myPlugin'); }
}
interface ExtendedFixtures extends ScoutTestFixtures {
pageObjects: ScoutTestFixtures['pageObjects'] & { myPlugin: MyPluginPage };
}
export const test = baseTest.extend<ExtendedFixtures, ScoutWorkerFixtures>({
pageObjects: async ({ pageObjects, page }, use) => {
await use({ ...pageObjects, myPlugin: new MyPluginPage(page) });
},
});Tests then import from local fixtures: import { test } from '../fixtures';
Multi-step flows with test.step()
Use test.step(...) to group related actions within a single test. Steps appear in Playwright's trace viewer and HTML report, making failures easier to debug without splitting into many small tests:
test('creates and verifies a dashboard', async ({ pageObjects, page }) => {
await test.step('create dashboard', async () => {
await pageObjects.dashboard.create('My Dashboard');
});
await test.step('verify dashboard appears in list', async () => {
await expect(page.testSubj.locator('dashboardTitle')).toHaveText('My Dashboard');
});
});Waiting + flake control
- Don’t use
page.waitForTimeout. Wait on a page-ready signal (loading indicator hidden, container visible,expect.pollon element counts). - If selectors aren’t stable, add
data-test-subj(Scout uses it as thetestIdAttribute). - Some locators are restricted by
@kbn/eslint/scout_no_locators(e.g.globalLoadingIndicator). Don’t use them in tests or page objects for app loading state management; rely on Playwright auto-waiting and page-ready signals instead.
A11y checks (optional, high value)
- Use
page.checkA11y()at a few stable checkpoints (landing pages, modals/flyouts). - Prefer
includescoped checks; assertviolationsis empty.
Run / debug quickly
- Use either
--configor--testFiles(they are mutually exclusive). - Run by config:
node scripts/scout.js run-tests --arch stateful --domain classic --config <module-root>/test/scout*/ui/playwright.config.ts(or.../ui/parallel.playwright.config.tsfor parallel UI) - Run by file/dir (Scout derives the right
playwright.config.tsvsparallel.playwright.config.ts):node scripts/scout.js run-tests --arch stateful --domain classic --testFiles <module-root>/test/scout*/ui/tests/my.spec.ts - For faster iteration, start servers once in another terminal:
node scripts/scout.js start-server --arch stateful --domain classic [--serverConfigSet <configSet>], then run Playwright directly:npx playwright test --config <...> --project local --grep <tag> --headed. run-testsauto-detects custom config sets from.../test/scout_<name>/...paths.start-serverhas no Playwright config to inspect, so pass--serverConfigSet <name>when your tests require a custom config set.- Debug:
SCOUT_LOG_LEVEL=debug, ornpx playwright test --config <...> --project local --ui
CI enablement
- Scout tests run in CI only for modules listed under
plugins.enabled/packages.enabledin.buildkite/scout_ci_config.yml. node scripts/scout.js generateregisters the module underenabledso the new configs run in CI.
References
Open only what you need:
- Browser authentication helpers and patterns:
references/scout-browser-auth.md - Parallel UI (
spaceTest+scoutSpace) isolation + global setup rules:references/scout-ui-parallelism.md - API services patterns (setup/teardown helpers shared with UI):
../scout-api-testing/references/scout-api-services.md
Scout Browser Authentication
Use the browserAuth fixture to authenticate UI tests without manual UI logins.
Common methods
loginAsAdmin()loginAsPrivilegedUser()loginAsViewer()loginAs(role: string)loginWithCustomRole(role: KibanaRole)
These methods are async and must be awaited.
Basic usage
import { tags } from '@kbn/scout'; // or the module's Scout package (e.g. @kbn/scout-search)
import { expect } from '@kbn/scout/ui'; // or '@kbn/scout-search/ui', etc.
import { test } from '../fixtures';
test.describe('my suite', { tag: tags.deploymentAgnostic }, () => {
test.beforeEach(async ({ browserAuth }) => {
await browserAuth.loginAsViewer();
});
test('does something', async ({ page }) => {
await expect(page.testSubj.locator('someElement')).toBeVisible();
});
});Custom roles
Use loginWithCustomRole() for one-off permission sets. If a custom role is used across multiple tests, extend the browserAuth fixture in the plugin's test/scout*/ui/fixtures and add a helper like loginAsMyRole().
Parallel UI Tests (spaceTest + scoutSpace)
Use this when working under .../test/scout*/ui/parallel_tests/ or a parallel.playwright.config.ts.
Key rules
- Parallelism is file-level. Tests within one file still run sequentially.
- Use
spaceTest(nottest) so you can accessscoutSpace. - Tags are required: every
spaceTest.describe(...)must include{ tag: ... }. - Each worker gets a dedicated Kibana space; the fixture creates and deletes it automatically.
- Pre-ingest shared Elasticsearch data before workers start (global setup hook). Avoid ingesting or cleaning shared indices inside individual parallel tests.
Minimal config + layout
ui/parallel.playwright.config.ts:testDir: './parallel_tests',workers: 2..3, optionalrunGlobalSetup: true.ui/parallel_tests/global.setup.ts: defineglobalSetupHook(...)(runs once total).
Minimal pattern
import { spaceTest, tags } from '@kbn/scout'; // or the module's Scout package
import { expect } from '@kbn/scout/ui'; // or '@kbn/scout-oblt/ui', etc.
spaceTest.describe('my feature', { tag: tags.deploymentAgnostic }, () => {
spaceTest.beforeAll(async ({ scoutSpace }) => {
// Worker-scoped setup in the isolated space.
await scoutSpace.savedObjects.cleanStandardList();
});
spaceTest.afterAll(async ({ scoutSpace }) => {
await scoutSpace.savedObjects.cleanStandardList();
});
spaceTest('does something', async ({ browserAuth, pageObjects, page }) => {
await browserAuth.loginAsViewer();
await pageObjects.somePage.goto();
await expect(page.testSubj.locator('someElement')).toBeVisible();
});
});Global setup hook gotchas
- Global setup runs once total (executed by the first worker); other workers wait for it to finish.
- Only worker-scoped fixtures are available (for example
esArchiver,apiServices,kbnClient,esClient,log). - No
page,browserAuth, orpageObjectsinglobal.setup.ts.
Related skills
FAQ
What does scout-ui-testing do?
scout-ui-testing skill documents Use when creating, updating, debugging, or reviewing Scout UI tests in Kibana (Playwright + Scout fixtures), including page objects, browser authentication, parallel UI tests (spaceTest/scoutSpace), a11y checks, and flake control.
When should I use scout-ui-testing?
User asks about scout-ui-testing, use when creating, updating, debugging, or reviewing scout ui tests in kibana (playwright .
Is this skill safe to install?
Review the Security Audits panel on this page before installing in production.