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

:cherries: Cherry pick changes from July 9, 2021 from `release` -> `master` (#17051)

* Add `addFilterToDashboard` Cypress custom command (#16964)

* Apply custom command to a few tests as an example

* #16918 Repro: Pulse fails when question has date field with "Month of Year" (#16921)
parent 25373f96
Branches
Tags
No related merge requests found
......@@ -3,6 +3,7 @@ import "./commands/ui/icon";
import "./commands/api/question";
import "./commands/api/dashboard";
import "./commands/api/dashboardFilters";
import "./commands/api/composite/createQuestionAndDashboard";
......
Cypress.Commands.add(
"addFilterToDashboard",
({ filter, dashboard_id } = {}) => {
cy.log(`Add filter to the dashboard`);
cy.request("PUT", `/api/dashboard/${dashboard_id}`, {
parameters: [filter],
});
},
);
......@@ -368,10 +368,7 @@ describe("scenarios > dashboard > parameters", () => {
cy.request("POST", `/api/dashboard/${dashboard_id}/cards`, {
cardId: card_id,
}).then(({ body: { id } }) => {
// Add filter to the dashboard
cy.request("PUT", `/api/dashboard/${dashboard_id}`, {
parameters: [filter],
});
cy.addFilterToDashboard({ filter, dashboard_id });
cy.request("PUT", `/api/dashboard/${dashboard_id}/cards`, {
cards: [
......
......@@ -54,10 +54,7 @@ describe("scenarios > dashboard > title drill", () => {
cy.request("POST", `/api/dashboard/${dashboard_id}/cards`, {
cardId: card_id,
}).then(({ body: { id } }) => {
// Add filter to the dashboard
cy.request("PUT", `/api/dashboard/${dashboard_id}`, {
parameters: [filter],
});
cy.addFilterToDashboard({ filter, dashboard_id });
cy.request("PUT", `/api/dashboard/${dashboard_id}/cards`, {
cards: [
......
......@@ -42,10 +42,7 @@ const dashboardFilter = {
cy.createNativeQuestion(nativeQuery).then(({ body: { id: card_id } }) => {
cy.createDashboard("15163D").then(({ body: { id: dashboard_id } }) => {
// Add filter to the dashboard
cy.request("PUT", `/api/dashboard/${dashboard_id}`, {
parameters: [dashboardFilter],
});
cy.addFilterToDashboard({ filter: dashboardFilter, dashboard_id });
// Add previously created question to the dashboard
cy.request("POST", `/api/dashboard/${dashboard_id}/cards`, {
......
import { restore } from "__support__/e2e/cypress";
import { SAMPLE_DATASET } from "__support__/e2e/cypress_sample_dataset";
const { PRODUCTS, PRODUCTS_ID } = SAMPLE_DATASET;
const questionDetails = {
name: "16918",
query: {
"source-table": PRODUCTS_ID,
aggregation: [["count"]],
breakout: [
["field", PRODUCTS.CREATED_AT, { "temporal-unit": "month-of-year" }],
["field", PRODUCTS.CATEGORY, null],
],
},
display: "line",
};
describe.skip("issue 16918", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
cy.createQuestion(questionDetails).then(({ body }) => {
cy.intercept("GET", `/api/pulse/preview_card_info/${body.id}`).as(
"cardPreview",
);
});
});
it(`should load question binned by "Month of Year" or similar granularity (metabase#16918)`, () => {
cy.visit("/pulse/create");
cy.findByText("Select a question").click();
cy.findByText("16918").click();
cy.wait("@cardPreview").then(xhr => {
expect(xhr.response.statusCode).not.to.eq(500);
});
// Cypress should be able to find question title in the card preview
cy.findByText("16918");
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment