kibana/x-pack/test/functional_solution_sidenav/tests/security_sidenav.ts
Tim Sullivan ef907a32f2
[Security Solution] Use static declaration for navigation hierarchy (#215969)
## Summary

Part of Epic: https://github.com/elastic/kibana-team/issues/1439
Addresses https://github.com/elastic/kibana/issues/212903, but does not
remove the landing page access. The landing page access will be removed
in https://github.com/elastic/kibana/pull/210893

**Changes**
1. Converts the declaration of the Security Solution side navigation for
serverless and stateful projects into a static declaration, rather than
algorithmically parsing registered links to dynamically build the
declaration.
2. Updates the contents of the "Assets" panel to prepare for removal of
that landing page.
3. Eliminates the top-level nesting of the nav items, which removes the
extra space between the project title and the first nav items. See
45454bdc4d

**Known issue**: Clicking the "Browse integrations" button does not
close the secondary nav panel. Doing that will be a relatively simple
chore, but will require some changes in the SharedUX chrome-navigation
package, as well as the `LinkButton` component in the Security Solution
navigation-links package.

### Screenshots
Serverless

![static-nav-declaration-security-serverless-3iorteikghiskhgkseh](https://github.com/user-attachments/assets/47bcbea9-7e3c-481e-b1b8-4b13bb5d63b1)

Stateful/ECH

![static-nav-declaration-security-stateful-3iorteikghiskhgkseh](https://github.com/user-attachments/assets/3d3c8a0e-95d1-4da7-a657-c824577b6ec1)

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-03 08:38:04 -07:00

82 lines
3.3 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../ftr_provider_context';
export default function ({ getPageObjects, getService }: FtrProviderContext) {
const { common, solutionNavigation } = getPageObjects(['common', 'solutionNavigation']);
const spaces = getService('spaces');
const browser = getService('browser');
const testSubjects = getService('testSubjects');
describe('security solution', () => {
let cleanUp: () => Promise<unknown>;
let spaceCreated: { id: string } = { id: '' };
before(async () => {
// Navigate to the spaces management page which will log us in Kibana
await common.navigateToUrl('management', 'kibana/spaces', {
shouldUseHashForSubUrl: false,
});
// Create a space with the security solution and navigate to its home page
({ cleanUp, space: spaceCreated } = await spaces.create({ solution: 'security' }));
await browser.navigateTo(spaces.getRootUrl(spaceCreated.id));
});
after(async () => {
// Clean up space created
await cleanUp();
});
describe('sidenav & breadcrumbs', () => {
it('renders the correct nav and navigate to links', async () => {
const expectNoPageReload = await solutionNavigation.createNoPageReloadCheck();
await solutionNavigation.expectExists();
await solutionNavigation.breadcrumbs.expectExists();
// check side nav links
await solutionNavigation.sidenav.expectSectionExists('security_solution_nav');
await solutionNavigation.sidenav.expectLinkActive({
deepLinkId: 'securitySolutionUI:get_started',
});
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({
deepLinkId: 'securitySolutionUI:get_started',
});
// check the Investigations subsection
await solutionNavigation.sidenav.openPanel('investigations'); // open Investigations panel
await testSubjects.click(`~panelNavItem-id-timelines`);
await solutionNavigation.sidenav.expectLinkActive({ navId: 'investigations' });
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Timelines' });
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({
deepLinkId: 'securitySolutionUI:timelines',
});
// navigate back to the home page using header logo
await solutionNavigation.clickLogo();
await solutionNavigation.sidenav.expectLinkActive({
deepLinkId: 'securitySolutionUI:get_started',
});
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({
deepLinkId: 'securitySolutionUI:get_started',
});
await expectNoPageReload();
});
it('renders a feedback callout', async () => {
await solutionNavigation.sidenav.feedbackCallout.expectExists();
await solutionNavigation.sidenav.feedbackCallout.dismiss();
await solutionNavigation.sidenav.feedbackCallout.expectMissing();
await browser.refresh();
await solutionNavigation.sidenav.feedbackCallout.expectMissing();
});
});
});
}