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

Repro for #13022 (#13308)

parent c26d6afc
No related branches found
No related tags found
No related merge requests found
......@@ -168,4 +168,57 @@ describe("scenarios > admin > datamodel > metrics", () => {
.click();
});
});
describe("custom metrics", () => {
it("should save the metric using custom expressions (metabase#13022)", () => {
cy.visit("/admin/datamodel/metrics");
cy.findByText("New metric").click();
cy.log("**Create new metric based on Custom Expression**");
cy.findByText("Select a table").click();
popover().within(() => {
cy.findByText("Sample Dataset");
cy.findByText("Orders").click();
});
// "Count" is selected by defauult
cy.get(".QueryOption")
.contains("Count")
.click();
// Override it with "Custom Expression"
popover().within(() => {
cy.findByText("Custom Expression").click();
cy.get("[contenteditable='true']")
.click()
.clear()
.type("Sum([Discount] * [Quantity])", { delay: 100 });
cy.findByPlaceholderText("Name (required)")
.click()
.type("CE", { delay: 100 });
cy.findByText("Done").click();
});
const metricName = "Test CE Metric";
// Give it a name
cy.findByPlaceholderText("Something descriptive but not too long").type(
metricName,
);
// and description
cy.findByPlaceholderText(
"This is a good place to be more specific about less obvious metric rules",
).type("Description");
// Save the custom metric
cy.findByText("Save changes")
.should("not.be.disabled")
.click();
cy.log("**Refresh the page and assert**");
cy.reload();
cy.url().should("be", "/admin/datamodel/metrics");
cy.findByText(
'Unexpected input given to normalize. Expected type to be "object", found "string".',
).should("not.exist");
cy.findByText(metricName);
});
});
});
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