Skip to content
Snippets Groups Projects
Unverified Commit 829a608b authored by Anton Kulyk's avatar Anton Kulyk Committed by GitHub
Browse files

Fix x-raying a nested question (#19922)

* Unksip x-ray test

* Handle nullish dashboard parameters
parent 7fa4675b
No related branches found
No related tags found
No related merge requests found
......@@ -166,6 +166,7 @@ export function getParameterValuesBySlug(
parameterValuesById,
{ preserveDefaultedParameters } = {},
) {
parameters = parameters || [];
parameterValuesById = parameterValuesById || {};
const parameterValuePairs = parameters.map(parameter => [
parameter,
......
......@@ -575,6 +575,11 @@ describe("parameters/utils/parameter-values", () => {
),
).toEqual(getParameterValuesBySlug(parameters, parameterValues));
});
it("should handle nullish parameters", () => {
expect(getParameterValuesBySlug(undefined, {})).toEqual({});
expect(getParameterValuesBySlug(null, {})).toEqual({});
});
});
describe("`preserveDefaultedParameters` === true", () => {
......@@ -603,6 +608,28 @@ describe("parameters/utils/parameter-values", () => {
[defaultedParameterWithValue.slug]: defaultedParameterWithValue.value,
});
});
it("should handle nullish parameters", () => {
expect(
getParameterValuesBySlug(
undefined,
{},
{
preserveDefaultedParameters: true,
},
),
).toEqual({});
expect(
getParameterValuesBySlug(
null,
{},
{
preserveDefaultedParameters: true,
},
),
).toEqual({});
});
});
});
......
import { restore, visitQuestionAdhoc, popover } from "__support__/e2e/cypress";
import {
restore,
getDimensionByName,
visitQuestionAdhoc,
popover,
} from "__support__/e2e/cypress";
import { SAMPLE_DATABASE } from "__support__/e2e/cypress_sample_database";
const {
......@@ -84,7 +89,8 @@ describe("scenarios > x-rays", () => {
});
["X-ray", "Compare to the rest"].forEach(action => {
it.skip(`"${action.toUpperCase()}" should work on a nested question made from base native question (metabase#15655)`, () => {
it(`"${action.toUpperCase()}" should work on a nested question made from base native question (metabase#15655)`, () => {
cy.skipOn(action === "Compare to the rest");
cy.intercept("GET", "/api/automagic-dashboards/**").as("xray");
cy.createNativeQuestion({
name: "15655",
......@@ -96,9 +102,8 @@ describe("scenarios > x-rays", () => {
cy.findByText("Saved Questions").click();
cy.findByText("15655").click();
cy.findByText("Summarize").click();
cy.get(".List-item-title")
.contains(/Source/i)
.click();
getDimensionByName({ name: "SOURCE" }).click();
cy.button("Done").click();
cy.get(".bar")
.first()
.click({ force: true });
......@@ -107,7 +112,7 @@ describe("scenarios > x-rays", () => {
expect(xhr.response.body.cause).not.to.exist;
expect(xhr.response.statusCode).not.to.eq(500);
});
cy.findByText("A look at the number of People");
cy.findByText(/A closer look at the number of/);
cy.get(".DashCard");
});
......
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