Skip to content

[9.0] [scout] add 'apiServices' fixture to group Kibana API helpers (#214470)#215123

Merged
kibanamachine merged 1 commit intoelastic:9.0from
kibanamachine:backport/9.0/pr-214470
Mar 19, 2025
Merged

[9.0] [scout] add 'apiServices' fixture to group Kibana API helpers (#214470)#215123
kibanamachine merged 1 commit intoelastic:9.0from
kibanamachine:backport/9.0/pr-214470

Conversation

@kibanamachine
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.0:

Questions ?

Please refer to the Backport tool documentation

…c#214470)

## Summary

We decided to group `Kibana API helpers` under a single fixture:
`apiServices` instead of individual fixtures. It should simplify the
search of existing helpers and reduce a risk for Teams to create the
same helper like we see today with FTR.
Adding just `apiServices` in test context and adding dot will expand a
list of all available API helpers + it can be extended for individual
solution (e.g. @kbn/scout-oblt) and directly in plugin (if there is no
chance to re-use it in other plugins)

<img width="699" alt="image"
src="https://github.com/user-attachments/assets/34a76659-04af-48c4-ab69-abda0c950206"
/>

Before:

```
test('should create something', async ({
      fleetApi,
      onboardingApi,
      alertingApi,
    }) => {
      await fleetApi.integration.install(integrationName);
      await onboardingApi.updateInstallationStepStatus(
        onboardingId,
        'ea-download',
        'complete'
      );
      await alertingApi.waitForAlert(alertId);
```

After:

```
test('should create something', async ({
      apiServices,
    }) => {
      await apiServices.fleet.integration.install(integrationName);
      await apiServices.onboarding.updateInstallationStepStatus(
        onboardingId,
        'ea-download',
        'complete'
      );
      await apiServices.alerting.waitForAlert(alertId);
```

(cherry picked from commit 48cd207)
@kibanamachine kibanamachine merged commit 35100fd into elastic:9.0 Mar 19, 2025
12 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/scout 101 105 +4
@kbn/scout-oblt 66 69 +3
total +7

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/scout 18 16 -2
Unknown metric groups

API count

id before after diff
@kbn/scout 412 416 +4
@kbn/scout-oblt 357 360 +3
total +7

cc @dmlemeshko

kibanamachine added a commit that referenced this pull request Mar 19, 2025
…214470) (#215249)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[scout] add 'apiServices' fixture to group Kibana API helpers
(#214470)](#214470)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2025-03-18T11:34:25Z","message":"[scout]
add 'apiServices' fixture to group Kibana API helpers (#214470)\n\n##
Summary\n\nWe decided to group `Kibana API helpers` under a single
fixture:\n`apiServices` instead of individual fixtures. It should
simplify the\nsearch of existing helpers and reduce a risk for Teams to
create the\nsame helper like we see today with FTR.\nAdding just
`apiServices` in test context and adding dot will expand a\nlist of all
available API helpers + it can be extended for individual\nsolution
(e.g. @kbn/scout-oblt) and directly in plugin (if there is no\nchance to
re-use it in other plugins)\n\n<img width=\"699\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/34a76659-04af-48c4-ab69-abda0c950206\"\n/>\n\n\nBefore:\n\n```\ntest('should
create something', async ({\n fleetApi,\n onboardingApi,\n
alertingApi,\n }) => {\n await
fleetApi.integration.install(integrationName);\n await
onboardingApi.updateInstallationStepStatus(\n onboardingId,\n
'ea-download',\n 'complete'\n );\n await
alertingApi.waitForAlert(alertId);\n```\n\nAfter:\n\n```\ntest('should
create something', async ({\n apiServices,\n }) => {\n await
apiServices.fleet.integration.install(integrationName);\n await
apiServices.onboarding.updateInstallationStepStatus(\n onboardingId,\n
'ea-download',\n 'complete'\n );\n await
apiServices.alerting.waitForAlert(alertId);\n```","sha":"48cd2075f75386b515e19567095c03a8ca73fe20","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:version","test:scout","v9.1.0","v8.19.0"],"title":"[scout]
add 'apiServices' fixture to group Kibana API
helpers","number":214470,"url":"https://github.com/elastic/kibana/pull/214470","mergeCommit":{"message":"[scout]
add 'apiServices' fixture to group Kibana API helpers (#214470)\n\n##
Summary\n\nWe decided to group `Kibana API helpers` under a single
fixture:\n`apiServices` instead of individual fixtures. It should
simplify the\nsearch of existing helpers and reduce a risk for Teams to
create the\nsame helper like we see today with FTR.\nAdding just
`apiServices` in test context and adding dot will expand a\nlist of all
available API helpers + it can be extended for individual\nsolution
(e.g. @kbn/scout-oblt) and directly in plugin (if there is no\nchance to
re-use it in other plugins)\n\n<img width=\"699\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/34a76659-04af-48c4-ab69-abda0c950206\"\n/>\n\n\nBefore:\n\n```\ntest('should
create something', async ({\n fleetApi,\n onboardingApi,\n
alertingApi,\n }) => {\n await
fleetApi.integration.install(integrationName);\n await
onboardingApi.updateInstallationStepStatus(\n onboardingId,\n
'ea-download',\n 'complete'\n );\n await
alertingApi.waitForAlert(alertId);\n```\n\nAfter:\n\n```\ntest('should
create something', async ({\n apiServices,\n }) => {\n await
apiServices.fleet.integration.install(integrationName);\n await
apiServices.onboarding.updateInstallationStepStatus(\n onboardingId,\n
'ea-download',\n 'complete'\n );\n await
apiServices.alerting.waitForAlert(alertId);\n```","sha":"48cd2075f75386b515e19567095c03a8ca73fe20"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/215123","number":215123,"state":"MERGED","mergeCommit":{"sha":"35100fdb73cab45d355a79a9b04605371397eb7a","message":"[9.0]
[scout] add 'apiServices' fixture to group Kibana API helpers (#214470)
(#215123)\n\n# Backport\n\nThis will backport the following commits from
`main` to `9.0`:\n- [[scout] add 'apiServices' fixture to group Kibana
API
helpers\n(#214470)](https://github.com/elastic/kibana/pull/214470)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Dzmitry Lemechko
<dzmitry.lemechko@elastic.co>"}},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/214470","number":214470,"mergeCommit":{"message":"[scout]
add 'apiServices' fixture to group Kibana API helpers (#214470)\n\n##
Summary\n\nWe decided to group `Kibana API helpers` under a single
fixture:\n`apiServices` instead of individual fixtures. It should
simplify the\nsearch of existing helpers and reduce a risk for Teams to
create the\nsame helper like we see today with FTR.\nAdding just
`apiServices` in test context and adding dot will expand a\nlist of all
available API helpers + it can be extended for individual\nsolution
(e.g. @kbn/scout-oblt) and directly in plugin (if there is no\nchance to
re-use it in other plugins)\n\n<img width=\"699\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/34a76659-04af-48c4-ab69-abda0c950206\"\n/>\n\n\nBefore:\n\n```\ntest('should
create something', async ({\n fleetApi,\n onboardingApi,\n
alertingApi,\n }) => {\n await
fleetApi.integration.install(integrationName);\n await
onboardingApi.updateInstallationStepStatus(\n onboardingId,\n
'ea-download',\n 'complete'\n );\n await
alertingApi.waitForAlert(alertId);\n```\n\nAfter:\n\n```\ntest('should
create something', async ({\n apiServices,\n }) => {\n await
apiServices.fleet.integration.install(integrationName);\n await
apiServices.onboarding.updateInstallationStepStatus(\n onboardingId,\n
'ea-download',\n 'complete'\n );\n await
apiServices.alerting.waitForAlert(alertId);\n```","sha":"48cd2075f75386b515e19567095c03a8ca73fe20"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants