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

Repro #25988: Cannot reference nested question as native subquery (#28135)

[ci skip]
parent 07c91cd6
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,28 @@ export function startNewQuestion() {
cy.visit("/question/notebook#" + hash);
}
/**
* This is the query generated by clicking "New" and then choosing the SQL Query".
*/
export function startNewNativeQuestion(alias = "editor") {
const newNativeQuestionQuery = {
dataset_query: {
database: null,
native: { query: "", "template-tags": {} },
type: "native",
},
display: "table",
parameters: [],
visualization_settings: {},
};
const hash = adhocQuestionHash(newNativeQuestionQuery);
cy.visit("/question#" + hash);
return cy.get(".ace_content").as(alias).should("be.visible");
}
/**
* Visit any valid query in an ad-hoc manner.
*
......
......@@ -3,8 +3,12 @@ import {
openQuestionActions,
restore,
visitQuestion,
startNewNativeQuestion,
runNativeQuery,
} from "__support__/e2e/helpers";
import * as SQLFilter from "../native-filters/helpers/e2e-sql-filter-helpers";
describe("scenarios > question > native subquery", () => {
beforeEach(() => {
restore();
......@@ -263,4 +267,31 @@ describe("scenarios > question > native subquery", () => {
cy.contains("41");
});
});
it.skip("should be able to reference a nested question (metabase#25988)", () => {
const questionDetails = {
name: "Nested GUI question",
query: {
"source-table": "card__1",
limit: 2,
},
};
cy.createQuestion(questionDetails).then(
({ body: { id: nestedQuestionId } }) => {
const tagID = `#${nestedQuestionId}`;
startNewNativeQuestion();
SQLFilter.enterParameterizedQuery(`SELECT * FROM {{${tagID}`);
cy.findByTestId("sidebar-header-title")
.invoke("text")
.should("eq", questionDetails.name);
runNativeQuery();
cy.get(".cellData").should("contain", "37.65");
},
);
});
});
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