Skip to content
Snippets Groups Projects
Unverified Commit 2880304f authored by Romeo Van Snick's avatar Romeo Van Snick Committed by GitHub
Browse files

Repro: App crashes when editing custom expression referencing metric when...

 Repro: App crashes when editing custom expression referencing metric when dependent metadata is not loaded (#48560)

* Add repro for #47058

* Delay the response and test for the actual metric button

* Move setup to before and find summarize block using helper

* Use beforeEach
parent 068d5536
Branches
Tags
No related merge requests found
import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
import {
createQuestion,
getNotebookStep,
main,
restore,
} from "e2e/support/helpers";
const { ORDERS_ID, ORDERS } = SAMPLE_DATABASE;
describe("issue 47058", () => {
beforeEach(() => {
restore();
cy.signInAsNormalUser();
cy.intercept("GET", "/api/card/*/query_metadata", req =>
req.continue(() => new Promise(resolve => setTimeout(resolve, 1000))),
).as("metadata");
createQuestion({
name: "Metric 47058",
type: "metric",
query: {
"source-table": ORDERS_ID,
aggregation: [["count"]],
},
}).then(({ body: { id: metricId } }) => {
createQuestion({
name: "Question 47058",
type: "question",
query: {
"source-table": ORDERS_ID,
fields: [
["field", ORDERS.ID, {}],
["field", ORDERS.TOTAL, {}],
],
aggregation: [["metric", metricId]],
limit: 1,
},
}).then(({ body: { id: questionId } }) => {
cy.visit(`/question/${questionId}/notebook`);
});
});
});
it("should show the loading page while the question metadata is being fetched (metabase#47058)", () => {
main().within(() => {
cy.findByText("Loading...").should("be.visible");
getNotebookStep("summarize").should("not.exist");
cy.findByText("[Unknown Metric]").should("not.exist");
cy.wait("@metadata");
cy.log(
"Only renders the notebook editor (with the summarize button that has the metrics' name on it) after the metadata is loaded",
);
cy.findByText("Loading...").should("not.exist");
getNotebookStep("summarize").should("be.visible");
cy.findByText("[Unknown Metric]").should("not.exist");
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment