Skip to content
Snippets Groups Projects
Unverified Commit d53b0a7a authored by Ryan Laurie's avatar Ryan Laurie Committed by GitHub
Browse files

Consolidate sharing e2e specs (#43514)

parent fea8f89a
No related branches found
No related tags found
No related merge requests found
import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
import {
restore,
visitEmbeddedPage,
filterWidget,
visitPublicDashboard,
} from "e2e/support/helpers";
const { REVIEWS, REVIEWS_ID } = SAMPLE_DATABASE;
const ccName = "CC Reviewer";
const dashboardFilter = {
name: "Text ends with",
slug: "text_ends_with",
id: "3a8ecdbd",
type: "string/ends-with",
sectionId: "string",
};
const questionDetails = {
name: "25473",
query: {
"source-table": REVIEWS_ID,
expressions: { [ccName]: ["field", REVIEWS.REVIEWER, null] },
limit: 10,
// Let's show only a few columns to make it easier to focus on the UI
fields: [
["field", REVIEWS.REVIEWER, null],
["field", REVIEWS.RATING, null],
["field", REVIEWS.CREATED_AT, null],
["expression", ccName, null],
],
},
};
const dashboardDetails = {
name: "25473D",
parameters: [dashboardFilter],
};
describe("issue 25473", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
cy.createQuestionAndDashboard({ questionDetails, dashboardDetails }).then(
({ body: { id, card_id, dashboard_id } }) => {
cy.request("PUT", `/api/dashboard/${dashboard_id}`, {
dashcards: [
{
id,
card_id,
row: 0,
col: 0,
size_x: 16,
size_y: 8,
series: [],
visualization_settings: {},
parameter_mappings: [
{
parameter_id: dashboardFilter.id,
card_id,
target: ["dimension", ["expression", ccName, null]],
},
],
},
],
});
cy.wrap(dashboard_id).as("dashboardId");
},
);
});
it("public sharing: dashboard text filter on a custom column should accept text input (metabase#25473-1)", () => {
cy.get("@dashboardId").then(id => {
visitPublicDashboard(id);
});
assertOnResults();
});
it("signed embedding: dashboard text filter on a custom column should accept text input (metabase#25473-2)", () => {
cy.get("@dashboardId").then(id => {
cy.request("PUT", `/api/dashboard/${id}`, {
embedding_params: {
[dashboardFilter.slug]: "enabled",
},
enable_embedding: true,
});
const payload = {
resource: { dashboard: id },
params: {},
};
visitEmbeddedPage(payload);
});
assertOnResults();
});
});
function assertOnResults() {
cy.findAllByTestId("column-header").last().should("have.text", ccName);
cy.findAllByText("xavier").should("have.length", 2);
filterWidget().click();
cy.findByPlaceholderText("Enter some text").type("e").blur();
cy.button("Add filter").click();
cy.location("search").should("eq", `?${dashboardFilter.slug}=e`);
cy.findAllByText("xavier").should("not.exist");
cy.findAllByText("cameron.nitzsche").should("have.length", 2);
}
import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
import {
describeEE,
getIframeBody,
openStaticEmbeddingModal,
popover,
restore,
setTokenFeatures,
visitDashboard,
} from "e2e/support/helpers";
const { ORDERS_ID } = SAMPLE_DATABASE;
describeEE("issue 26988", () => {
beforeEach(() => {
restore();
cy.intercept("GET", "/api/preview_embed/dashboard/*").as(
"previewDashboard",
);
cy.signInAsAdmin();
setTokenFeatures("all");
});
it("should apply embedding settings passed in URL on load", () => {
cy.createQuestionAndDashboard({
questionDetails: {
name: "Q1",
query: {
"source-table": ORDERS_ID,
limit: 3,
},
},
dashboardDetails: {
enable_embedding: true,
},
}).then(({ body: card }) => {
visitDashboard(card.dashboard_id);
});
openStaticEmbeddingModal({
activeTab: "appearance",
previewMode: "preview",
acceptTerms: false,
});
cy.wait("@previewDashboard");
getIframeBody().should("have.css", "font-family", "Lato, sans-serif");
cy.findByLabelText("Playing with appearance options")
.findByLabelText("Font")
.as("font-control")
.click();
popover().findByText("Oswald").click();
getIframeBody().should("have.css", "font-family", "Oswald, sans-serif");
cy.get("@font-control").click();
popover().findByText("Slabo 27px").click();
getIframeBody().should(
"have.css",
"font-family",
'"Slabo 27px", sans-serif',
);
});
});
import { ORDERS_DASHBOARD_ID } from "e2e/support/cypress_sample_instance_data";
import {
visitDashboard,
restore,
setupSMTP,
dashboardHeader,
sidebar,
} from "e2e/support/helpers";
describe("issue 30314", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
setupSMTP();
});
it("should clean the new subscription form on cancel (metabase#30314)", () => {
visitDashboard(ORDERS_DASHBOARD_ID);
dashboardHeader().findByLabelText("subscriptions").click();
sidebar().within(() => {
cy.findByText("Email it").click();
cy.findByLabelText("Attach results").should("not.be.checked").click();
cy.findByLabelText("Questions to attach")
.should("not.be.checked")
.click();
cy.button("Cancel").click();
cy.findByText("Email it").click();
cy.findByLabelText("Attach results").should("not.be.checked");
cy.findByText("Questions to attach").should("not.exist");
cy.findByText(".xlsx").should("not.exist");
cy.findByText(".csv").should("not.exist");
});
});
});
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment