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

#12720 Repro: Dashboard filter connected to a card without data-permissions...

#12720 Repro: Dashboard filter connected to a card without data-permissions blocking QB question (#14557) [ci skip]

* Add repro for #12720 [ci skip]

* Test both question types (QB and SQL) [ci skip]
parent 9c07148e
Branches
Tags
No related merge requests found
......@@ -3,6 +3,7 @@
import {
popover,
restore,
signIn,
signInAsAdmin,
selectDashboardFilter,
} from "__support__/cypress";
......@@ -324,6 +325,116 @@ describe("scenarios > dashboard", () => {
checkOptionsForFilter("Category");
});
it.skip("should show QB question on a dashboard with filter connected to card without data-permission (metabase#12720)", () => {
// In this test we're using already present question ("Orders") and the dashboard with that question ("Orders in a dashboard")
cy.log(
"**-- 1. Add filter to the dashboard with the default value (after January 1st, 2020) --**",
);
cy.request("PUT", "/api/dashboard/1", {
parameters: [
{
default: "2020-01-01~",
id: "d3b78b27",
name: "Date Filter",
slug: "date_filter",
type: "date/all-options",
},
],
});
cy.log("**-- 2. Create SQL question with a filter --**");
cy.request("POST", "/api/card", {
name: "12720_SQL",
dataset_query: {
type: "native",
native: {
query: "SELECT * FROM ORDERS WHERE {{filter}}",
"template-tags": {
filter: {
id: "1d006bb7-045f-6c57-e41b-2661a7648276",
name: "filter",
"display-name": "Filter",
type: "dimension",
dimension: ["field-id", ORDERS.CREATED_AT],
"widget-type": "date/month-year",
default: null,
},
},
},
database: 1,
},
display: "table",
visualization_settings: {},
}).then(({ body: { id: SQL_ID } }) => {
cy.log("**-- 3. Add SQL question to the dashboard --**");
cy.request("POST", "/api/dashboard/1/cards", {
cardId: SQL_ID,
}).then(({ body: { id: SQL_DASH_CARD_ID } }) => {
cy.log(
"**-- 4. Edit both cards (adjust their size and connect them to the filter) --**",
);
cy.request("PUT", "/api/dashboard/1/cards", {
cards: [
{
id: 1,
card_id: 1,
row: 0,
col: 0,
sizeX: 5,
sizeY: 5,
parameter_mappings: [
{
parameter_id: "d3b78b27",
card_id: 1,
target: ["dimension", ["field-id", ORDERS.CREATED_AT]],
},
],
visualization_settings: {},
},
{
id: SQL_DASH_CARD_ID,
card_id: SQL_ID,
row: 0,
col: 6, // previous card's sizeX + 1 (making sure they don't overlap)
sizeX: 5,
sizeY: 5,
parameter_mappings: [
{
parameter_id: "d3b78b27",
card_id: SQL_ID,
target: ["dimension", ["template-tag", "filter"]],
},
],
visualization_settings: {},
},
],
});
});
});
cy.server();
cy.route("POST", "/api/card/*/query").as("cardQuery");
signIn("nodata");
clickThrough("12720_SQL");
clickThrough("Orders");
/**
* Helper function related to this test only
*/
function clickThrough(title) {
cy.visit("/dashboard/1");
cy.wait("@cardQuery.all");
cy.get(".LegendItem")
.contains(title)
.click();
cy.findByText(/^January 17, 2020/);
}
});
describe("revisions screen", () => {
it("should open and close", () => {
cy.visit("/dashboard/1");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment