Skip to content

feat(security,tests): add basic UIAM Scout API tests#244518

Merged
azasypkin merged 7 commits intoelastic:mainfrom
azasypkin:issue-xxx-uiam-add-scout-tests
Jan 5, 2026
Merged

feat(security,tests): add basic UIAM Scout API tests#244518
azasypkin merged 7 commits intoelastic:mainfrom
azasypkin:issue-xxx-uiam-add-scout-tests

Conversation

@azasypkin
Copy link
Copy Markdown
Contributor

@azasypkin azasypkin commented Nov 27, 2025

Summary

Add basic UIAM Scout API tests:

  • ✅ It should be possible to login via UIAM flow
  • ✅ It should be possible to invalidate UIAM session token
  • ✅ It should be possible to refresh UIAM session token

Blocked By: #244306 and #243752

@azasypkin azasypkin added test blocked release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Nov 27, 2025
@azasypkin azasypkin force-pushed the issue-xxx-uiam-add-scout-tests branch from 191b3c4 to cd7e0ac Compare November 27, 2025 14:21
@azasypkin azasypkin self-assigned this Nov 27, 2025
@azasypkin azasypkin force-pushed the issue-xxx-uiam-add-scout-tests branch 4 times, most recently from 9cfdbde to cf76cb7 Compare November 28, 2025 00:00
@azasypkin azasypkin force-pushed the issue-xxx-uiam-add-scout-tests branch from cf76cb7 to 775e81f Compare November 28, 2025 13:36
@dmlemeshko dmlemeshko self-requested a review November 28, 2025 15:05
@azasypkin azasypkin force-pushed the issue-xxx-uiam-add-scout-tests branch 3 times, most recently from 1c81709 to 1d96295 Compare December 3, 2025 18:52
@azasypkin azasypkin force-pushed the issue-xxx-uiam-add-scout-tests branch 3 times, most recently from b2f6b45 to bdb6be8 Compare December 9, 2025 18:57
@azasypkin azasypkin removed the blocked label Dec 9, 2025
@azasypkin azasypkin force-pushed the issue-xxx-uiam-add-scout-tests branch 4 times, most recently from cd10a79 to b9f7149 Compare December 10, 2025 13:58
});
});

apiTest.describe('[LOCAL-ONLY] Refresh UIAM session', { tag: ['@svlSecurity'] }, () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we restrict using 2 root describe blocks in spec file because our CI bot is limited to find the verify first one while running /skip command.

You have few options:

  • merge under the same describe block
  • move to the separate file (and maybe even run them in parallel?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good to know, thanks! I've switched to separate files and parallel running (my tests don't need to access SOs, so I didn't use spaceTest helper) - let's see how it goes!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, I see tests have passed, but I see this in the logs:

2025-12-13 12:12:08 UTC
	 proc [playwright] Error in reporter Error: Invalid path: "scout" directory not found in /..../elastic/kibana-pull-request/kibana/x-pack/platform/plugins/shared/security/test/scout_uiam_local/api/parallel.playwright.config.ts.
2025-12-13 12:12:08 UTC
	 proc [playwright]   Ensure playwright configuration file is in the plugin directory: '/plugins/<plugin-name>/test/scout/ui/<config-file>'

Can this be ignored?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to fix reporter

@azasypkin azasypkin force-pushed the issue-xxx-uiam-add-scout-tests branch from b9f7149 to d25a721 Compare December 13, 2025 11:34
@azasypkin azasypkin force-pushed the issue-xxx-uiam-add-scout-tests branch 2 times, most recently from 9be888d to 1ef38b0 Compare December 30, 2025 12:58
source .buildkite/scripts/steps/functional/common.sh

echo '--- Running Scout UIAM Integration Tests'
node scripts/scout.js run-tests --serverless security --config x-pack/platform/plugins/shared/security/test/scout_uiam_local/api/parallel.playwright.config.ts --kibana-install-dir "$KIBANA_BUILD_LOCATION"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: we run these tests only against Security project type which is enough for the time being.

@azasypkin azasypkin marked this pull request as ready for review December 30, 2025 16:31
@azasypkin azasypkin requested review from a team as code owners December 30, 2025 16:31
Copy link
Copy Markdown
Contributor

@jbudz jbudz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.buildkite LGTM

@azasypkin
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@elastic elastic deleted a comment from elasticmachine Jan 1, 2026
Copy link
Copy Markdown
Contributor

@kc13greiner kc13greiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!


import { globalSetupHook } from '@kbn/scout';

globalSetupHook('To make ESLint happy', async () => {});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With #247630 the hook can be moved to opt-in option, but it will require another PR to remove ESLint rule and update Scout test runner.

Thank you for pointing out the UX issue!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know, thanks!

Copy link
Copy Markdown
Contributor

@dmlemeshko dmlemeshko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kbn/scout changes LGTM

Comment on lines +15 to +17
userSessionCookie = `sid=${await samlAuth.session.getInteractiveUserSessionCookieWithRoleScope(
'viewer'
)}`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should now be able to use the new samlAuth.asInteractiveUser() method to retrieve a cookie-based authc header (so you don't have to compute the sid= string yourself):

const { cookieHeader } = await samlAuth.asInteractiveUser('viewer');
const response = await apiClient.get('internal/endpoint', {
  headers: { ...cookieHeader }
);

Ensure you pull changes from main. Thanks for your feedback with respect to naming / UX!

Copy link
Copy Markdown
Contributor Author

@azasypkin azasypkin Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks! Switched to samlAuth.asInteractiveUser in a3b3c56

@azasypkin azasypkin enabled auto-merge (squash) January 5, 2026 15:06
@azasypkin azasypkin merged commit 6815f03 into elastic:main Jan 5, 2026
14 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Scout: [ platform / streams_app ] plugin / serverless-oblt - Discover integration - Classic Stream - Navigate to Stream processing from document flyout - should navigate to Stream processing page from Discover document flyout in ES|QL mode
  • [job] [logs] Scout: [ platform / streams_app ] plugin / should navigate to Stream processing page from Discover document flyout in ES|QL mode

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/mock-idp-utils 27 38 +11
Unknown metric groups

API count

id before after diff
@kbn/mock-idp-utils 33 44 +11

History

cc @azasypkin

@azasypkin azasypkin deleted the issue-xxx-uiam-add-scout-tests branch January 5, 2026 17:36
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Jan 6, 2026
## Summary

Add basic UIAM Scout API tests:
* ✅ It should be possible to login via UIAM flow
* ✅ It should be possible to invalidate UIAM session token
* ✅ It should be possible to refresh UIAM session token

~~__Blocked By:__ elastic#244306 and
elastic#243752

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
dej611 pushed a commit to dej611/kibana that referenced this pull request Jan 8, 2026
## Summary

Add basic UIAM Scout API tests:
* ✅ It should be possible to login via UIAM flow
* ✅ It should be possible to invalidate UIAM session token
* ✅ It should be possible to refresh UIAM session token

~~__Blocked By:__ elastic#244306 and
elastic#243752

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
devamanv pushed a commit to devamanv/kibana that referenced this pull request Jan 12, 2026
## Summary

Add basic UIAM Scout API tests:
* ✅ It should be possible to login via UIAM flow
* ✅ It should be possible to invalidate UIAM session token
* ✅ It should be possible to refresh UIAM session token

~~__Blocked By:__ elastic#244306 and
elastic#243752

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
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:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes test v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants