Skip to content
Snippets Groups Projects
Unverified Commit e58e0351 authored by Uladzimir Havenchyk's avatar Uladzimir Havenchyk Committed by GitHub
Browse files

[QB] Add e2e test for previously broken `SumIf` and `CountIf` functions in...

[QB] Add e2e test for previously broken `SumIf` and `CountIf` functions in custom expressions (#38082)

* Add repro for aggregation with SumIf and CountIf

* Decrease typing delay

* Update e2e/test/scenarios/question/notebook.cy.spec.js

Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>
parent 3e4a40ee
No related branches found
No related tags found
No related merge requests found
......@@ -295,7 +295,7 @@ describe("scenarios > question > notebook", { tags: "@slow" }, () => {
});
});
describe("arithmetic (metabase#13175)", () => {
describe("arithmetic (metabase#13175, metabase#18094)", () => {
beforeEach(() => {
// This is required because TableInteractive won't render columns
// that don't fit into the viewport
......@@ -350,6 +350,14 @@ describe("scenarios > question > notebook", { tags: "@slow" }, () => {
const CASES = {
CountIf: ["CountIf(([Subtotal] + [Tax]) > 10)", "18,760"],
SumIf: ["SumIf([Subtotal], ([Subtotal] + [Tax] > 20))", "1,447,850.28"],
SumIf2: [
'SumIf([Total], [Created At] > "2016-01-01") + SumIf([Subtotal], [Created At] > "2016-01-01")',
"2,958,809.85",
],
CountIf2: [
'CountIf([Created At] > "2016-01-01") + CountIf([Created At] > "2016-01-01")',
"37,520",
],
};
Object.entries(CASES).forEach(([filter, formula]) => {
......@@ -357,30 +365,26 @@ describe("scenarios > question > notebook", { tags: "@slow" }, () => {
it(`should work on custom aggregation with ${filter}`, () => {
summarize({ mode: "notebook" });
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Custom Expression").click();
popover().contains("Custom Expression").click();
enterCustomColumnDetails({ formula: expression });
cy.findByPlaceholderText("Something nice and descriptive")
.click()
.type(filter, { delay: 100 });
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.contains(/^expected closing parenthesis/i).should("not.exist");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.contains(/^redundant input/i).should("not.exist");
.type(filter);
popover().within(() => {
cy.contains(/^expected closing parenthesis/i).should("not.exist");
cy.contains(/^redundant input/i).should("not.exist");
});
cy.button("Done").should("not.be.disabled").click();
cy.findByTestId("aggregate-step").contains(filter).should("exist");
visualize();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.contains(filter);
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.contains(result);
cy.findByTestId("qb-header").contains(filter);
cy.findByTestId("query-builder-main").contains(result);
});
});
});
......
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