Skip to content

Commit c346f16

Browse files
fix(ui): TE-XXXX flaky tests fix (#1798)
1 parent 91ea069 commit c346f16

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

thirdeye-ui/e2e/pages/alert-list.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,24 +148,26 @@ export class AlertListPage extends BasePage {
148148

149149
const jsonEditor = this.page.locator(".CodeMirror");
150150
await jsonEditor.click();
151-
152-
await this.page.evaluate(() => {
151+
const date = new Date();
152+
await this.page.evaluate((date) => {
153153
const editor = document.querySelector(".CodeMirror")?.CodeMirror;
154154
editor.setValue(
155-
'{"name": "Clicks_SUM_mean-variance-rule-dup","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}}'
155+
`{"name": "Clicks_SUM_mean-variance-rule-dup${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}}`
156156
);
157-
});
157+
}, date);
158158
const createBtn = this.page.locator("#next-bottom-bar-btn");
159159
await expect(createBtn).toHaveText("Create Alert");
160160
const createAlertApiRequest = this.page.waitForRequest("/api/alerts");
161161
const createAlertApiResponse = this.page.waitForResponse("/api/alerts");
162162
createBtn.click({ force: true });
163-
const createAlertRequest = await createAlertApiRequest;
164-
const createAlertResponse = await createAlertApiResponse;
163+
const [createAlertRequest, createAlertResponse] = await Promise.all([
164+
createAlertApiRequest,
165+
createAlertApiResponse,
166+
]);
165167

166168
expect(createAlertRequest.method()).toBe("POST");
167169
expect(createAlertRequest.postDataJSON()[0]).toEqual({
168-
name: "Clicks_SUM_mean-variance-rule-dup",
170+
name: `Clicks_SUM_mean-variance-rule-dup${date.getTime()}`,
169171
description: "",
170172
template: { name: "startree-mean-variance" },
171173
templateProperties: {

thirdeye-ui/e2e/tests/anomalies.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ test("Investigate Anomaly", async ({ page }) => {
2121
await alertDetailsPage.resolveApis();
2222
await alertDetailsPage.checkHeader();
2323
await alertDetailsPage.openFirstAlert();
24+
await alertDetailsPage.resolveDetailsPageApis();
25+
await page.waitForTimeout(1000);
2426
await alertDetailsPage.checkAlertHeader();
2527
const anomalyDisabled = await alertDetailsPage.checkAnomaliesCount();
2628
if (anomalyDisabled) {

0 commit comments

Comments
 (0)