Skip to content

Commit

Permalink
Add repro for #15947
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanjaglumac committed May 7, 2021
1 parent 45c4d2f commit 37c2a04
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions frontend/test/metabase/scenarios/admin/datamodel/table.cy.spec.js
@@ -1,4 +1,7 @@
import { restore } from "__support__/e2e/cypress";
import { SAMPLE_DATASET } from "__support__/e2e/cypress_sample_dataset";

const { ORDERS, ORDERS_ID, PRODUCTS, PRODUCTS_ID } = SAMPLE_DATASET;

describe("scenarios > admin > databases > table", () => {
beforeEach(() => {
Expand Down Expand Up @@ -53,4 +56,58 @@ describe("scenarios > admin > databases > table", () => {
cy.findByText("Creation timestamp");
});
});

describe.skip("turning table visibility off shouldn't prevent editing related question (metabase#15947)", () => {
it("simple question (metabase#15947-1)", () => {
turnTableVisibilityOff(ORDERS_ID);
cy.visit("/question/1");
cy.findByText("Filter");
});

it("question with joins (metabase#15947-2)", () => {
cy.createQuestion({
name: "15947",
query: {
"source-table": ORDERS_ID,
joins: [
{
fields: "all",
"source-table": PRODUCTS_ID,
condition: [
"=",
["field", ORDERS.PRODUCT_ID, null],
["field", PRODUCTS.ID, { "join-alias": "Products" }],
],
alias: "Products",
},
],
filter: [
"and",
["=", ["field", ORDERS.QUANTITY, null], 1],
[">", ["field", PRODUCTS.RATING, { "join-alias": "Products" }], 3],
],
aggregation: [
["sum", ["field", ORDERS.TOTAL, null]],
["sum", ["field", PRODUCTS.RATING, { "join-alias": "Products" }]],
],
breakout: [
["field", ORDERS.CREATED_AT, { "temporal-unit": "year" }],
["field", PRODUCTS.CATEGORY, { "join-alias": "Products" }],
],
},
}).then(({ body: { id: QUESTION_ID } }) => {
turnTableVisibilityOff(PRODUCTS_ID);
cy.visit(`/question/${QUESTION_ID}/notebook`);
cy.findByText("Quantity is equal to 1");
cy.findByText("Rating is greater than 3");
});
});
});
});

function turnTableVisibilityOff(table_id) {
cy.request("PUT", "/api/table", {
ids: [table_id],
visibility_type: "hidden",
});
}

0 comments on commit 37c2a04

Please sign in to comment.