Newer
Older
import { restore } from "e2e/support/helpers";
import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
Anton Kulyk
committed
const { ORDERS, ORDERS_ID, PEOPLE, PEOPLE_ID } = SAMPLE_DATABASE;
Anton Kulyk
committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
describe("issue 18630", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
});
const QUERY_WITH_FIELD_CLAUSE = {
"source-query": {
"source-table": ORDERS_ID,
joins: [
{
fields: "all",
"source-table": PEOPLE_ID,
condition: [
"=",
["field", ORDERS.USER_ID, null],
["field", PEOPLE.ID, { "join-alias": "People - User" }],
],
alias: "People - User",
},
],
expressions: {
coalesce: [
"coalesce",
["field", ORDERS.USER_ID, null],
["field", PEOPLE.ID, { "join-alias": "People - User" }],
],
},
aggregation: [["count"]],
breakout: [["expression", "coalesce"]],
},
joins: [
{
fields: "all",
"source-table": PEOPLE_ID,
condition: [
"=",
["field", "coalesce", { "base-type": "type/Float" }],
["field", PEOPLE.ID, { "join-alias": "People" }],
],
alias: "People",
},
],
limit: 3,
};
const questionDetails = {
name: "18630",
query: QUERY_WITH_FIELD_CLAUSE,
Anton Kulyk
committed
};
it("should normally open queries with field literals in joins (metabase#18630)", () => {
cy.createQuestion(questionDetails, { visitQuestion: true });
Anton Kulyk
committed
// The query runs and we assert the page is not blank,
// which was caused by an infinite loop and a stack overflow.
cy.findByDisplayValue(questionDetails.name);
cy.get(".cellData").contains("29494 Anderson Drive");
cy.findByText("Showing 3 rows");