Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.6] [kbn-journeys] add optional beforeSteps hook (elastic#151717) (e…
…lastic#151917) # Backport This will backport the following commits from `main` to `8.6`: - [[kbn-journeys] add optional beforeSteps hook (elastic#151717)](elastic#151717) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Dzmitry Lemechko","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-02-22T17:53:00Z","message":"[kbn-journeys] add optional beforeSteps hook (elastic#151717)\n\n## Summary\r\n\r\nRelated to elastic#151613\r\n\r\nThere might be cases when we need to add extra wait for Kibana plugin to\r\nbe ready before starting loading test data with `esArchiver` /\r\n`kbnArchiver`.\r\n\r\nCurrently journey lifecycle looks like this:\r\n\r\n- `onSetup` wrapped with mocha `before` hook\r\n - in parallel \r\n - `setupBrowserAndPage` (including EBT tracker setup)\r\n - load ES data / Kibana saved objects\r\n - `setupApm`\r\n- steps execution (each step wrapped with mocha `it` function)\r\n- `onTeardown` wrapped with mocha `after` hook\r\n - `tearDownBrowserAndPage` (including closing EBT tracker)\r\n - `teardownApm`\r\n - load ES data / Kibana saved objects\r\n\r\nbeforeSteps hook purpose is to make sure Kibana/ES state is ready for\r\njourney execution and not load test data, since it won't be unloaded\r\nduring `after` hook:\r\n\r\n- `onSetup` wrapped with mocha `before` hook\r\n - `setupBrowserAndPage` (including EBT tracker setup)\r\n- run beforeSteps hook -> prepare Kibana/ES for data ingestion / steps\r\nexecution\r\n - load ES data / Kibana saved objects\r\n - `setupApm`\r\n\r\nHow to use:\r\n\r\n```\r\nexport const journey = new Journey({\r\n beforeSteps: async ({ kibanaServer, retry }) => {\r\n retry.try(async () => {\r\n const response = await kibanaServer.request({\r\n path: '/internal/cloud_security_posture/status?check=init',\r\n method: 'GET',\r\n });\r\n return response.status === 200;\r\n });\r\n },\r\n esArchives: [...],\r\n kbnArchives: [...],\r\n})\r\n .step({...})\r\n .step({...})\r\n```","sha":"6c33644b5324df412acd71d2a6433e93c6e17904","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","wg:performance","v8.7.0","v8.8.0","v8.6.3"],"number":151717,"url":"https://github.com/elastic/kibana/pull/151717","mergeCommit":{"message":"[kbn-journeys] add optional beforeSteps hook (elastic#151717)\n\n## Summary\r\n\r\nRelated to elastic#151613\r\n\r\nThere might be cases when we need to add extra wait for Kibana plugin to\r\nbe ready before starting loading test data with `esArchiver` /\r\n`kbnArchiver`.\r\n\r\nCurrently journey lifecycle looks like this:\r\n\r\n- `onSetup` wrapped with mocha `before` hook\r\n - in parallel \r\n - `setupBrowserAndPage` (including EBT tracker setup)\r\n - load ES data / Kibana saved objects\r\n - `setupApm`\r\n- steps execution (each step wrapped with mocha `it` function)\r\n- `onTeardown` wrapped with mocha `after` hook\r\n - `tearDownBrowserAndPage` (including closing EBT tracker)\r\n - `teardownApm`\r\n - load ES data / Kibana saved objects\r\n\r\nbeforeSteps hook purpose is to make sure Kibana/ES state is ready for\r\njourney execution and not load test data, since it won't be unloaded\r\nduring `after` hook:\r\n\r\n- `onSetup` wrapped with mocha `before` hook\r\n - `setupBrowserAndPage` (including EBT tracker setup)\r\n- run beforeSteps hook -> prepare Kibana/ES for data ingestion / steps\r\nexecution\r\n - load ES data / Kibana saved objects\r\n - `setupApm`\r\n\r\nHow to use:\r\n\r\n```\r\nexport const journey = new Journey({\r\n beforeSteps: async ({ kibanaServer, retry }) => {\r\n retry.try(async () => {\r\n const response = await kibanaServer.request({\r\n path: '/internal/cloud_security_posture/status?check=init',\r\n method: 'GET',\r\n });\r\n return response.status === 200;\r\n });\r\n },\r\n esArchives: [...],\r\n kbnArchives: [...],\r\n})\r\n .step({...})\r\n .step({...})\r\n```","sha":"6c33644b5324df412acd71d2a6433e93c6e17904"}},"sourceBranch":"main","suggestedTargetBranches":["8.7","8.6"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/151717","number":151717,"mergeCommit":{"message":"[kbn-journeys] add optional beforeSteps hook (elastic#151717)\n\n## Summary\r\n\r\nRelated to elastic#151613\r\n\r\nThere might be cases when we need to add extra wait for Kibana plugin to\r\nbe ready before starting loading test data with `esArchiver` /\r\n`kbnArchiver`.\r\n\r\nCurrently journey lifecycle looks like this:\r\n\r\n- `onSetup` wrapped with mocha `before` hook\r\n - in parallel \r\n - `setupBrowserAndPage` (including EBT tracker setup)\r\n - load ES data / Kibana saved objects\r\n - `setupApm`\r\n- steps execution (each step wrapped with mocha `it` function)\r\n- `onTeardown` wrapped with mocha `after` hook\r\n - `tearDownBrowserAndPage` (including closing EBT tracker)\r\n - `teardownApm`\r\n - load ES data / Kibana saved objects\r\n\r\nbeforeSteps hook purpose is to make sure Kibana/ES state is ready for\r\njourney execution and not load test data, since it won't be unloaded\r\nduring `after` hook:\r\n\r\n- `onSetup` wrapped with mocha `before` hook\r\n - `setupBrowserAndPage` (including EBT tracker setup)\r\n- run beforeSteps hook -> prepare Kibana/ES for data ingestion / steps\r\nexecution\r\n - load ES data / Kibana saved objects\r\n - `setupApm`\r\n\r\nHow to use:\r\n\r\n```\r\nexport const journey = new Journey({\r\n beforeSteps: async ({ kibanaServer, retry }) => {\r\n retry.try(async () => {\r\n const response = await kibanaServer.request({\r\n path: '/internal/cloud_security_posture/status?check=init',\r\n method: 'GET',\r\n });\r\n return response.status === 200;\r\n });\r\n },\r\n esArchives: [...],\r\n kbnArchives: [...],\r\n})\r\n .step({...})\r\n .step({...})\r\n```","sha":"6c33644b5324df412acd71d2a6433e93c6e17904"}},{"branch":"8.6","label":"v8.6.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Dzmitry Lemechko <[email protected]>
- Loading branch information