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

[SIEM] Adds 'Create new rule' Cypress test #59790

Merged
merged 3 commits into from
Mar 10, 2020

Conversation

MadameSheema
Copy link
Member

Summary

In this PR we are adding a Cypress test in order to check that a new rule can be correctly created.

ezgif com-video-to-gif

In order to do that the test is performing the following actions:

  1. Open detections page
  2. Wait for the signals index to be created since if we not wait for it we can experience a flaky behaviour.
  3. Go to to manage signal detect rules clicking in the button
  4. Clicks on "Create new rule"
  5. Fills 'Define rule' step and continues
  6. Fills 'About rule' step and continues
  7. Clicks on 'Create and activate rule'
  8. Checks the input of the 'Custom rules' button to see that the rule was created
  9. Changes the rows per page to 300 to see that now we have 93 rules
  10. Filters by 'Custom rules'
  11. Checks that the displayed: name, risk score and severity is correct
  12. Enters in the rule details
  13. Checks that: rule name, index patterns, custom query, description, severity, risk, timeline, reference urls, false positives, mitre, tags and schedule are correct.

@elasticmachine
Copy link
Contributor

Pinging @elastic/siem (Team:SIEM)

@@ -99,14 +100,21 @@ export const getColumns = ({
field: 'name',
name: i18n.COLUMN_RULE,
render: (value: Rule['name'], item: Rule) => (
<EuiLink href={getRuleDetailsUrl(item.id)}>{value}</EuiLink>
<EuiLink data-test-subj="ruleName" href={getRuleDetailsUrl(item.id)}>
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 for the data-test-subj! Thank you!

@@ -208,7 +210,7 @@ export const AddMitreThreat = ({ dataTestSubj, field, idAria, isDisabled }: AddI
{values.length - 1 !== index && <EuiSpacer size="s" />}
</div>
))}
<MyAddItemButton onClick={addItem} isDisabled={isDisabled}>
<MyAddItemButton data-test-subj="addMitre" onClick={addItem} isDisabled={isDisabled}>
Copy link
Contributor

Choose a reason for hiding this comment

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

I see a mix in our code base of data-test-subj using hypen separators such as add-mitre versus camel case. I don't know if there is a convention documented in the contributing guide but just pointing it out.

This looks fine to me though. (I'm not picky about it)

Copy link
Contributor

@FrankHassanabad FrankHassanabad left a comment

Choose a reason for hiding this comment

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

Left one question about our convention of camelcase 🐫but I like everything about this PR and approve!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

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

@MadameSheema
Copy link
Member Author

@FrankHassanabad agree with you about the convention, I'll take a look and I'll try to refactor for the winning one :P

@MadameSheema MadameSheema merged commit 0f71886 into elastic:master Mar 10, 2020
@MadameSheema MadameSheema deleted the create-new-rule branch March 10, 2020 20:03
MadameSheema added a commit to MadameSheema/kibana that referenced this pull request Mar 10, 2020
* adds 'Creates and activates new rule'

* loads data using es_archive

* refactor test
MadameSheema added a commit that referenced this pull request Mar 11, 2020
* adds 'Creates and activates new rule'

* loads data using es_archive

* refactor test
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 11, 2020
* master:
  [ML] Transforms: Use EuiInMemoryTable instead of custom typed table. (elastic#59782)
  Alerting/fix flaky instance test (elastic#58994)
  ci: disable all Mocha rules for tape tests (elastic#59798)
  Fix UX in alerting UI forms when errors occur (elastic#59444)
  [DOCS] Updated and added jump tables (elastic#59774)
  [DOCS] Moved rolled up index content (elastic#59372)
  Regenerate core api docs (elastic#59814)
  [Lens] remove react warnings (elastic#59574)
  The scripts/backport.js file isn't an executable (elastic#59800)
  [Alerting] add more alert properties to action parameter templating (elastic#59718)
  [Design] Branding changes in Elastic to focus more towards the Elastic brand (elastic#58160)
  [SIEM] Adds 'Create new rule' Cypress test (elastic#59790)
  Updating svgo -> css-tree -> mdn-data, all so we get mdn-data > 2.0 (elastic#58913)
  Use EUI test environment build with Jest (elastic#55877)
  update typescript version in all packages to avoid warnings (elastic#59787)
  [SIEM] [Case] Insert timeline into case textarea (elastic#59586)
  [ML] Functional tests - stabilize saved search tests (elastic#59652)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:SIEM v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants