Skip to content

Commit 67fd25c

Browse files
committed
[CLOUD] fix defaultRoute for app/cloud/onboarding (elastic#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 (cherry picked from commit 6f41f41)
1 parent 561f2a9 commit 67fd25c

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

x-pack/platform/plugins/shared/cloud/server/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export class CloudPlugin implements Plugin<CloudSetup, CloudStart> {
249249
},
250250
async (context, request, response) => {
251251
const { uiSettings, savedObjects } = await context.core;
252-
const defaultRoute = await uiSettings.client.get<string>('defaultRoute');
252+
const defaultRoute = await uiSettings.client.get<string>('defaultRoute', { request });
253253
const nextCandidateRoute = parseNextURL(request.url.href);
254254

255255
const route = nextCandidateRoute === '/' ? defaultRoute : nextCandidateRoute;

x-pack/test/functional_cloud/saml.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
6767
'--xpack.security.authc.providers.saml.saml1.realm=saml1',
6868
'--xpack.security.authc.providers.basic.basic1.order=1',
6969
'--server.restrictInternalApis=false',
70+
'--uiSettings.overrides.defaultRoute=/app/observability/landing',
7071
],
7172
},
7273
uiSettings: {

x-pack/test/functional_cloud/tests/onboarding.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
5555
await deleteSavedObject();
5656
});
5757

58+
it('Only redirect', async () => {
59+
await browser.get(deployment.getHostPort() + `/app/cloud/onboarding`);
60+
await find.byCssSelector('[data-test-subj="userMenuButton"]', 20000);
61+
62+
// We need to make sure that both path and hash are respected.
63+
const currentURL = parse(await browser.getCurrentUrl());
64+
expect(currentURL.pathname).to.eql('/app/observability/landing');
65+
});
66+
5867
it('Redirect and save token', async () => {
5968
await browser.get(
6069
deployment.getHostPort() +

0 commit comments

Comments
 (0)