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

#14985 Repro: Pivot table breaks with custom mapping of display values (#15018)

parent faa6d3b8
No related branches found
No related tags found
No related merge requests found
......@@ -5,10 +5,19 @@ import {
visitQuestionAdhoc,
getIframeBody,
popover,
sidebar,
} from "__support__/cypress";
import { SAMPLE_DATASET } from "__support__/cypress_sample_dataset";
const { ORDERS, ORDERS_ID, PRODUCTS, PRODUCTS_ID, PEOPLE } = SAMPLE_DATASET;
const {
ORDERS,
ORDERS_ID,
PRODUCTS,
PRODUCTS_ID,
PEOPLE,
REVIEWS,
REVIEWS_ID,
} = SAMPLE_DATASET;
const QUESTION_NAME = "Cypress Pivot Table";
const DASHBOARD_NAME = "Pivot Table Dashboard";
......@@ -693,6 +702,54 @@ describe("scenarios > visualizations > pivot tables", () => {
cy.findByText("Row totals");
cy.findByText("200");
});
it.skip("should work with custom mapping of display values (metabase#14985)", () => {
cy.server();
cy.route("POST", "/api/dataset").as("dataset");
cy.route("POST", "/api/dataset/pivot").as("datasetPivot");
cy.log("Remap 'Reviews Rating' display values to custom values");
cy.request("POST", `/api/field/${REVIEWS.RATING}/dimension`, {
name: "Rating",
type: "internal",
human_readable_field_id: null,
});
cy.request("POST", `/api/field/${REVIEWS.RATING}/values`, {
values: [[1, "A"], [2, "B"], [3, "C"], [4, "D"], [5, "E"]],
});
visitQuestionAdhoc({
dataset_query: {
database: 1,
query: {
"source-table": REVIEWS_ID,
aggregation: [["count"]],
breakout: [
["field-id", REVIEWS.RATING],
["datetime-field", ["field-id", REVIEWS.CREATED_AT], "year"],
],
},
type: "query",
},
display: "line",
});
cy.wait("@dataset");
cy.findByText("Visualization").click();
sidebar().within(() => {
cy.findByText("Pivot Table")
.parent()
.should("have.css", "opacity", "1");
cy.icon("pivot_table").click({ force: true });
});
cy.wait("@datasetPivot");
cy.get(".Visualization").within(() => {
cy.contains("Row totals");
cy.findByText("333"); // Row totals for 2018
cy.findByText("Grand totals");
});
});
});
const testQuery = {
......
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