From 602865d4c17780fc4a24b771988ad1fac3308fe8 Mon Sep 17 00:00:00 2001 From: animehart Date: Fri, 18 Oct 2024 12:04:29 -0700 Subject: [PATCH] pr Comments --- .github/CODEOWNERS | 5 +++-- x-pack/plugins/cloud_security_posture/README.md | 2 +- .../security_solution_cypress/cypress/README.md | 3 +++ .../misconfiguration_contextual_flyout.cy.ts | 15 +++++++++------ .../vulnerabilities_contextual_flyout.cy.ts | 3 +-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c67c02ddcaff2..874211e572a28 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1861,8 +1861,9 @@ x-pack/plugins/osquery @elastic/security-defend-workflows /x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/setup_technology.* @elastic/fleet @elastic/kibana-cloud-security-posture /x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/components/cloud_posture_third_party_support_callout.* @elastic/fleet @elastic/kibana-cloud-security-posture /x-pack/plugins/security_solution/public/cloud_security_posture @elastic/kibana-cloud-security-posture -/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/expandable_flyout/misconfiguration_contextual_flyout.cy.ts @elastic/kibana-cloud-security-posture -/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/expandable_flyout/vulnerabilities_contextual_flyout.cy.ts @elastic/kibana-cloud-security-posture +/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 + # Security Solution onboarding tour /x-pack/plugins/security_solution/public/common/components/guided_onboarding @elastic/security-threat-hunting-explore diff --git a/x-pack/plugins/cloud_security_posture/README.md b/x-pack/plugins/cloud_security_posture/README.md index 15c0e16afa552..f608a614fca1c 100755 --- a/x-pack/plugins/cloud_security_posture/README.md +++ b/x-pack/plugins/cloud_security_posture/README.md @@ -20,7 +20,7 @@ For general guidelines, read [Kibana Testing Guide](https://www.elastic.co/guide 1. [End-to-End Tests](../../test/cloud_security_posture_functional/config.ts) 1. [Serverless API Integration tests](../../test_serverless/api_integration/test_suites/security/config.ts) 1. [Serverless End-to-End Tests](../../test_serverless/functional/test_suites/security/config.ts) -1. [Cypress End-to-End Tests (Temporary location)](../../test/security_solution_cypress/cypress/e2e/cloud_security_posture) +1. [Cypress End-to-End Tests](../../test/security_solution_cypress/cypress/e2e/cloud_security_posture) ### Tools diff --git a/x-pack/test/security_solution_cypress/cypress/README.md b/x-pack/test/security_solution_cypress/cypress/README.md index bf153cb3be5e0..7ae9017c8f9c8 100644 --- a/x-pack/test/security_solution_cypress/cypress/README.md +++ b/x-pack/test/security_solution_cypress/cypress/README.md @@ -79,6 +79,8 @@ Run the tests with the following yarn scripts from `x-pack/test/security_solutio | cypress:detection_engine:run:serverless | Runs all tests tagged as SERVERLESS in the `e2e/detection_response/detection_engine` excluding `e2e/detection_response/detection_engine` directory in headless mode | | cypress:ai_assistant:run:ess | Runs all tests tagged as ESS in the `e2e/ai_assistant` directory in headless mode | | cypress:ai_assistant:run:serverless | Runs all tests tagged as SERVERLESS in the `e2e/ai_assistant` directory in headless mode | +| cypress:cloud_security_posture:run:ess | Runs all tests tagged as ESS in the `e2e/cloud_security_posture` directory in headless mode | +| cypress:cloud_security_posture:run:serverless | Runs all tests tagged as SERVERLESS in the `e2e/cloud_security_posture` directory in headless mode | | cypress:detection_engine:exceptions:run:serverless | Runs all tests tagged as ESS in the `e2e/detection_response/detection_engine/exceptions` directory in headless mode | | cypress:investigations:run:ess | Runs all tests tagged as SERVERLESS in the `e2e/investigations` directory in headless mode | | cypress:explore:run:ess | Runs all tests tagged as ESS in the `e2e/explore` directory in headless mode | @@ -88,6 +90,7 @@ Run the tests with the following yarn scripts from `x-pack/test/security_solutio | cypress:run:qa:serverless:entity_analytics | Runs all tests tagged as SERVERLESS placed in the `e2e/entity_analytics` directory in headless mode using the QA environment and real MKI projects.| | cypress:run:qa:serverless:explore | Runs all tests tagged as SERVERLESS in the `e2e/explore` directory in headless mode using the QA environment and real MKI prorjects. | | cypress:run:qa:serverless:investigations | Runs all tests tagged as SERVERLESS in the `e2e/investigations` directory in headless mode using the QA environment and reak MKI projects. | +| cypress:run:qa:serverless:cloud_security_posture | Runs all tests tagged as SERVERLESS in the `e2e/cloud_security_posture` directory in headless mode using the QA environment and reak MKI projects. | | cypress:run:qa:serverless:rule_management | Runs all tests tagged as SERVERLESS in the `e2e/detection_response/rule_management` directory, excluding `e2e/detection_response/rule_management/prebuilt_rules` in headless mode using the QA environment and reak MKI projects. | | cypress:run:qa:serverless:rule_management:prebuilt_rules | Runs all tests tagged as SERVERLESS in the `e2e/detection_response/rule_management/prebuilt_rules` directory in headless mode using the QA environment and reak MKI projects. | | cypress:run:qa:serverless:detection_engine | Runs all tests tagged as SERVERLESS in the `e2e/detection_response/detection_engine` directory, excluding `e2e/detection_response/detection_engine/exceptions` in headless mode using the QA environment and reak MKI projects. | diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/cloud_security_posture/misconfiguration_contextual_flyout.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/cloud_security_posture/misconfiguration_contextual_flyout.cy.ts index b69f01b06c305..f2bce9b1fa00e 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/cloud_security_posture/misconfiguration_contextual_flyout.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/cloud_security_posture/misconfiguration_contextual_flyout.cy.ts @@ -29,12 +29,14 @@ const CSP_INSIGHT_TABLE = getDataTestSubjectSelector( 'securitySolutionFlyoutMisconfigurationFindingsTable' ); +const clickMisconfigurationTitle = () => { + cy.get(CSP_INSIGHT_MISCONFIGURATION_TITLE).click(); +}; + const timestamp = Date.now(); -// Create a Date object using the timestamp const date = new Date(timestamp); -// Convert the Date object to ISO 8601 format const iso8601String = date.toISOString(); const mockFindingHostName = (matches: boolean) => { @@ -46,7 +48,7 @@ const mockFindingHostName = (matches: boolean) => { name: 'kubelet', sub_type: 'lower case sub type', }, - result: { evaluation: matches ? 'passed' : 'failed' }, // Adjusting result based on matches + result: { evaluation: matches ? 'passed' : 'failed' }, rule: { name: 'Upper case rule name', section: 'Upper case section', @@ -74,7 +76,7 @@ const mockFindingUserName = (matches: boolean) => { name: 'kubelet', sub_type: 'lower case sub type', }, - result: { evaluation: matches ? 'passed' : 'failed' }, // Adjusting result based on matches + result: { evaluation: matches ? 'passed' : 'failed' }, rule: { name: 'Upper case rule name', section: 'Upper case section', @@ -132,6 +134,7 @@ describe('Alert Host details expandable flyout', { tags: ['@ess', '@serverless'] }); afterEach(() => { + /* Deleting data stream even though we don't create it because data stream is automatically created when Cloud security API is used */ deleteDataStream(); }); @@ -141,7 +144,7 @@ describe('Alert Host details expandable flyout', { tags: ['@ess', '@serverless'] }); it('should display insight tabs and findings table upon clicking on misconfiguration accordion', () => { - cy.get(CSP_INSIGHT_MISCONFIGURATION_TITLE).click(); + clickMisconfigurationTitle(); cy.get(CSP_INSIGHT_TAB_TITLE).should('be.visible'); cy.get(CSP_INSIGHT_TABLE).should('be.visible'); }); @@ -186,7 +189,7 @@ describe('Alert Host details expandable flyout', { tags: ['@ess', '@serverless'] }); it('should display insight tabs and findings table upon clicking on misconfiguration accordion', () => { - cy.get(CSP_INSIGHT_MISCONFIGURATION_TITLE).click(); + clickMisconfigurationTitle(); cy.get(CSP_INSIGHT_TAB_TITLE).should('be.visible'); cy.get(CSP_INSIGHT_TABLE).should('be.visible'); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/cloud_security_posture/vulnerabilities_contextual_flyout.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/cloud_security_posture/vulnerabilities_contextual_flyout.cy.ts index cd85ab71c7db8..046864962318b 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/cloud_security_posture/vulnerabilities_contextual_flyout.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/cloud_security_posture/vulnerabilities_contextual_flyout.cy.ts @@ -27,10 +27,8 @@ const CSP_INSIGHT_VULNERABILITIES_TABLE = getDataTestSubjectSelector( const timestamp = Date.now(); -// Create a Date object using the timestamp const date = new Date(timestamp); -// Convert the Date object to ISO 8601 format const iso8601String = date.toISOString(); const getMockVulnerability = (isNameMatchesAlert: boolean) => { @@ -166,6 +164,7 @@ describe('Alert Host details expandable flyout', { tags: ['@ess', '@serverless'] }); afterEach(() => { + /* Deleting data stream even though we don't create it because data stream is automatically created when Cloud security API is used */ deleteDataStream(); });