From 9256999d77b60bce4a2f3d7c0cd9a553e60acd5b Mon Sep 17 00:00:00 2001 From: Romeo Van Snick <romeo@romeovansnick.be> Date: Mon, 1 Jul 2024 17:01:38 +0200 Subject: [PATCH] Add reproduction for "Accurate Error Messaging for Cross DB Joins in Notebook Editor" (#44975) * Add reproduction for #38989 * Use saveQuestion instead of clicking trough the UI Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com> * Use openOrdersTable instead of manually clicking through the ui Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com> * Create question programmatically in test --------- Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com> --- .../reproductions-3.cy.spec.js | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/e2e/test/scenarios/question-reproductions/reproductions-3.cy.spec.js b/e2e/test/scenarios/question-reproductions/reproductions-3.cy.spec.js index 8172c8627ad..c5da8b6a234 100644 --- a/e2e/test/scenarios/question-reproductions/reproductions-3.cy.spec.js +++ b/e2e/test/scenarios/question-reproductions/reproductions-3.cy.spec.js @@ -1582,3 +1582,51 @@ describe("issue 44668", () => { }); }); }); + +describe("issue 38989", () => { + beforeEach(() => { + restore(); + cy.signInAsAdmin(); + }); + + it("should be impossible to join with a table or question which is not in the same database (metabase#38989)", () => { + createQuestion( + { + query: { + "source-table": PEOPLE_ID, + fields: [ + ["field", PEOPLE.ID, { "base-type": "type/Number" }], + ["field", PEOPLE.EMAIL, { "base-type": "type/Text" }], + ], + joins: [ + { + fields: "all", + alias: "Orders", + // This is not a valid table ID in the Sample Database + "source-table": 123, + strategy: "left-join", + condition: [ + "=", + ["field", PEOPLE.ID, null], + ["field", ORDERS.USER_ID, { "join-alias": "Orders" }], + ], + }, + ], + }, + }, + { + visitQuestion: true, + }, + ); + + cy.findByTestId("query-builder-main") + .findByText("Show error details") + .click(); + + cy.findByTestId("query-builder-main") + .findByText( + /either it does not exist, or it belongs to a different Database/, + ) + .should("exist"); + }); +}); -- GitLab