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

Repro #24500: Corrupted dashboard filter makes it impossible to view the question (#24502)

* Update the syntax

* Rename filters

* Add repro for #24500

* Skip the repro

* Rename file

* Address comment and fix the syntax

* Improve the test title
parent c3ce0533
No related branches found
No related tags found
No related merge requests found
import { restore, filterWidget, visitDashboard } from "__support__/e2e/helpers";
import {
restore,
filterWidget,
visitDashboard,
popover,
editDashboard,
saveDashboard,
} from "__support__/e2e/helpers";
import { SAMPLE_DATABASE } from "__support__/e2e/cypress_sample_database";
const { PEOPLE, PEOPLE_ID } = SAMPLE_DATABASE;
const firstFilter = {
const listFilter = {
name: "List",
slug: "list",
id: "6fe14171",
type: "category",
type: "string/=",
sectionId: "string",
};
const secondFilter = {
const searchFilter = {
name: "Search",
slug: "search",
id: "4db4913a",
type: "category",
type: "string/=",
sectionId: "string",
};
// This filter is corrupted because it's missing `name` and `slug`
......@@ -22,31 +31,29 @@ const corruptedFilter = {
name: "",
slug: "",
id: "af72ce9c",
type: "category",
type: "string/=",
sectionId: "string",
};
const parameters = [firstFilter, secondFilter, corruptedFilter];
const parameters = [listFilter, searchFilter, corruptedFilter];
const questionDetails = {
name: "15279",
query: { "source-table": PEOPLE_ID },
};
describe("issue 15279", () => {
const dashboardDetails = { parameters };
describe.skip("issues 15279 and 24500", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
});
it("a corrupted parameter filter should still appear in the UI (metabase #15279)", () => {
cy.createQuestionAndDashboard({ questionDetails }).then(
it("corrupted dashboard filter should still appear in the UI without breaking other filters (metabase#15279, metabase#24500)", () => {
cy.createQuestionAndDashboard({ questionDetails, dashboardDetails }).then(
({ body: { id, card_id, dashboard_id } }) => {
// Add filters to the dashboard
cy.request("PUT", `/api/dashboard/${dashboard_id}`, {
parameters,
});
// Connect filters to that question
// Connect filters to the question
cy.request("PUT", `/api/dashboard/${dashboard_id}/cards`, {
cards: [
{
......@@ -60,14 +67,14 @@ describe("issue 15279", () => {
visualization_settings: {},
parameter_mappings: [
{
parameter_id: firstFilter.id,
parameter_id: listFilter.id,
card_id,
target: ["dimension", ["field-id", PEOPLE.SOURCE]],
target: ["dimension", ["field", PEOPLE.SOURCE, null]],
},
{
parameter_id: secondFilter.id,
parameter_id: searchFilter.id,
card_id,
target: ["dimension", ["field-id", PEOPLE.NAME]],
target: ["dimension", ["field", PEOPLE.NAME, null]],
},
],
},
......@@ -82,20 +89,38 @@ describe("issue 15279", () => {
// Check that list filter works
filterWidget().contains("List").click();
cy.wait("@values");
cy.findByTextEnsureVisible("Add filter");
cy.findByPlaceholderText("Enter some text").type("Organic").blur();
cy.findByPlaceholderText("Search the list").type("Or").blur();
popover().contains("Organic").click();
cy.button("Add filter").click();
cy.get(".DashCard")
.should("contain", "Lora Cronin")
.and("contain", "Dagmar Fay");
// Check that the search filter works
filterWidget().contains("Search").click();
cy.findByPlaceholderText("Search by Name").type("Lora Cronin");
cy.button("Add filter").click();
cy.get(".DashCard")
.should("contain", "Lora Cronin")
.and("not.contain", "Dagmar Fay");
// The corrupted filter is now present in the UI, but it doesn't work (as expected)
// People can now easily remove it
cy.findByText("Select…");
editDashboard();
filterWidget().last().find(".Icon-gear").click();
// Uncomment the next line if we end up disabling fields for the corrupted filter
// cy.findByText("No valid fields")
cy.findByText("Remove").click();
saveDashboard();
cy.get(".DashCard")
.should("contain", "Lora Cronin")
.and("not.contain", "Dagmar Fay");
});
});
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