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

Update repro for #13990 with new metadata method [ci skip] (#14011)

parent 76968e8f
Branches
Tags
No related merge requests found
......@@ -4,12 +4,11 @@ import {
popover,
openOrdersTable,
openReviewsTable,
withSampleDataset,
} from "__support__/cypress";
import { SAMPLE_DATASET } from "__support__/cypress_sample_dataset";
const { ORDERS_ID } = SAMPLE_DATASET;
const { ORDERS, ORDERS_ID } = SAMPLE_DATASET;
// test various entry points into the query builder
......@@ -40,64 +39,62 @@ describe("scenarios > question > new", () => {
});
it.skip("should handle (removing) multiple metrics when one is sorted (metabase#13990)", () => {
withSampleDataset(({ ORDERS, ORDERS_ID }) => {
cy.request("POST", "/api/card", {
name: "12625",
dataset_query: {
database: 1,
query: {
"source-table": ORDERS_ID,
aggregation: [
["count"],
["sum", ["field-id", ORDERS.SUBTOTAL]],
["sum", ["field-id", ORDERS.TOTAL]],
],
breakout: [
["datetime-field", ["field-id", ORDERS.CREATED_AT], "year"],
],
"order-by": [["desc", ["aggregation", 1]]],
},
type: "query",
cy.request("POST", "/api/card", {
name: "12625",
dataset_query: {
database: 1,
query: {
"source-table": ORDERS_ID,
aggregation: [
["count"],
["sum", ["field-id", ORDERS.SUBTOTAL]],
["sum", ["field-id", ORDERS.TOTAL]],
],
breakout: [
["datetime-field", ["field-id", ORDERS.CREATED_AT], "year"],
],
"order-by": [["desc", ["aggregation", 1]]],
},
display: "table",
visualization_settings: {},
}).then(({ body: { id: QESTION_ID } }) => {
cy.server();
cy.route("POST", `/api/card/${QESTION_ID}/query`).as("cardQuery");
cy.route("POST", `/api/dataset`).as("dataset");
cy.visit(`/question/${QESTION_ID}`);
cy.wait("@cardQuery");
cy.get("button")
.contains("Summarize")
.click();
// CSS class of a sorted header cell
cy.get("[class*=TableInteractive-headerCellData--sorted]").as(
"sortedCell",
);
// At this point only "Sum of Subtotal" should be sorted
cy.get("@sortedCell")
.its("length")
.should("eq", 1);
removeMetricFromSidebar("Sum of Subtotal");
cy.wait("@dataset");
cy.findByText("Sum of Subtotal").should("not.exist");
// "Sum of Total" should not be sorted, nor any other header cell
cy.get("@sortedCell")
.its("length")
.should("eq", 0);
removeMetricFromSidebar("Sum of Total");
cy.wait("@dataset");
cy.findByText(/No results!/i).should("not.exist");
cy.contains("744"); // `Count` for year 2016
});
type: "query",
},
display: "table",
visualization_settings: {},
}).then(({ body: { id: QESTION_ID } }) => {
cy.server();
cy.route("POST", `/api/card/${QESTION_ID}/query`).as("cardQuery");
cy.route("POST", `/api/dataset`).as("dataset");
cy.visit(`/question/${QESTION_ID}`);
cy.wait("@cardQuery");
cy.get("button")
.contains("Summarize")
.click();
// CSS class of a sorted header cell
cy.get("[class*=TableInteractive-headerCellData--sorted]").as(
"sortedCell",
);
// At this point only "Sum of Subtotal" should be sorted
cy.get("@sortedCell")
.its("length")
.should("eq", 1);
removeMetricFromSidebar("Sum of Subtotal");
cy.wait("@dataset");
cy.findByText("Sum of Subtotal").should("not.exist");
// "Sum of Total" should not be sorted, nor any other header cell
cy.get("@sortedCell")
.its("length")
.should("eq", 0);
removeMetricFromSidebar("Sum of Total");
cy.wait("@dataset");
cy.findByText(/No results!/i).should("not.exist");
cy.contains("744"); // `Count` for year 2016
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment