forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solutions] Fix User flyout loading forever when Managed use…
…r flag is enabled (elastic#175764) ## Summary * Fix the bug that made the user modal load forever * Add unit tests * Add cypress test for managed data * Flaky test runner https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4975 ### How to test it? * Enable `newUserDetailsFlyoutManagedUser` and `newUserDetailsFlyout` flags * Open a kibana instance with alerts * Go to Alerts page and click on a username * It should load the new user details flyout ### 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 - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed
- Loading branch information
Showing
12 changed files
with
1,746 additions
and
44 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...k/plugins/security_solution/public/flyout/entity_details/user_details_left/index.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* 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 { TestProviders } from '../../../common/mock'; | ||
import { render } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { UserDetailsPanel } from '.'; | ||
import { EntityDetailsLeftPanelTab } from '../shared/components/left_panel/left_panel_header'; | ||
|
||
describe('LeftPanel', () => { | ||
it('renders', () => { | ||
const { queryByText } = render( | ||
<UserDetailsPanel | ||
path={{ | ||
tab: EntityDetailsLeftPanelTab.RISK_INPUTS, | ||
}} | ||
isRiskScoreExist | ||
user={{ name: 'test user', email: [] }} | ||
/>, | ||
{ | ||
wrapper: TestProviders, | ||
} | ||
); | ||
|
||
const tabElement = queryByText('Risk Inputs'); | ||
|
||
expect(tabElement).toBeInTheDocument(); | ||
}); | ||
|
||
it('does not render the tab if tab is not found', () => { | ||
const { queryByText } = render( | ||
<UserDetailsPanel | ||
path={{ | ||
tab: EntityDetailsLeftPanelTab.RISK_INPUTS, | ||
}} | ||
isRiskScoreExist={false} | ||
user={{ name: 'test user', email: [] }} | ||
/>, | ||
{ | ||
wrapper: TestProviders, | ||
} | ||
); | ||
|
||
const tabElement = queryByText('Risk Inputs'); | ||
|
||
expect(tabElement).not.toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
x-pack/test/security_solution_cypress/cypress/screens/users/flyout_user_panel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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 { getDataTestSubjectSelector } from '../../helpers/common'; | ||
|
||
export const USER_PANEL_HEADER = getDataTestSubjectSelector('user-panel-header'); | ||
|
||
const MANAGED_DATA_SECTION = getDataTestSubjectSelector('managedUser-data'); | ||
|
||
export const OKTA_MANAGED_DATA_TITLE = `${MANAGED_DATA_SECTION} ${getDataTestSubjectSelector( | ||
'managed-user-accordion-userAssetOktaLeftSection' | ||
)}`; | ||
|
||
export const ENTRA_MANAGED_DATA_TITLE = `${MANAGED_DATA_SECTION} ${getDataTestSubjectSelector( | ||
'managed-user-accordion-userAssetEntraLeftSection' | ||
)}`; |
20 changes: 20 additions & 0 deletions
20
x-pack/test/security_solution_cypress/cypress/tasks/fleet_integrations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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 { | ||
GET_INSTALLED_INTEGRATIONS_URL, | ||
InstalledIntegration, | ||
} from '@kbn/security-solution-plugin/common/api/detection_engine'; | ||
|
||
export const mockFleetInstalledIntegrations = (integrations: InstalledIntegration[] = []) => { | ||
cy.intercept('GET', `${GET_INSTALLED_INTEGRATIONS_URL}*`, { | ||
statusCode: 200, | ||
body: { | ||
installed_integrations: integrations, | ||
}, | ||
}).as('installedIntegrations'); | ||
}; |
Oops, something went wrong.