Skip to content

Commit 2e6f654

Browse files
Claude Agentclaude
andcommitted
fix(tests): address CodeRabbit review findings
- waitUntil timeout: add one extra interval to avoid off-by-one where the last poll fires 2 min before timeout expires - 03-04.reg_e2e_firing_alerts: add missing warmUpForPlugin() call that all other regression specs already have - incidents-page.ts: extract _resetSearchState() helper and use it on both success and error paths so _quietSearch and _findIncidentSearchStart don't leak across specs on failure Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0d43a91 commit 2e6f654

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

web/cypress/e2e/incidents/00.coo_incidents_e2e.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('BVT: Incidents - e2e', { tags: ['@smoke', '@slow', '@incidents', '@e2e
5252
// This makes it safe to poll for the full 30-minute window.
5353
cy.waitUntil(() => incidentsPage.findIncidentWithAlert(currentAlertName), {
5454
interval: 2 * intervalMs,
55-
timeout: 30 * intervalMs,
55+
timeout: 30 * intervalMs + 2 * intervalMs,
5656
});
5757

5858
cy.log('1.3 Verify custom alert appears in alerts table');

web/cypress/e2e/incidents/regression/03-04.reg_e2e_firing_alerts.cy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ describe(
4141

4242
before(() => {
4343
cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false });
44+
incidentsPage.warmUpForPlugin();
4445

4546
// Reset the search timeout so this spec gets a fresh 35-minute window
4647
incidentsPage.resetSearchTimeout();

web/cypress/views/incidents-page.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ const _FIND_INCIDENT_HARD_TIMEOUT_MS = 35 * 60 * 1000; // 35 minutes
1313
let _quietSearch = false;
1414
const _qLog = (): { log: false } | Record<string, never> => (_quietSearch ? { log: false } : {});
1515

16+
const _resetSearchState = () => {
17+
_findIncidentSearchStart = null;
18+
_quietSearch = false;
19+
};
20+
1621
export const incidentsPage = {
1722
// Centralized element selectors - all selectors defined in one place
1823
elements: {
@@ -637,7 +642,7 @@ export const incidentsPage = {
637642
},
638643

639644
resetSearchTimeout: () => {
640-
_findIncidentSearchStart = null;
645+
_resetSearchState();
641646
},
642647

643648
// Constants for search configuration
@@ -840,8 +845,7 @@ export const incidentsPage = {
840845
}
841846
const elapsed = Date.now() - _findIncidentSearchStart;
842847
if (elapsed > _FIND_INCIDENT_HARD_TIMEOUT_MS) {
843-
_findIncidentSearchStart = null;
844-
_quietSearch = false;
848+
_resetSearchState();
845849
const mins = Math.round(elapsed / 60000);
846850
throw new Error(`findIncidentWithAlert: hard timeout after ${mins} min for "${alertName}"`);
847851
}
@@ -867,9 +871,10 @@ export const incidentsPage = {
867871
return incidentsPage.traverseAllIncidentsBars(alertName, totalPaths);
868872
})
869873
.then((found: boolean) => {
870-
_quietSearch = false;
871874
if (found) {
872-
_findIncidentSearchStart = null;
875+
_resetSearchState();
876+
} else {
877+
_quietSearch = false;
873878
}
874879
return found;
875880
});

0 commit comments

Comments
 (0)