Skip to content
Snippets Groups Projects
Unverified Commit 442cedd5 authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

Fix flaky E2E segments test (#44487)

parent 105a72a0
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ import {
summarize,
modal,
filter,
filterField,
saveQuestion,
visitQuestion,
} from "e2e/support/helpers";
import { createSegment } from "e2e/support/helpers/e2e-table-metadata-helpers";
......@@ -749,50 +749,36 @@ describe("scenarios > admin > datamodel > segments", () => {
cy.findByText("Preview");
});
it("should show no questions based on a new segment", () => {
it("should see a newly asked question in its questions list", () => {
cy.intercept("GET", "/api/table/*/query_metadata*").as("metadata");
// Ask question
cy.visit("/reference/segments/1/questions");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText(`Questions about ${SEGMENT_NAME}`);
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText(
"Questions about this segment will appear here as they're added",
);
});
cy.wait(["@metadata", "@metadata", "@metadata"]);
it(
"should see a newly asked question in its questions list",
{ tags: "@flaky" },
() => {
// Ask question
cy.visit("/reference/segments/1/questions");
cy.button("Ask a question").click();
cy.findAllByText("37.65");
filter();
filterField("Product ID", {
value: "14",
});
cy.findByTestId("apply-filters").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Product ID is 14");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Save").click();
cy.findAllByText("Save").last().click();
// Check list
cy.visit("/reference/segments/1/questions");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText(
cy.get("main").should("contain", `Questions about ${SEGMENT_NAME}`);
cy.findByRole("status")
.as("emptyStateMessage")
.should(
"have.text",
"Questions about this segment will appear here as they're added",
).should("not.exist");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText(
`Orders, Filtered by ${SEGMENT_NAME} and Product ID is 14`,
);
},
);
cy.button("Ask a question").click();
cy.findByTestId("filter-pill").should("have.text", "Orders < 100");
cy.findAllByTestId("cell-data").should("contain", "37.65");
summarize();
cy.findAllByTestId("sidebar-right").button("Done").click();
cy.findByTestId("scalar-value").should("have.text", "13,005");
saveQuestion("Foo");
// Check list
cy.visit("/reference/segments/1/questions");
cy.wait(["@metadata", "@metadata", "@metadata"]);
cy.get("@emptyStateMessage").should("not.exist");
cy.findByRole("heading", { name: "Foo" }).should("be.visible");
});
it("should update that segment", () => {
cy.visit("/admin");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment