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

Repro for `EE#154`: Sanboxed table should allow joins to it (#13888)

* Add repro for `metabase-enterprise#154`

https://github.com/metabase/metabase-enterprise/issues/154

- Use UI trick instead of scrolling to get around virtualization
parent 013f6c27
No related branches found
No related tags found
No related merge requests found
......@@ -275,6 +275,91 @@ describeWithToken("formatting > sandboxes", () => {
});
});
it.skip("should allow joins to the sandboxed table (metabase-enterprise#154)", () => {
const COLLECTION_GROUP_ID = 4;
withSampleDataset(
({ PEOPLE, PEOPLE_ID, ORDERS_ID, PRODUCTS_ID, REVIEWS_ID }) => {
cy.log(
"**-- 1. Sandbox `People` table on `user_id` attribute for `data` group --**",
);
cy.request("POST", "/api/mt/gtap", {
attribute_remappings: {
user_id: ["dimension", ["field-id", PEOPLE.ID]],
},
card_id: null,
group_id: COLLECTION_GROUP_ID,
table_id: PEOPLE_ID,
});
cy.log("**-- 2. Fetch permissions graph --**");
cy.request("GET", "/api/permissions/graph", {}).then(
({ body: { groups, revision } }) => {
// Update permissions for `collections` group [id: 4]
// This mutates the original `groups` object => we'll pass it next to the `PUT` request
groups[COLLECTION_GROUP_ID] = {
1: {
schemas: {
PUBLIC: {
[ORDERS_ID]: "all",
[PEOPLE_ID]: { query: "segmented", read: "all" },
[PRODUCTS_ID]: "all",
[REVIEWS_ID]: "all",
},
},
},
};
cy.log("**-- 3. Update/save permissions --**");
cy.request("PUT", "/api/permissions/graph", {
groups,
revision,
});
},
);
},
);
signOut();
cy.log("**-- Logging in as sandboxed user --**");
cy.request("POST", "/api/session", {
username: sandboxed_user.email,
password: sandboxed_user.password,
});
// Go straight to orders table in custom questions
cy.visit("/question/new?database=1&table=2&mode=notebook");
cy.findByText("Summarize").click();
cy.findByText("Count of rows").click();
cy.findByText("Pick a column to group by").click();
cy.log(
"**-- Original issue reported failure to find 'User' group / foreign key--**",
);
popover().within(() => {
// Collapse "Order/s/" in order to bring "User" into view (trick to get around virtualization - credits: @flamber)
cy.get(".List-section-header")
.contains(/Orders?/)
.click();
cy.get(".List-section-header")
.contains("User")
.click();
cy.get(".List-item")
.contains("ID")
.click();
});
cy.findByText("Visualize").click();
cy.findByText("Count by User → ID");
cy.findByText("11"); // Sum of orders for user with ID #1
});
it.skip("SB question with `case` CC should substitue the `else` argument's table (metabase-enterprise#548)", () => {
const QUESTION_NAME = "EE_548";
const CC_NAME = "CC_548"; // Custom column
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment