Skip to content

Commit

Permalink
fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
nalin-patidar committed Jan 24, 2025
1 parent d5487bb commit aa96f8c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions thirdeye-ui/e2e/pages/alert-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit aa96f8c

Please sign in to comment.