diff --git a/frontend/test/metabase/scenarios/visualizations/reproductions/22206-add-remove-column.cy.spec.js b/frontend/test/metabase/scenarios/visualizations/reproductions/22206-add-remove-column.cy.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..05d3eec6334eecf4f7f0e6fec960f671135c2c4c --- /dev/null +++ b/frontend/test/metabase/scenarios/visualizations/reproductions/22206-add-remove-column.cy.spec.js @@ -0,0 +1,44 @@ +import { restore, openOrdersTable } from "__support__/e2e/cypress"; + +describe("#22206 adding and removing columns doesn't duplicate columns", () => { + beforeEach(() => { + restore(); + cy.signInAsNormalUser(); + openOrdersTable(); + + cy.findByTestId("loading-spinner").should("not.exist"); + }); + + it("should not duplicate column in settings when removing and adding it back", () => { + cy.findByText("Settings").click(); + + // remove column + cy.findByTestId("sidebar-content") + .findByText("Subtotal") + .parent() + .find(".Icon-close") + .click(); + + // rerun query + cy.get(".RunButton") + .first() + .click(); + cy.wait("@dataset"); + cy.findByTestId("loading-spinner").should("not.exist"); + + // add column back again + cy.findByTestId("sidebar-content") + .findByText("Subtotal") + .parent() + .find(".Icon-add") + .click(); + + cy.wait("@dataset"); + cy.findByTestId("loading-spinner").should("not.exist"); + + // fails because there are 2 columns, when there should be one + cy.findByTestId("sidebar-content").findByText("Subtotal"); + + // if you add it back again it crashes the question + }); +});