diff --git a/x-pack/solutions/security/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/rule_details/execution_log.cy.ts b/x-pack/solutions/security/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/rule_details/execution_log.cy.ts index 6906ffb901e1b..572237426a75b 100644 --- a/x-pack/solutions/security/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/rule_details/execution_log.cy.ts +++ b/x-pack/solutions/security/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/rule_details/execution_log.cy.ts @@ -12,19 +12,17 @@ import { login } from '../../../../tasks/login'; import { visit } from '../../../../tasks/navigation'; import { ruleDetailsUrl } from '../../../../urls/rule_details'; import { createRule } from '../../../../tasks/api_calls/rules'; -import { waitForAlertsToPopulate } from '../../../../tasks/create_new_rule'; import { goToExecutionLogTab, getExecutionLogTableRow, refreshRuleExecutionTable, filterByRunType, } from '../../../../tasks/rule_details'; -import { getNewRule } from '../../../../objects/rule'; +import { getCustomQueryRuleParams } from '../../../../objects/rule'; import { EXECUTION_SHOWING } from '../../../../screens/rule_details'; import { manualRuleRun } from '../../../../tasks/api_calls/backfill'; -// FLAKY: https://github.com/elastic/kibana/issues/184360 -describe.skip( +describe( 'Event log', { tags: ['@ess', '@serverless'], @@ -38,7 +36,9 @@ describe.skip( login(); deleteAlertsAndRules(); createRule({ - ...getNewRule(), + ...getCustomQueryRuleParams({ + enabled: true, + }), }).then((rule) => { cy.wrap(rule.body.id).as('ruleId'); }); @@ -46,11 +46,23 @@ describe.skip( it('should display the execution log', function () { visit(ruleDetailsUrl(this.ruleId)); - waitForAlertsToPopulate(); goToExecutionLogTab(); + cy.waitUntil( + () => { + cy.log('Waiting for execution logs to appear in execution log table'); + refreshRuleExecutionTable(); + return getExecutionLogTableRow().then((rows) => { + return rows.length > 0; + }); + }, + { interval: 5000, timeout: 20000 } + ); + cy.get(EXECUTION_SHOWING).contains('Showing 1 rule execution'); getExecutionLogTableRow().should('have.length', 1); + + cy.log('Scheduling a manual rule run'); manualRuleRun({ ruleId: this.ruleId, start: moment().subtract(5, 'm').toISOString(), @@ -62,14 +74,16 @@ describe.skip( cy.log('Waiting for execution logs to appear in execution log table'); refreshRuleExecutionTable(); return getExecutionLogTableRow().then((rows) => { - return rows.length === 2; + return rows.length > 1; }); }, { interval: 5000, timeout: 20000 } ); + cy.get(EXECUTION_SHOWING).contains('Showing 2 rule executions'); - filterByRunType('Manual'); + getExecutionLogTableRow().should('have.length', 2); + filterByRunType('Manual'); getExecutionLogTableRow().should('have.length', 1); }); } diff --git a/x-pack/solutions/security/test/security_solution_cypress/cypress/tasks/api_calls/backfill.ts b/x-pack/solutions/security/test/security_solution_cypress/cypress/tasks/api_calls/backfill.ts index bfa495d78abd5..7bf7689962f01 100644 --- a/x-pack/solutions/security/test/security_solution_cypress/cypress/tasks/api_calls/backfill.ts +++ b/x-pack/solutions/security/test/security_solution_cypress/cypress/tasks/api_calls/backfill.ts @@ -27,8 +27,7 @@ export const manualRuleRun = ({ body: [ { rule_id: ruleId, - start, - end, + ranges: [{ start, end }], }, ], });