Skip to content
Snippets Groups Projects
Unverified Commit 2c8bf0f8 authored by Kamil Mielnik's avatar Kamil Mielnik Committed by GitHub
Browse files

Repro #27521 - Query fails when selecting two fields from nested query, when...

Repro #27521 - Query fails when selecting two fields from nested query, when fields are identical except for their join-alias (#44909)

* Add repro for #27521

* Improve assertions

* Add comments

* Use saveQuestion helper

* Use openOrdersTable helper
parent 7fafc1aa
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,9 @@ import {
visitDashboard,
chartPathWithFillColor,
echartsContainer,
join,
newButton,
saveQuestion,
} from "e2e/support/helpers";
const {
......@@ -1135,3 +1138,98 @@ describe("issue 39448", () => {
});
});
});
// See TODO inside this test when unskipping
describe.skip("issue 27521", () => {
beforeEach(() => {
restore();
cy.signInAsNormalUser();
});
it("correctly displays joined question's column names (metabase#27521)", () => {
cy.visit("/");
cy.log("Create Q1");
openOrdersTable({ mode: "notebook" });
getNotebookStep("data").button("Pick columns").click();
popover().findByText("Select none").click();
join();
entityPickerModal().within(() => {
entityPickerModalTab("Tables").click();
cy.findByText("Orders").click();
});
popover().findByText("ID").click();
popover().findByText("ID").click();
getNotebookStep("join", { stage: 0, index: 0 })
.button("Pick columns")
.click();
popover().within(() => {
cy.findByText("Select none").click();
cy.findByText("ID").click();
});
visualize();
assertTableHeader(0, "ID");
assertTableHeader(1, "Orders → ID");
saveQuestion("Q1");
assertTableHeader(0, "ID");
assertTableHeader(1, "Orders → ID");
cy.log("Create second question (Products + Q1)");
newButton("Question").click();
entityPickerModal().within(() => {
entityPickerModalTab("Tables").click();
cy.findByText("People").click();
});
getNotebookStep("data").button("Pick columns").click();
popover().findByText("Select none").click();
join();
entityPickerModal().within(() => {
entityPickerModalTab("Saved questions").click();
cy.findByText("Q1").click();
});
popover().findByText("ID").click();
popover().findByText("Orders → ID").should("be.visible").click();
getNotebookStep("join")
.findByLabelText("Right column")
.findByText("Orders → ID")
.should("be.visible")
.click();
popover().findByText("ID").should("be.visible").click();
visualize();
assertTableHeader(0, "ID");
assertTableHeader(1, "Q1 → ID");
assertTableHeader(2, "Q1 → Orders → ID");
cy.findByTestId("viz-settings-button").click();
cy.findByTestId("chartsettings-sidebar").within(() => {
cy.findAllByText("ID").should("have.length", 1);
cy.findAllByText("Q1 → ID").should("have.length", 1);
cy.findAllByText("Q1 → Orders → ID").should("have.length", 1);
cy.findByRole("button", { name: "Add or remove columns" }).click();
cy.findAllByText("ID").should("have.length", 2);
cy.findAllByText("Orders → ID").should("have.length", 1);
// TODO: add assertions for what happens when toggling all the columns here
// See https://github.com/metabase/metabase/issues/27521#issuecomment-1948658757
});
});
function assertTableHeader(index, name) {
cy.findAllByTestId("header-cell").eq(index).should("have.text", name);
}
});
......@@ -533,9 +533,13 @@ describe.skip("issue 40635", () => {
});
function assertVisualizationColumns() {
cy.findAllByTestId("header-cell").should("contain", "ID");
cy.findAllByTestId("header-cell").should("contain", "Products → ID");
cy.findAllByTestId("header-cell").should("contain", "Products_2 → ID");
assertTableHeader(0, "ID");
assertTableHeader(1, "Products → ID");
assertTableHeader(2, "Products_2 → ID");
}
function assertTableHeader(index: number, name: string) {
cy.findAllByTestId("header-cell").eq(index).should("have.text", name);
}
function assertSettingsSidebar() {
......
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