Skip to content

Commit

Permalink
fixes last cypress test
Browse files Browse the repository at this point in the history
  • Loading branch information
dplumlee committed Dec 4, 2020
1 parent a7a7771 commit 45c5361
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ export const fillAboutRule = (
rule.mitre.forEach((mitre, tacticIndex) => {
cy.get(MITRE_ATTACK_TACTIC_DROPDOWN).eq(tacticIndex).click({ force: true });
cy.contains(MITRE_TACTIC, mitre.tactic).click();
cy.get(MITRE_ATTACK_ADD_TECHNIQUE_BUTTON).eq(tacticIndex).click({ force: true });

mitre.techniques.forEach((technique) => {
cy.get(MITRE_ATTACK_ADD_TECHNIQUE_BUTTON).eq(tacticIndex).click({ force: true });
cy.get(MITRE_ATTACK_TECHNIQUE_DROPDOWN).eq(techniqueIndex).click({ force: true });
cy.contains(MITRE_TACTIC, technique.name).click();

Expand All @@ -131,10 +131,6 @@ export const fillAboutRule = (
cy.contains(MITRE_TACTIC, subtechnique).click();
subtechniqueInputIndex++;
});

if (techniqueIndex < mitre.techniques.length - 1) {
cy.get(MITRE_ATTACK_ADD_TECHNIQUE_BUTTON).eq(tacticIndex).click({ force: true });
}
techniqueIndex++;
});

Expand Down Expand Up @@ -191,22 +187,26 @@ export const fillAboutRuleWithOverrideAndContinue = (rule: OverrideRule) => {
cy.get(ADD_FALSE_POSITIVE_BTN).click({ force: true });
});

rule.mitre.forEach((mitre, index) => {
cy.get(MITRE_ATTACK_TACTIC_DROPDOWN).eq(index).click({ force: true });
let techniqueIndex = 0;
let subtechniqueInputIndex = 0;
rule.mitre.forEach((mitre, tacticIndex) => {
cy.get(MITRE_ATTACK_TACTIC_DROPDOWN).eq(tacticIndex).click({ force: true });
cy.contains(MITRE_TACTIC, mitre.tactic).click();

mitre.techniques.forEach((technique) => {
cy.get(MITRE_ATTACK_TECHNIQUE_DROPDOWN).eq(index).click({ force: true });
cy.get(MITRE_ATTACK_ADD_TECHNIQUE_BUTTON).eq(tacticIndex).click({ force: true });
cy.get(MITRE_ATTACK_TECHNIQUE_DROPDOWN).eq(techniqueIndex).click({ force: true });
cy.contains(MITRE_TACTIC, technique.name).click();

technique.subtechniques.forEach((subtechnique) => {
cy.get(MITRE_ATTACK_SUBTECHNIQUE_DROPDOWN).eq(index).click({ force: true });
cy.get(MITRE_ATTACK_ADD_SUBTECHNIQUE_BUTTON).eq(techniqueIndex).click({ force: true });
cy.get(MITRE_ATTACK_SUBTECHNIQUE_DROPDOWN)
.eq(subtechniqueInputIndex)
.click({ force: true });
cy.contains(MITRE_TACTIC, subtechnique).click();

cy.get(MITRE_ATTACK_ADD_SUBTECHNIQUE_BUTTON).click({ force: true });
subtechniqueInputIndex++;
});

cy.get(MITRE_ATTACK_ADD_TECHNIQUE_BUTTON).click({ force: true });
techniqueIndex++;
});

cy.get(MITRE_ATTACK_ADD_TACTIC_BUTTON).click({ force: true });
Expand Down

0 comments on commit 45c5361

Please sign in to comment.