Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cloud Security] Cypress Test for Misconfiguration Preview and Table for Contextual Flyout #193125

Merged
merged 25 commits into from
Oct 19, 2024

Conversation

animehart
Copy link
Contributor

@animehart animehart commented Sep 17, 2024

Summary

This PR is for Cypress test for the Misconfiguration Preview and Data table

@animehart
Copy link
Contributor Author

/ci

@animehart
Copy link
Contributor Author

/ci

@animehart
Copy link
Contributor Author

/ci

@animehart animehart added backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Team:Cloud Security Cloud Security team related v8.16.0 release_note:skip Skip the PR/issue when compiling release notes labels Sep 19, 2024
@animehart animehart marked this pull request as ready for review September 19, 2024 04:44
@animehart animehart requested review from a team as code owners September 19, 2024 04:44
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security)

@maxcold
Copy link
Contributor

maxcold commented Sep 20, 2024

@animehart couple of asks:

@animehart animehart changed the title [Cloud Security] Cypress Test for Misconfiguration Preview and Table for Contextual Flyout (Hostname) [Cloud Security] Cypress Test for Misconfiguration Preview and Table for Contextual Flyout Sep 23, 2024
Copy link

@vgomez-el vgomez-el left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@animehart animehart requested a review from maxcold October 1, 2024 06:23
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 20.5MB 20.5MB +735.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@@ -0,0 +1,232 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the test. Looks like it's interacting with alerts page and the flyout, shall we move it to x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/expandable_flyout?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah kk
So I placed that test in the current folder because @machadoum suggested to put it here
would it be better if i move it to x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/expandable_flyout instead ? @machadoum

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@animehart If the tested feature is only displayed inside the expandable flyout, placing the test where @angorayc suggested might make sense. But that is up to the @elastic/security-threat-hunting-investigations team to decide since they own the cypress/e2e/investigations folder. I strongly suggest you create a folder for your team (cloud_security_posture?) so you don't depend on other teams for code reviews.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@machadoum
As discussed before, we were planning to add our own folder later, the reason being is because adding a specific folder for our team now will involve further steps to to make the new test to be ran on CI and because of this time constraint we think its better for us to put our test in existing folder for now

Copy link
Contributor

@seanrathier seanrathier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I have a couple of questions I would like to hear your opinion on.

DM me after for approval

});

it('should display insight tabs and findings table upon clicking on misconfiguration accordion', () => {
cy.contains('Failed findings', { timeout: 3000 });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Whenever I see a time-out in a test, it concerns me that we have a performance issue with the UI (sometimes the test runner).

Have we had to do the same in the Selenium tests for the Findings?

I would have expected with mock data that we should be showing the table in under 3 seconds.


echo "--- Cloud Security Posture Workflows Cypress tests"

cd x-pack/plugins/security_solution
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path should be changed to: x-pack/test/security_solution_cypress where the package.json commands and the tests live.


echo "--- Cloud Security Posture Workflows Cypress tests on Serverless"

cd x-pack/plugins/security_solution
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path should be changed to: x-pack/test/security_solution_cypress where the package.json commands and the tests live.

Copy link
Contributor

@maxcold maxcold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, couple of nit comments. Thanks for incorporating all the feedback!


const timestamp = Date.now();

// Create a Date object using the timestamp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: comments like this doesn't bring any value really as they are just describing the code below as is. So the can be safely removed

// Create a Date object using the timestamp
const date = new Date(timestamp);

// Convert the Date object to ISO 8601 format
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same as the comment about, just stating the obvious

});

afterEach(() => {
deleteDataStream();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here it is worth commenting that we deleting the data stream while we don't create it because the data stream is being created automatically when any cloud_security_api is hit

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7174

[✅] Cloud Security Posture - Cypress: 39/39 tests passed.
[✅] [Serverless] Cloud Security Posture - Cypress: 39/39 tests passed.

see run history

@@ -1861,8 +1861,8 @@ 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/explore/hosts/vulnerabilities_contextual_flyout.cy.ts @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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to move this test to your new folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh woops
missed that

@@ -20,6 +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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to be a temporary location?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, this is going to be the permanent location (unless its a problem ?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not! then let's remove the Temporary location from the readme :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, you mean that text lol
I thought you talking about the directory XD

@@ -73,6 +74,17 @@ yarn test:ftr --config x-pack/test_serverless/api_integration/test_suites/securi
yarn test:ftr --config x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.ts
```

Run [**End-to-End Cypress Tests**](https://github.com/elastic/kibana/tree/main/x-pack/test/security_solution_cypress/cypress):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README inside the security_solution_cypress folder should be updated as well.

});

it('should display insight tabs and findings table upon clicking on misconfiguration accordion', () => {
cy.get(CSP_INSIGHT_MISCONFIGURATION_TITLE).click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Wrap this issue into a task method.

});

it('should display insight tabs and findings table upon clicking on misconfiguration accordion', () => {
cy.get(CSP_INSIGHT_MISCONFIGURATION_TITLE).click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7178

[✅] Cloud Security Posture - Cypress: 45/45 tests passed.
[✅] [Serverless] Cloud Security Posture - Cypress: 45/45 tests passed.

see run history

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7187

[✅] Cloud Security Posture - Cypress: 45/45 tests passed.
[✅] [Serverless] Cloud Security Posture - Cypress: 45/45 tests passed.

see run history

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #18 / EditableMarkdown Save button click calls onSaveContent and onChangeEditable when text area value changed

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 20.7MB 20.7MB +735.0B

History

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7189

[✅] Cloud Security Posture - Cypress: 45/45 tests passed.
[✅] [Serverless] Cloud Security Posture - Cypress: 45/45 tests passed.

see run history

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7190

[✅] Cloud Security Posture - Cypress: 45/45 tests passed.
[✅] [Serverless] Cloud Security Posture - Cypress: 45/45 tests passed.

see run history

@animehart animehart added backport:version Backport to applied version labels v9.0.0 and removed backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Oct 19, 2024
@animehart animehart merged commit 2de1f4a into elastic:main Oct 19, 2024
50 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.16

https://github.com/elastic/kibana/actions/runs/11416138161

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.16 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 193125

Questions ?

Please refer to the Backport tool documentation

@animehart
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.16

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.