# Backport
This will backport the following commits from `main` to `8.6`:
- [[kbn-journeys] add optional beforeSteps hook
(#151717)](https://github.com/elastic/kibana/pull/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":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2023-02-22T17:53:00Z","message":"[kbn-journeys]
add optional beforeSteps hook (#151717)\n\n## Summary\r\n\r\nRelated to
#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 (#151717)\n\n## Summary\r\n\r\nRelated to
#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 (#151717)\n\n## Summary\r\n\r\nRelated to
#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 <dzmitry.lemechko@elastic.co>
# Backport
This will backport the following commits from `main` to `8.6`:
- [[ftr/journeys] allow override ftr base config in journey
(#151277)](https://github.com/elastic/kibana/pull/151277)
<!--- Backport version: 8.9.7 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)
<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2023-02-16T07:52:05Z","message":"[ftr/journeys]
allow override ftr base config in journey (#151277)\n\n##
Summary\r\n\r\nCurrently journeys use pre-defined base FTR config and
there is no way\r\nto re-configure Kibana to be loaded with extras, e.g.
Fleet
plugin\r\nconfiguration.\r\n\r\nf443109eea/packages/kbn-journeys/journey/journey_ftr_config.ts (L32-L34)\r\n\r\nProbably
the easiest way to address it is to path custom FTR config\r\ndirectly
in the journey.\r\n\r\n```\r\nexport const journey = new Journey({\r\n
ftrConfigPath: 'x-pack/test/cloud_security_posture_api/config.ts',\r\n
...\r\n})\r\n```\r\n\r\n\r\nIt can be also considered as a step towards
using journeys as future\r\nalternative to Webdriver functional
tests.","sha":"b46d25a7ca700b7e4e01970c55dbc25357acf27a","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","wg:performance","v8.7.0","v8.6.2","v8.8.0"],"number":151277,"url":"https://github.com/elastic/kibana/pull/151277","mergeCommit":{"message":"[ftr/journeys]
allow override ftr base config in journey (#151277)\n\n##
Summary\r\n\r\nCurrently journeys use pre-defined base FTR config and
there is no way\r\nto re-configure Kibana to be loaded with extras, e.g.
Fleet
plugin\r\nconfiguration.\r\n\r\nf443109eea/packages/kbn-journeys/journey/journey_ftr_config.ts (L32-L34)\r\n\r\nProbably
the easiest way to address it is to path custom FTR config\r\ndirectly
in the journey.\r\n\r\n```\r\nexport const journey = new Journey({\r\n
ftrConfigPath: 'x-pack/test/cloud_security_posture_api/config.ts',\r\n
...\r\n})\r\n```\r\n\r\n\r\nIt can be also considered as a step towards
using journeys as future\r\nalternative to Webdriver functional
tests.","sha":"b46d25a7ca700b7e4e01970c55dbc25357acf27a"}},"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":"8.6","label":"v8.6.2","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/151277","number":151277,"mergeCommit":{"message":"[ftr/journeys]
allow override ftr base config in journey (#151277)\n\n##
Summary\r\n\r\nCurrently journeys use pre-defined base FTR config and
there is no way\r\nto re-configure Kibana to be loaded with extras, e.g.
Fleet
plugin\r\nconfiguration.\r\n\r\nf443109eea/packages/kbn-journeys/journey/journey_ftr_config.ts (L32-L34)\r\n\r\nProbably
the easiest way to address it is to path custom FTR config\r\ndirectly
in the journey.\r\n\r\n```\r\nexport const journey = new Journey({\r\n
ftrConfigPath: 'x-pack/test/cloud_security_posture_api/config.ts',\r\n
...\r\n})\r\n```\r\n\r\n\r\nIt can be also considered as a step towards
using journeys as future\r\nalternative to Webdriver functional
tests.","sha":"b46d25a7ca700b7e4e01970c55dbc25357acf27a"}}]}]
BACKPORT-->
Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
* [ftr] add first-class support for playwrite journeys
* [CI] Auto-commit changed files from 'node scripts/generate codeowners'
* fix jest test
* remove ability to customize kibana server args, if we need it we can add it back
* remove dev dir that doesn't exist
* fix typo
* prevent duplicated array converstion logic by sharing flag reader
* remove destructuring of option
* fix scalability config and config_path import
* fix start_servers args and tests
* include simple readme
* fix jest tests and support build re-use when changes are just to jest tests
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>