Skip to content

Commit

Permalink
fix(ui): Add the final api assertion in create alert flow (#1744)
Browse files Browse the repository at this point in the history
* fix(ui): Add the final api assertion in create alert flow

* fix(ui): Updated Anomaly test

* fix(ui): reverted fe-e2e.yaml file
  • Loading branch information
harshilvelotio authored Jan 10, 2025
1 parent d6fbe2d commit be82371
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion thirdeye-ui/e2e/pages/alert-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class AlertDetailsPage extends BasePage {

async assertPageComponents() {
await expect(this.page.locator("h4").first()).toHaveText(
/^Anomaly #\d+(\s\w+)?$/
/^Anomaly #\d+(\s\(\w+\))?$/
);
expect(
this.page.locator("li").filter({ hasText: "Anomalies" })
Expand Down
10 changes: 10 additions & 0 deletions thirdeye-ui/e2e/pages/create-alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ export class CreateAlertPage extends BasePage {
this.evaluateResponseData = await evaluateApiResponse.json();
}

async resolveCreateAlertApis() {
const [createAlertApiResponse] = await Promise.all([
this.page.waitForResponse(
(response) =>
response.url().includes("/api/alerts") &&
response.status() === 200
),
]);
}

async resolveMetricsCohortsApis() {
const [cohortsApiResponse] = await Promise.all([
this.page.waitForResponse(
Expand Down
5 changes: 5 additions & 0 deletions thirdeye-ui/e2e/tests/create-alert.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ test("Create Simple Alert", async ({ page }) => {
await createAlertPage.selectDetectionAlgorithm();
await createAlertPage.resolveEvaluateApis();
await createAlertPage.createAlert();
await createAlertPage.resolveCreateAlertApis();
});

test("Create Multi Dimensions Alert", async ({ page }) => {
Expand All @@ -40,6 +41,7 @@ test("Create Multi Dimensions Alert", async ({ page }) => {
await createAlertPage.selectDetectionAlgorithm(true);
await createAlertPage.resolveEvaluateApis();
await createAlertPage.createAlert();
await createAlertPage.resolveCreateAlertApis();
});

test("Create Multi Dimensions SQL Alert", async ({ page }) => {
Expand All @@ -55,6 +57,7 @@ test("Create Multi Dimensions SQL Alert", async ({ page }) => {
await createAlertPage.clickLoadChartButton();
await createAlertPage.resolveEvaluateApis();
await createAlertPage.createAlert();
await createAlertPage.resolveCreateAlertApis();
});

test("Create Alert With Advanced Options", async ({ page }) => {
Expand All @@ -70,6 +73,7 @@ test("Create Alert With Advanced Options", async ({ page }) => {
await createAlertPage.addAdvancedOptions();
await createAlertPage.resolveEvaluateApis();
await createAlertPage.createAlert();
await createAlertPage.resolveCreateAlertApis();
});

test("Create Alert With Custom Metric", async ({ page }) => {
Expand All @@ -83,4 +87,5 @@ test("Create Alert With Custom Metric", async ({ page }) => {
await createAlertPage.selectDetectionAlgorithm();
await createAlertPage.resolveEvaluateApis();
await createAlertPage.createAlert();
await createAlertPage.resolveCreateAlertApis();
});

0 comments on commit be82371

Please sign in to comment.