Skip to content
Snippets Groups Projects
Unverified Commit bc868a05 authored by Alexander Polyankin's avatar Alexander Polyankin Committed by GitHub
Browse files

Do not auto-run native queries after saving a question (#31866)

parent 0c0ad437
Branches
Tags
No related merge requests found
import {
modal,
openNativeEditor,
queryBuilderHeader,
restore,
} from "e2e/support/helpers";
describe("issue 30165", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
cy.intercept("POST", "/api/dataset").as("dataset");
cy.intercept("POST", "/api/card/*/query").as("cardQuery");
cy.intercept("POST", "/api/card").as("createQuestion");
cy.intercept("PUT", "/api/card/*").as("updateQuestion");
});
it("should not autorun native queries after updating a question (metabase#30165)", () => {
openNativeEditor();
cy.findByTestId("native-query-editor").type("SELECT * FROM ORDERS");
queryBuilderHeader().findByText("Save").click();
modal().within(() => {
cy.findByLabelText("Name").clear().type("Q1");
cy.button("Save").click();
});
cy.wait("@createQuestion");
modal().button("Not now").click();
cy.findByTestId("native-query-editor").type(" WHERE TOTAL < 20");
queryBuilderHeader().findByText("Save").click();
modal().button("Save").click();
cy.wait("@updateQuestion");
cy.findByTestId("native-query-editor").type(" LIMIT 10");
queryBuilderHeader().findByText("Save").click();
modal().button("Save").click();
cy.wait("@updateQuestion");
cy.get("@dataset.all").should("have.length", 0);
cy.get("@cardQuery.all").should("have.length", 0);
cy.findByTestId("query-builder-main")
.findByText("Here's where your results will appear")
.should("be.visible");
});
});
......@@ -238,7 +238,9 @@ export const apiUpdateQuestion = (question, { rerunQuery } = {}) => {
);
}
rerunQuery = rerunQuery ?? isResultDirty;
if (question.isStructured()) {
rerunQuery = rerunQuery ?? isResultDirty;
}
// Needed for persisting visualization columns for pulses/alerts, see #6749
const series = getTransformedSeries(getState());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment