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

[E2E] Fix/update `createNestedQuestion` helper (#24929)

* [E2E] Fix/update `createNestedQuestion` helper

* Handle undefined values

* Slightly speed 14787 up
parent 0fddfe48
No related branches found
No related tags found
No related merge requests found
......@@ -185,7 +185,9 @@ describe("scenarios > question > nested", () => {
};
const nestedQuestionDetails = {
filter: [">", ["field", ORDERS.TOTAL, null], 50],
query: {
filter: [">", ["field", ORDERS.TOTAL, null], 50],
},
};
// Create new question which uses previously defined metric
......@@ -255,7 +257,7 @@ describe("scenarios > question > nested", () => {
const baseQuestionDetails = {
name: "14787",
query: ordersJoinProductsQuery,
query: { ...ordersJoinProductsQuery, limit: 5 },
};
createNestedQuestion({ baseQuestionDetails });
......@@ -553,26 +555,32 @@ describe("scenarios > question > nested", () => {
});
function createNestedQuestion(
{ baseQuestionDetails, nestedQuestionDetails },
{ baseQuestionDetails, nestedQuestionDetails = {} },
{ loadBaseQuestionMetadata = false, visitNestedQuestion = true } = {},
) {
if (!baseQuestionDetails) {
throw new Error("Please provide the base question details");
}
createBaseQuestion(baseQuestionDetails).then(({ body: { id } }) => {
loadBaseQuestionMetadata && visitQuestion(id);
return cy.createQuestion(
{
name: "Nested Question",
query: {
"source-table": `card__${id}`,
},
...nestedQuestionDetails,
},
{
visitQuestion: visitNestedQuestion,
wrapId: true,
idAlias: "nestedQuestionId",
const { query: nestedQuery, ...details } = nestedQuestionDetails;
const composite = {
name: "Nested Question",
query: {
...nestedQuery,
"source-table": `card__${id}`,
},
);
...details,
};
return cy.createQuestion(composite, {
visitQuestion: visitNestedQuestion,
wrapId: true,
idAlias: "nestedQuestionId",
});
});
function createBaseQuestion(query) {
......
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