Skip to content
Snippets Groups Projects
Unverified Commit 924c6d31 authored by Kamil Mielnik's avatar Kamil Mielnik Committed by GitHub
Browse files

Fix flaky #16559 repro (#49472)

* Fix flaky #16559 repro

* Wait for getCollections

* Clean up helper

* Wait for cardQuery before saving the dashboard
parent 516f03f5
No related branches found
No related tags found
No related merge requests found
......@@ -88,12 +88,10 @@ export function saveDashboard({
cy.button(buttonLabel).click();
if (awaitRequest) {
cy.wait("@saveDashboardCards").then(() => {
cy.findByText(editBarText).should("not.exist");
});
} else {
cy.findByText(editBarText).should("not.exist");
cy.wait("@saveDashboardCards");
}
cy.findByText(editBarText).should("not.exist");
cy.wait(waitMs); // this is stupid but necessary to due to the dashboard resizing and detaching elements
}
......
......@@ -326,119 +326,120 @@ describe("issue 16559", () => {
restore();
cy.signInAsAdmin();
cy.createDashboard(dashboardDetails).then(
({ body: { id: dashboardId } }) => {
visitDashboard(dashboardId);
},
);
});
it(
"should always show the most recent revision (metabase#16559)",
{ tags: "@flaky" },
() => {
openDashboardInfoSidebar();
sidesheet().within(() => {
cy.findByRole("tab", { name: "History" }).click();
cy.log("Dashboard creation");
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText("You created this.")
.should("be.visible");
});
closeDashboardInfoSidebar();
cy.log("Edit dashboard");
editDashboard();
openQuestionsSidebar();
sidebar().findByText("Orders, Count").click();
cy.button("Save").click();
openDashboardInfoSidebar();
sidesheet().within(() => {
cy.findByRole("tab", { name: "History" }).click();
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText("You added a card.")
.should("be.visible");
});
closeDashboardInfoSidebar();
createDashboard(dashboardDetails).then(response => {
visitDashboard(response.body.id);
});
cy.log("Change dashboard name");
cy.findByTestId("dashboard-name-heading")
.click()
.type(" modified")
.blur();
cy.intercept("GET", "/api/collection/tree?*").as("getCollections");
cy.intercept("PUT", "/api/dashboard/*").as("saveDashboard");
cy.intercept("POST", "/api/card/*/query").as("cardQuery");
});
openDashboardInfoSidebar();
sidesheet().within(() => {
cy.findByRole("tab", { name: "History" }).click();
it("should always show the most recent revision (metabase#16559)", () => {
openDashboardInfoSidebar();
sidesheet().within(() => {
cy.findByRole("tab", { name: "History" }).click();
cy.log("Dashboard creation");
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText("You created this.")
.should("be.visible");
});
closeDashboardInfoSidebar();
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText(
'You renamed this Dashboard from "16559 Dashboard" to "16559 Dashboard modified".',
)
.should("be.visible");
cy.log("Edit dashboard");
editDashboard();
openQuestionsSidebar();
sidebar().findByText("Orders, Count").click();
cy.wait("@cardQuery");
cy.button("Save").click();
cy.wait("@saveDashboard");
openDashboardInfoSidebar();
sidesheet().within(() => {
cy.findByRole("tab", { name: "History" }).click();
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText("You added a card.")
.should("be.visible");
});
closeDashboardInfoSidebar();
cy.log("Add description");
cy.findByRole("tab", { name: "Overview" }).click();
cy.log("Change dashboard name");
cy.findByTestId("dashboard-name-heading").click().type(" modified").blur();
cy.wait("@saveDashboard");
cy.findByPlaceholderText("Add description")
.click()
.type("16559 description")
.blur();
openDashboardInfoSidebar();
sidesheet().within(() => {
cy.findByRole("tab", { name: "History" }).click();
cy.findByRole("tab", { name: "History" }).click();
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText(
'You renamed this Dashboard from "16559 Dashboard" to "16559 Dashboard modified".',
)
.should("be.visible");
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText("You added a description.")
.should("be.visible");
cy.log("Add description");
cy.findByRole("tab", { name: "Overview" }).click();
cy.log("Toggle auto-apply filters");
});
closeDashboardInfoSidebar();
cy.findByPlaceholderText("Add description")
.click()
.type("16559 description")
.blur();
cy.wait("@saveDashboard");
openDashboardSettingsSidebar();
sidesheet().findByText("Auto-apply filters").click();
closeDashboardSettingsSidebar();
cy.findByRole("tab", { name: "History" }).click();
openDashboardInfoSidebar();
sidesheet().within(() => {
cy.findByRole("tab", { name: "History" }).click();
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText("You added a description.")
.should("be.visible");
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText("You set auto apply filters to false.")
.should("be.visible");
});
closeDashboardInfoSidebar();
cy.log("Move dashboard to another collection");
dashboardHeader().icon("ellipsis").click();
popover().findByText("Move").click();
entityPickerModal().within(() => {
cy.findByText("First collection").click();
cy.button("Move").click();
});
cy.log("Toggle auto-apply filters");
});
closeDashboardInfoSidebar();
openDashboardSettingsSidebar();
sidesheet().findByText("Auto-apply filters").click();
cy.wait("@saveDashboard");
closeDashboardSettingsSidebar();
openDashboardInfoSidebar();
sidesheet().within(() => {
cy.findByRole("tab", { name: "History" }).click();
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText("You set auto apply filters to false.")
.should("be.visible");
});
closeDashboardInfoSidebar();
cy.log("Move dashboard to another collection");
dashboardHeader().icon("ellipsis").click();
popover().findByText("Move").click();
entityPickerModal().within(() => {
cy.findByText("First collection").click();
cy.button("Move").click();
cy.wait(["@saveDashboard", "@getCollections"]);
});
openDashboardInfoSidebar();
sidesheet().within(() => {
cy.findByRole("tab", { name: "History" }).click();
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText("You moved this Dashboard to First collection.")
.should("be.visible");
});
},
);
openDashboardInfoSidebar();
sidesheet().within(() => {
cy.findByRole("tab", { name: "History" }).click();
cy.findByTestId("dashboard-history-list")
.findAllByRole("listitem")
.eq(0)
.findByText("You moved this Dashboard to First collection.")
.should("be.visible");
});
});
});
describe("issue 17879", () => {
......
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