Skip to content
Snippets Groups Projects
Unverified Commit 8f9c2403 authored by Anton Kulyk's avatar Anton Kulyk Committed by GitHub
Browse files

Fix E2E flake in repro for 23293 (#35144)

parent e5531875
Branches
Tags
No related merge requests found
......@@ -3,6 +3,7 @@ import {
popover,
openOrdersTable,
visitDashboard,
queryBuilderHeader,
} from "e2e/support/helpers";
import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
......@@ -12,6 +13,8 @@ describe("issue 23293", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
cy.intercept("POST", "/api/card").as("saveQuestion");
});
it("should retain the filter when drilling through the dashboard card with implicitly added column (metabase#23293)", () => {
......@@ -22,55 +25,55 @@ describe("issue 23293", () => {
modifyColumn("Category", "add");
cy.wait("@dataset");
saveQuestion().then(
({
response: {
body: { id },
},
}) => {
const questionDetails = {
query: {
"source-table": `card__${id}`,
aggregation: [["count"]],
breakout: [
[
"field",
PRODUCTS.CATEGORY,
{
"source-field": ORDERS.PRODUCT_ID,
},
],
queryBuilderHeader().button("Save").click();
cy.get(".Modal").button("Save").click();
cy.wait("@saveQuestion").then(({ response }) => {
cy.get(".Modal").button("Not now").click();
const id = response.body.id;
const questionDetails = {
query: {
"source-table": `card__${id}`,
aggregation: [["count"]],
breakout: [
[
"field",
PRODUCTS.CATEGORY,
{
"source-field": ORDERS.PRODUCT_ID,
},
],
},
display: "bar",
};
],
},
display: "bar",
};
cy.createQuestionAndDashboard({ questionDetails }).then(
({ body: { dashboard_id } }) => {
visitDashboard(dashboard_id);
},
);
cy.createQuestionAndDashboard({ questionDetails }).then(
({ body: { dashboard_id } }) => {
visitDashboard(dashboard_id);
},
);
cy.get(".bar").first().realClick();
popover()
.findByText(/^See these/)
.click();
cy.get(".bar").first().realClick();
popover()
.findByText(/^See these/)
.click();
cy.findByTestId("qb-filters-panel").should(
"contain",
"Product → Category is Doohickey",
);
cy.findAllByTestId("header-cell")
.last()
.should("have.text", "Product → Category");
cy.findByTestId("qb-filters-panel").should(
"contain",
"Product → Category is Doohickey",
);
cy.findAllByTestId("header-cell")
.last()
.should("have.text", "Product → Category");
cy.findAllByRole("grid")
.last()
.as("tableResults")
.should("contain", "Doohickey")
.and("not.contain", "Gizmo");
},
);
cy.findAllByRole("grid")
.last()
.as("tableResults")
.should("contain", "Doohickey")
.and("not.contain", "Gizmo");
});
});
});
......@@ -83,13 +86,3 @@ function modifyColumn(columnName, action) {
const iconSelector = `.Icon-${icon}`;
cy.findAllByRole("listitem", { name: columnName }).find(iconSelector).click();
}
function saveQuestion() {
cy.intercept("POST", "/api/card").as("saveQuestion");
cy.findByTestId("qb-header-action-panel").findByText("Save").click();
cy.get(".Modal").button("Save").click();
cy.get(".Modal").button("Not now").click();
return cy.wait("@saveQuestion");
}
......@@ -526,6 +526,7 @@ function ViewTitleHeaderRightSide(props) {
)}
{hasSaveButton && (
<SaveButton
role="button"
disabled={!question.canRun() || !canEditQuery}
tooltip={{
tooltip: t`You don't have permission to save this question.`,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment