mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Fixed URL hash appending for space next redirect URL (#189204)
## Summary Fixed URL hash appending for space next redirect URL. ### 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 __Fixes: https://github.com/elastic/kibana/issues/189184__
This commit is contained in:
parent
59f7b4b3a5
commit
3f3713b567
3 changed files with 34 additions and 1 deletions
|
@ -205,6 +205,19 @@ describe('Enter Space view routes', () => {
|
|||
expectedLocation:
|
||||
'/mock-server-basepath/app/management/kibana/objects?initialQuery=type:(visualization)',
|
||||
},
|
||||
{
|
||||
query: {
|
||||
next: '/app/discover#/view/uuid',
|
||||
},
|
||||
expectedLocation: '/mock-server-basepath/app/discover#/view/uuid',
|
||||
},
|
||||
{
|
||||
query: {
|
||||
next: '/app/discover?initialQuery=type:(visualization)#/view/uuid',
|
||||
},
|
||||
expectedLocation:
|
||||
'/mock-server-basepath/app/discover?initialQuery=type:(visualization)#/view/uuid',
|
||||
},
|
||||
]) {
|
||||
const request = httpServerMock.createKibanaRequest({
|
||||
query,
|
||||
|
|
|
@ -46,7 +46,7 @@ export function initSpacesViewsRoutes(deps: ViewRouteDeps) {
|
|||
|
||||
return response.redirected({
|
||||
headers: {
|
||||
location: `${basePath}${normalizedRoute.pathname}${normalizedRoute.search}`,
|
||||
location: `${basePath}${normalizedRoute.pathname}${normalizedRoute.search}${normalizedRoute.hash}`,
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
|
|
|
@ -100,6 +100,26 @@ export default function enterSpaceFunctionalTests({
|
|||
await PageObjects.spaceSelector.expectRoute(spaceId, '/app/management/kibana/objects');
|
||||
});
|
||||
|
||||
it('allows user to navigate to different space with provided next route preserving url hash and search', async () => {
|
||||
const spaceId = 'another-space';
|
||||
|
||||
await PageObjects.security.login(undefined, undefined, {
|
||||
expectSpaceSelector: true,
|
||||
});
|
||||
|
||||
const anchorElement = await PageObjects.spaceSelector.getSpaceCardAnchor(spaceId);
|
||||
const path = await anchorElement.getAttribute('href');
|
||||
|
||||
const pathWithNextRoute = `${path}?next=/app/management/kibana/objects?initialQuery=type:(visualization)#/view`;
|
||||
|
||||
await browser.navigateTo(pathWithNextRoute);
|
||||
|
||||
await PageObjects.spaceSelector.expectRoute(
|
||||
spaceId,
|
||||
'/app/management/kibana/objects?initialQuery=type%3A(visualization)#/view'
|
||||
);
|
||||
});
|
||||
|
||||
it('allows user to navigate to different space with provided next route, route is normalized', async () => {
|
||||
const spaceId = 'another-space';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue