Skip to content
Snippets Groups Projects
Unverified Commit 9958ba54 authored by github-automation-metabase's avatar github-automation-metabase Committed by GitHub
Browse files

Fix flaky alert tests (#49673) (#49821)


* Fix flaky tests

* Fix flaky tests

Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>
parent 9a43165a
Branches
Tags
No related merge requests found
......@@ -4,6 +4,7 @@ import {
ORDERS_QUESTION_ID,
} from "e2e/support/cypress_sample_instance_data";
import {
modal,
openSharingMenu,
restore,
setupSMTP,
......@@ -47,6 +48,7 @@ const rawTestCases = [
describe("scenarios > alert > types", { tags: "@external" }, () => {
beforeEach(() => {
cy.intercept("POST", "/api/alert").as("savedAlert");
cy.intercept("GET", "/api/channel").as("channel");
restore();
cy.signInAsAdmin();
......@@ -61,9 +63,12 @@ describe("scenarios > alert > types", { tags: "@external" }, () => {
visitQuestion(questionId);
openSharingMenu("Create alert");
cy.wait("@channel");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Done").click();
modal().within(() => {
cy.findByText("Let's set up your alert").should("be.visible");
cy.findByText("Done").click();
});
cy.wait("@savedAlert").then(({ response: { body } }) => {
expect(body.alert_condition).to.equal("rows");
......@@ -88,6 +93,8 @@ describe("scenarios > alert > types", { tags: "@external" }, () => {
cy.findByTestId("chart-container").should("contain", "Goal");
openSharingMenu("Create alert");
cy.wait("@channel");
cy.findByTestId("alert-create").within(() => {
cy.findByText("Reaches the goal line").click();
cy.findByText("The first time").click();
......@@ -106,14 +113,17 @@ describe("scenarios > alert > types", { tags: "@external" }, () => {
cy.createQuestion(multiSeriesQuestionWithGoal, { visitQuestion: true });
openSharingMenu("Create alert");
cy.wait("@channel");
// *** The warning below is not showing when we try to make an alert (Issue #???)
// cy.contains(
// "Goal-based alerts aren't yet supported for charts with more than one line",
// );
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Done").click();
modal().within(() => {
cy.findByText("Let's set up your alert").should("be.visible");
cy.findByText("Done").click();
});
// The alert condition should fall back to rows
cy.wait("@savedAlert").then(({ response: { body } }) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment