-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix offset not working in case * Make offset function return any * Add a repro for #42377 * Fix order of adjustments * Revert unrelated changes * Remove commented code * Revert unrelated changes
- Loading branch information
1 parent
a522cd8
commit 3e9f4ac
Showing
4 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database"; | ||
import type { StructuredQuestionDetails } from "e2e/support/helpers"; | ||
import { | ||
createQuestion, | ||
enterCustomColumnDetails, | ||
getNotebookStep, | ||
openNotebook, | ||
popover, | ||
restore, | ||
} from "e2e/support/helpers"; | ||
|
||
const { ORDERS_ID } = SAMPLE_DATABASE; | ||
|
||
describe("scenarios > question > offset", () => { | ||
beforeEach(() => { | ||
restore(); | ||
cy.signInAsAdmin(); | ||
}); | ||
|
||
it("should allow using OFFSET as a CASE argument (metabase#42377)", () => { | ||
const formula = "Sum(case([Total] > 0, Offset([Total], -1)))"; | ||
const name = "Aggregation"; | ||
const questionDetails: StructuredQuestionDetails = { | ||
query: { | ||
"source-table": ORDERS_ID, | ||
limit: 5, | ||
}, | ||
}; | ||
createQuestion(questionDetails, { visitQuestion: true }); | ||
openNotebook(); | ||
|
||
cy.icon("sum").click(); | ||
getNotebookStep("summarize") | ||
.findByText("Pick the metric you want to see") | ||
.click(); | ||
popover().contains("Custom Expression").click(); | ||
enterCustomColumnDetails({ formula, name }); | ||
|
||
cy.on("uncaught:exception", error => { | ||
expect(error.message.includes("Error normalizing")).not.to.be.true; | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters