From aa96f8ccbbfdc69b8c7365391bc039cac58cb942 Mon Sep 17 00:00:00 2001 From: Nalin Patidar Date: Fri, 24 Jan 2025 18:28:19 +0530 Subject: [PATCH] fix broken test --- thirdeye-ui/e2e/pages/alert-list.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/thirdeye-ui/e2e/pages/alert-list.ts b/thirdeye-ui/e2e/pages/alert-list.ts index 79632b83ce..ccfbf6ab81 100644 --- a/thirdeye-ui/e2e/pages/alert-list.ts +++ b/thirdeye-ui/e2e/pages/alert-list.ts @@ -207,7 +207,10 @@ export class AlertListPage extends BasePage { const jsonEditor = this.page.locator(".CodeMirror"); await jsonEditor.click(); - const editedAlert = `{"id": ${topAlert.id}, "name": "Clicks_SUM_mean-variance-rule-dup-edit","description": "","template": {"name": "startree-mean-variance"},"templateProperties": {"dataSource": "pinot","dataset": "AdCampaignData","aggregationColumn": "Clicks","aggregationFunction": "SUM","monitoringGranularity": "P1D","timezone": "UTC","queryFilters": "","sensitivity": "-6","lookback": "P21D"},"cron": "0 0 5 ? * MON-FRI *","auth": {"namespace": null}}`; + const date = new Date(); + const editedAlert = `{"id": ${ + topAlert.id + }, "name": "Clicks_SUM_mean-variance-rule-dup-edit${date.getTime()}","description": "","template": {"name": "startree-mean-variance"},"templateProperties": {"dataSource": "pinot","dataset": "AdCampaignData","aggregationColumn": "Clicks","aggregationFunction": "SUM","monitoringGranularity": "P1D","timezone": "UTC","queryFilters": "","sensitivity": "-6","lookback": "P21D"},"cron": "0 0 5 ? * MON-FRI *","auth": {"namespace": null}}`; await this.page.evaluate((editedAlert) => { const editor = document.querySelector(".CodeMirror")?.CodeMirror; editor.setValue(editedAlert); @@ -253,10 +256,13 @@ export class AlertListPage extends BasePage { await expect(saveButtonAfterLoadChart).toBeEnabled(); await expect(saveButtonAfterLoadChart).toHaveText("Update Alert"); - const updateApiRequest = this.page.waitForRequest("/api/alerts"); - const updateApiResponse = this.page.waitForResponse("/api/alerts"); saveButtonAfterLoadChart.click(); + const updateButtonModal = this.page.locator(`.MuiDialog-paper button`); + const updateBtn = updateButtonModal.nth(1); + const updateApiRequest = this.page.waitForRequest("/api/alerts"); + const updateApiResponse = this.page.waitForResponse("/api/alerts"); + updateBtn.click(); const updateAlertRequest = await updateApiRequest; const updateAlertResponse = await updateApiResponse;