mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
## Summary Related to #151613 There might be cases when we need to add extra wait for Kibana plugin to be ready before starting loading test data with `esArchiver` / `kbnArchiver`. Currently journey lifecycle looks like this: - `onSetup` wrapped with mocha `before` hook - in parallel - `setupBrowserAndPage` (including EBT tracker setup) - load ES data / Kibana saved objects - `setupApm` - steps execution (each step wrapped with mocha `it` function) - `onTeardown` wrapped with mocha `after` hook - `tearDownBrowserAndPage` (including closing EBT tracker) - `teardownApm` - load ES data / Kibana saved objects beforeSteps hook purpose is to make sure Kibana/ES state is ready for journey execution and not load test data, since it won't be unloaded during `after` hook: - `onSetup` wrapped with mocha `before` hook - `setupBrowserAndPage` (including EBT tracker setup) - run beforeSteps hook -> prepare Kibana/ES for data ingestion / steps execution - load ES data / Kibana saved objects - `setupApm` How to use: ``` export const journey = new Journey({ beforeSteps: async ({ kibanaServer, retry }) => { retry.try(async () => { const response = await kibanaServer.request({ path: '/internal/cloud_security_posture/status?check=init', method: 'GET', }); return response.status === 200; }); }, esArchives: [...], kbnArchives: [...], }) .step({...}) .step({...}) ``` |
||
---|---|---|
.. | ||
journey | ||
services | ||
index.ts | ||
jest.config.js | ||
kibana.jsonc | ||
package.json | ||
README.mdx | ||
tsconfig.json |
--- id: kibDevDocsOpsJourneys slug: /kibana-dev-docs/ops/journeys title: Journeys description: A new style of functional test, focused on performance testing for now tags: ['kibana', 'dev', 'contributor', 'operations', 'performance', 'functional', 'testing'] --- Journeys are a slightly newer take on Functional Tests, currently powered by [playwright](https://playwright.dev/docs). A Journey is a single pathway through Kibana and looks something like this: ```ts import { Journey } from '@kbn/journeys'; import { subj } from '@kbn/test-subj-selector'; export const journey = new Journey({ esArchives: [ ... ], kbnArchives: [ ... ], scalabilitySetup: { ... }, }) .step('Go to Discover Page', async ({ page, kbnUrl }) => { await page.goto(kbnUrl.get(`/app/discover`)); await page.waitForSelector(subj('discoverDocTable')); }) .step('Expand the first document', async ({ page }) => { const expandButtons = page.locator(subj('docTableExpandToggleColumn')); await expandButtons.first().click(); await page.locator('text="Expanded document"'); }); ```