Skip to content
Snippets Groups Projects
Unverified Commit fea2aac7 authored by Nicolò Pretto's avatar Nicolò Pretto Committed by GitHub
Browse files

add e2e test for public dashboard title (#44822)

* refactor: move prepareDashboard to a separate function

* test: page title on public dashboard
parent e1e4d983
Branches
Tags
No related merge requests found
......@@ -11,6 +11,8 @@ import {
goToTab,
assertDashboardFixedWidth,
assertDashboardFullWidth,
describeEE,
setTokenFeatures,
} from "e2e/support/helpers";
const { PRODUCTS } = SAMPLE_DATABASE;
......@@ -77,48 +79,52 @@ const USERS = {
"anonymous user": () => cy.signOut(),
};
const prepareDashboard = () => {
cy.request("PUT", "/api/setting/enable-public-sharing", { value: true });
cy.intercept("/api/dashboard/*/public_link").as("publicLink");
cy.createNativeQuestionAndDashboard({
questionDetails,
dashboardDetails,
}).then(
({
body: { id, card_id, dashboard_id, dashboard_tab_id },
dashboardTabs,
}) => {
cy.wrap(dashboard_id).as("dashboardId");
// Connect filter to the card
cy.request("PUT", `/api/dashboard/${dashboard_id}`, {
tabs: dashboardTabs,
dashcards: [
{
id,
dashboard_tab_id,
card_id,
row: 0,
col: 0,
size_x: 8,
size_y: 6,
parameter_mappings: [
{
parameter_id: textFilter.id,
card_id,
target: ["dimension", ["template-tag", "c"]],
},
],
},
],
});
},
);
};
describe("scenarios > public > dashboard", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
cy.request("PUT", "/api/setting/enable-public-sharing", { value: true });
cy.intercept("/api/dashboard/*/public_link").as("publicLink");
cy.createNativeQuestionAndDashboard({
questionDetails,
dashboardDetails,
}).then(
({
body: { id, card_id, dashboard_id, dashboard_tab_id },
dashboardTabs,
}) => {
cy.wrap(dashboard_id).as("dashboardId");
// Connect filter to the card
cy.request("PUT", `/api/dashboard/${dashboard_id}`, {
tabs: dashboardTabs,
dashcards: [
{
id,
dashboard_tab_id,
card_id,
row: 0,
col: 0,
size_x: 8,
size_y: 6,
parameter_mappings: [
{
parameter_id: textFilter.id,
card_id,
target: ["dimension", ["template-tag", "c"]],
},
],
},
],
});
},
);
prepareDashboard();
});
it("should allow users to create public dashboards", () => {
......@@ -258,3 +264,26 @@ describe("scenarios > public > dashboard", () => {
filterWidget().findByText("002").should("be.visible");
});
});
describeEE("scenarios [EE] > public > dashboard", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
prepareDashboard();
setTokenFeatures("all");
});
it("should set the window title to `{dashboard name} · {application name}`", () => {
cy.request("PUT", "/api/setting/application-name", {
value: "Custom Application Name",
});
cy.get("@dashboardId").then(id => {
visitPublicDashboard(id);
cy.title().should("eq", "Test Dashboard · Custom Application Name");
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment