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

#13961 Repro: Should clear the default filter value for native questions (#14036) [ci skip]

parent 5cf43b8e
No related branches found
No related tags found
No related merge requests found
......@@ -334,4 +334,72 @@ describe("scenarios > question > filter", () => {
});
});
});
it.skip("should clear default filter value in native questions (metabase#13961)", () => {
const QUESTION_NAME = "13961";
const [CATEGORY_FILTER, ID_FILTER] = [
{ name: "category", display_name: "Category", type: "dimension" },
{ name: "prodid", display_name: "ProdId", type: "number" },
];
cy.request("POST", "/api/card", {
name: QUESTION_NAME,
dataset_query: {
type: "native",
native: {
query:
"SELECT * FROM PRODUCTS WHERE 1=1 AND {{category}} [[AND ID={{prodid}}]]",
"template-tags": {
[CATEGORY_FILTER.name]: {
id: "00315d5e-4a41-99da-1a41-e5254dacff9d",
name: CATEGORY_FILTER.name,
"display-name": CATEGORY_FILTER.display_name,
type: CATEGORY_FILTER.type,
default: "Doohickey",
dimension: ["field-id", PRODUCTS.CATEGORY],
"widget-type": "category",
},
[ID_FILTER.name]: {
id: "4775bccc-e82a-4069-fc6b-2acc90aadb8b",
name: ID_FILTER.name,
"display-name": ID_FILTER.display_name,
type: ID_FILTER.type,
default: null,
},
},
},
database: 1,
},
display: "table",
visualization_settings: {},
}).then(({ body: { id: QUESTION_ID } }) => {
cy.visit(`/question/${QUESTION_ID}`);
cy.findByText(QUESTION_NAME);
cy.findAllByText("Small Marble Shoes"); // Product ID 2, Doohickey
cy.location("search").should("eq", "?category=Doohickey");
// Remove default filter (category)
cy.get("fieldset .Icon-close").click();
cy.get(".Icon-play")
.first()
.should("be.visible")
.as("rerunQuestion");
cy.get("@rerunQuestion").click();
cy.url().should("not.include", "?category=Doohickey");
// Add value `1` to the ID filter
cy.findByPlaceholderText(ID_FILTER.display_name).type("1");
cy.get("@rerunQuestion").click();
cy.log("**--Reported tested and failing on v0.34.3 through v0.37.3--**");
cy.log("**URL is correct at this point, but there are no results**");
cy.location("search").should("eq", `?${ID_FILTER.name}=1`);
cy.findByText("Rustic Paper Wallet"); // Product ID 1, Gizmo
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment