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

[Security Solution][Test] Enzyme test for related events button #74411

Merged
merged 3 commits into from
Aug 5, 2020
Merged

[Security Solution][Test] Enzyme test for related events button #74411

merged 3 commits into from
Aug 5, 2020

Conversation

bkimmel
Copy link
Contributor

@bkimmel bkimmel commented Aug 5, 2020

Summary

This adds an Enzyme test to assert the presence of a "Related Events" button on a node when that node has Related Events on the underlying Resolver tree.

To assist in this, a new mock was created to mock related events and a helper function to insert related events into a mock tree was added as well.

For maintainers

@bkimmel bkimmel added v7.10.0 v8.0.0 Team:Endpoint Data Visibility Team managing the endpoint resolver Feature:Resolver Security Solution Resolver feature release_note:skip Skip the PR/issue when compiling release notes labels Aug 5, 2020
@bkimmel bkimmel marked this pull request as ready for review August 5, 2020 19:08
@bkimmel bkimmel requested review from a team as code owners August 5, 2020 19:08
@elasticmachine
Copy link
Contributor

Pinging @elastic/endpoint-app-team (Feature:Resolver)

@elasticmachine
Copy link
Contributor

Pinging @elastic/endpoint-data-visibility-team (Team:Endpoint Data Visibility)

}

/**
* Dump all contents of the outer ReactWrapper (to be `console.log`ged as appropriate)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

❔ add comment about mixing React & DOM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

entityID,
timestamp,
category,
type,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

❔ add id

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/**
* For a render of the Enzyme wrapper (may help update if other concerns have effected the render). May be useful for debugging.
*/
public updateWrapper() {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you remove this for now (its unused)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

public processNodeRelatedEventButton(entityID: string): ReactWrapper {
return this.processNodeElements({ entityID }).findWhere(
(wrapper) =>
typeof wrapper.type() === 'string' &&
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a comment here saying something like 'filter out React components'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

export function oneAncestorTwoChildren(
{
withRelatedEvents,
}: { withRelatedEvents: Parameters<typeof withRelatedEventsOnOrigin>[1] | null } = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}: { withRelatedEvents: Parameters<typeof withRelatedEventsOnOrigin>[1] | null } = {
}: { withRelatedEvents: Parameters<[string, string] | null } = {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

kind: 'event',
type,
category,
id: uuid.v4(),
Copy link
Contributor

Choose a reason for hiding this comment

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

can you make this non-random? maybe pass it in or just make it id: '1' or something

Copy link
Contributor Author

Choose a reason for hiding this comment

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

export function oneAncestorTwoChildren(
{
withRelatedEvents,
}: { withRelatedEvents: Parameters<typeof withRelatedEventsOnOrigin>[1] | null } = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

❔ Change back to It<string,string>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@oatkiller oatkiller left a comment

Choose a reason for hiding this comment

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

looks good!

@bkimmel
Copy link
Contributor Author

bkimmel commented Aug 5, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

async chunks size

id value diff baseline
securitySolution 7.3MB +43.0B 7.3MB

History

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

@bkimmel bkimmel merged commit dfad75f into elastic:master Aug 5, 2020
@bkimmel bkimmel deleted the resolver/enzyme-processnode-relatedbutton branch August 5, 2020 22:47
gmmorris added a commit to gmmorris/kibana that referenced this pull request Aug 6, 2020
* master: (208 commits)
  Observability Overview fix extra basepath prepend for alerting fetch (elastic#74465)
  [Lens] Clean and inline disabling of react-hooks/exhaustive-deps eslint rule (elastic#70010)
  Skip "space with index pattern management disabled" functional test for cloud env (elastic#74073)
  Filter out non-security jobs when collecting Detections telemetry (elastic#74456)
  [Security Solution][Test] Enzyme test for related events button (elastic#74411)
  [SECURITY_SOLUTION] add z-index to get over nav bar (elastic#74427)
  Rename package configs SO to package policies (elastic#74422)
  [DOCS] Add Kibana alerts to Stack Monitoring (elastic#73762)
  skip flaky suite (elastic#71390)
  [ML] DF Analytics: adds functional tests for edit form (elastic#73885)
  Rename agent configs SO to agent policies (elastic#74397)
  [Jenkins] run CI when plugin readmes change (elastic#74388)
  [Metrics UI] Fix validating Metrics Explorer URL (elastic#74311)
  fixing encoding issue with \ for enroll command (elastic#74379)
  [Ingest Manager] Update package registry for testing to f6b01d (elastic#74341)
  Change experimental message for visualizations (elastic#74354)
  [Alerting] Reload the Alerts List when alerts are deleted (elastic#73715)
  [Enterprise Search] Fix/DRY out plugin i18n strings (elastic#74323)
  update empty prompt in analytics list (elastic#74174)
  [Task Manager] Correctly handle `running` tasks when calling RunNow and reduce flakiness in related tests (elastic#73244)
  ...
bkimmel added a commit that referenced this pull request Aug 6, 2020
…) (#74520)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Resolver Security Solution Resolver feature release_note:skip Skip the PR/issue when compiling release notes Team:Endpoint Data Visibility Team managing the endpoint resolver v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants