[Asset inventory] Add initial cypress test (#207647)

## Summary

This PR introduces initial cypress test and also a basic test was
configured to test for the presence of the Asset Inventory page when the
Feature Flag `assetInventoryUXEnabled` is set.
This commit is contained in:
Paulo Silva 2025-01-27 17:35:15 -03:00 committed by GitHub
parent dcdffff0e1
commit c03313a57c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 47 additions and 1 deletions

1
.github/CODEOWNERS vendored
View file

@ -2546,6 +2546,7 @@ x-pack/test_serverless/api_integration/test_suites/security/cloud_security_postu
## CSP e2e tests
x-pack/test/security_solution_cypress/cypress/e2e/cloud_security_posture/misconfiguration_contextual_flyout.cy.ts @elastic/kibana-cloud-security-posture
x-pack/test/security_solution_cypress/cypress/e2e/cloud_security_posture/vulnerabilities_contextual_flyout.cy.ts @elastic/kibana-cloud-security-posture
x-pack/test/security_solution_cypress/cypress/e2e/asset_inventory @elastic/kibana-cloud-security-posture
# Security Solution onboarding tour
/x-pack/solutions/security/plugins/security_solution/public/common/components/guided_onboarding @elastic/security-threat-hunting-explore

View file

@ -374,7 +374,7 @@ const AllAssets = ({
loading={loadingState === DataLoadingState.loading}
/>
<EuiPageTemplate.Section>
<EuiTitle size="l">
<EuiTitle size="l" data-test-subj="all-assets-title">
<h1>
<FormattedMessage
id="xpack.securitySolution.assetInventory.allAssets"

View file

@ -46,6 +46,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
'--xpack.ruleRegistry.unsafe.legacyMultiTenancy.enabled=true',
`--xpack.securitySolution.enableExperimental=${JSON.stringify([
'alertSuppressionForSequenceEqlRuleEnabled',
'assetInventoryUXEnabled',
])}`,
// mock cloud to enable the guided onboarding tour in e2e tests
'--xpack.cloud.id=test',

View file

@ -153,6 +153,7 @@ If you belong to one of the teams listed in the table, please add new e2e specs
| `e2e/detection_response/detection_engine` | Detection Engine |
| `e2e/ai_assistant` | AI Assistant |
| `e2e/entity_analytics` | Entity Analytics |
| `e2e/asset_inventory` | Cloud Security Posture |
### fixtures/

View file

@ -0,0 +1,39 @@
/*
* 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';
import { login } from '../../tasks/login';
import { visit } from '../../tasks/navigation';
import { ASSET_INVENTORY_URL } from '../../urls/navigation';
const ALL_ASSETS_TITLE = getDataTestSubjectSelector('all-assets-title');
describe(
'Asset Inventory page',
{
env: {
ftrConfig: {
kbnServerArgs: [
`--xpack.securitySolution.enableExperimental=${JSON.stringify([
'assetInventoryUXEnabled',
])}`,
],
},
},
tags: ['@ess'],
},
() => {
beforeEach(() => {
login();
visit(ASSET_INVENTORY_URL);
});
it('should display All assets title', () => {
cy.get(ALL_ASSETS_TITLE).should('be.visible');
});
}
);

View file

@ -82,3 +82,6 @@ export const FLEET_URL = '/app/fleet';
// Entity Analytics
export const ENTITY_ANALYTICS_DASHBOARD_URL = '/app/security/entity_analytics';
// Asset Inventory
export const ASSET_INVENTORY_URL = '/app/security/asset_inventory';

View file

@ -7,6 +7,7 @@
"scripts": {
"cypress": "NODE_OPTIONS=--openssl-legacy-provider ../../../node_modules/.bin/cypress",
"cypress:open:ess": "TZ=UTC NODE_OPTIONS=--openssl-legacy-provider node ../../solutions/security/plugins/security_solution/scripts/start_cypress_parallel open --spec './cypress/e2e/**/*.cy.ts' --config-file ../../test/security_solution_cypress/cypress/cypress.config.ts --ftr-config-file ../../test/security_solution_cypress/cli_config",
"cypress:asset_inventory:run:ess": "yarn cypress:ess --spec './cypress/e2e/asset_inventory/**/*.cy.ts'",
"cypress:entity_analytics:run:ess": "yarn cypress:ess --spec './cypress/e2e/entity_analytics/**/*.cy.ts'",
"cypress:run:cases:ess": "yarn cypress:ess --spec './cypress/e2e/explore/cases/*.cy.ts'",
"cypress:ess": "TZ=UTC NODE_OPTIONS=--openssl-legacy-provider node ../../solutions/security/plugins/security_solution/scripts/start_cypress_parallel run --config-file ../../test/security_solution_cypress/cypress/cypress_ci.config.ts --ftr-config-file ../../test/security_solution_cypress/cli_config",