Files
metabase/e2e/support/commands/permissions/sandboxTable.js
Kamil Mielnik 5a1d677444 RFC 118. Prettier - arrowParens: “always” (#55807)
* Update .prettierrc
- remove "arrowParens": "avoid" so that it defaults to "always" instead

* Run "yarn prettier"
2025-03-27 09:18:07 +00:00

44 lines
1.2 KiB
JavaScript

import { SAMPLE_DB_TABLES, USER_GROUPS } from "e2e/support/cypress_data";
const { STATIC_ORDERS_ID } = SAMPLE_DB_TABLES;
const { COLLECTION_GROUP } = USER_GROUPS;
Cypress.Commands.add(
"sandboxTable",
({
attribute_remappings = {},
card_id = null,
group_id = COLLECTION_GROUP,
table_id = STATIC_ORDERS_ID,
} = {}) => {
// Extract the name of the table, as well as `schema` and `db_id` that we'll need later on for `cy.updatePermissionsSchemas()`
cy.request("GET", "/api/table").then(({ body: tables }) => {
const { name, schema, db_id } = tables.find(
(table) => table.id === table_id,
);
const attr = Object.keys(attribute_remappings).join(", "); // Account for the possiblity of passing multiple user attributes
cy.log(`Sandbox "${name}" table on "${attr}"`);
cy.updatePermissionsGraph({
[group_id]: {
[db_id]: {
"view-data": {
[schema]: {
[table_id]: "sandboxed",
},
},
"create-queries": "query-builder",
},
},
});
cy.request("POST", "/api/mt/gtap", {
attribute_remappings,
card_id,
group_id,
table_id,
});
});
},
);