[CLOUD] fix defaultRoute for app/cloud/onboarding (#221029)

## Summary

The uiSettings client need to have the Kibana request to send back the
defaultRoute for a space.


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
This commit is contained in:
Xavier Mouligneau 2025-05-21 14:32:00 -04:00 committed by GitHub
parent 28cc698f04
commit 6f41f41626
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

View file

@ -249,7 +249,7 @@ export class CloudPlugin implements Plugin<CloudSetup, CloudStart> {
},
async (context, request, response) => {
const { uiSettings, savedObjects } = await context.core;
const defaultRoute = await uiSettings.client.get<string>('defaultRoute');
const defaultRoute = await uiSettings.client.get<string>('defaultRoute', { request });
const nextCandidateRoute = parseNextURL(request.url.href);
const route = nextCandidateRoute === '/' ? defaultRoute : nextCandidateRoute;

View file

@ -69,6 +69,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
'--xpack.security.authc.providers.saml.saml1.realm=saml1',
'--xpack.security.authc.providers.basic.basic1.order=1',
'--server.restrictInternalApis=false',
'--uiSettings.overrides.defaultRoute=/app/observability/landing',
],
},
uiSettings: {

View file

@ -55,6 +55,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await deleteSavedObject();
});
it('Only redirect', async () => {
await browser.get(deployment.getHostPort() + `/app/cloud/onboarding`);
await find.byCssSelector('[data-test-subj="userMenuButton"]', 20000);
// We need to make sure that both path and hash are respected.
const currentURL = parse(await browser.getCurrentUrl());
expect(currentURL.pathname).to.eql('/app/observability/landing');
});
it('Redirect and save token', async () => {
await browser.get(
deployment.getHostPort() +