Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ import {
fillScheduleRuleAndContinue,
selectThresholdRuleType,
waitForAlertsToPopulate,
fillDefineThresholdRule,
continueFromDefineStep,
} from '../../../../tasks/create_new_rule';
import { login } from '../../../../tasks/login';
import { visit } from '../../../../tasks/navigation';
Expand All @@ -68,7 +70,7 @@ import { CREATE_RULE_URL } from '../../../../urls/navigation';
describe(
'Threshold rules',
{
tags: ['@ess', '@serverless', '@skipInServerlessMKI'],
tags: ['@ess', '@serverless'],
},
() => {
const rule = getNewThresholdRule();
Expand Down Expand Up @@ -152,8 +154,10 @@ describe(
it('Creates a new threshold rule with suppression enabled', () => {
selectThresholdRuleType();

fillDefineThresholdRule(rule);
enablesAndPopulatesThresholdSuppression(5, 'h');
fillDefineThresholdRuleAndContinue(rule);
continueFromDefineStep();

// ensures duration displayed on define step in preview mode
cy.get(DEFINITION_DETAILS).within(() => {
getDetails(SUPPRESS_FOR_DETAILS).should('have.text', '5h');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export const fillRuleActionFilters = (alertsFilter: AlertsFilter) => {
.type(`{selectall}${alertsFilter.timeframe.timezone}{enter}`);
};

export const fillDefineThresholdRuleAndContinue = (rule: ThresholdRuleCreateProps) => {
export const fillDefineThresholdRule = (rule: ThresholdRuleCreateProps) => {
const thresholdField = 0;
const threshold = 1;

Expand All @@ -578,7 +578,11 @@ export const fillDefineThresholdRuleAndContinue = (rule: ThresholdRuleCreateProp
cy.wrap(inputs[threshold]).clear();
cy.wrap(inputs[threshold]).type(`${rule.threshold.value}`);
});
cy.get(DEFINE_CONTINUE_BUTTON).should('exist').click({ force: true });
};

export const fillDefineThresholdRuleAndContinue = (rule: ThresholdRuleCreateProps) => {
fillDefineThresholdRule(rule);
continueFromDefineStep();
};

export const fillDefineEqlRule = (rule: EqlRuleCreateProps) => {
Expand Down Expand Up @@ -908,6 +912,7 @@ export const enablesAndPopulatesThresholdSuppression = (
// enables suppression for threshold rule
cy.get(THRESHOLD_ENABLE_SUPPRESSION_CHECKBOX).should('not.be.checked');
cy.get(THRESHOLD_ENABLE_SUPPRESSION_CHECKBOX).click();
cy.get(THRESHOLD_ENABLE_SUPPRESSION_CHECKBOX).should('be.checked');

setAlertSuppressionDuration(interval, timeUnit);

Expand Down