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

[E2E] Fix `models` 29951 flake (#32254)

* Remove superfluous intercept and wait

* Limit query results to speed test up

* Wait for the schema to load before removing column

* Wait for the UI to properly load

* Extend waiting for the request
parent 17405e70
Branches
Tags
No related merge requests found
......@@ -5,6 +5,7 @@ import {
popover,
} from "e2e/support/helpers";
import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
import { SAMPLE_DB_ID } from "e2e/support/cypress_data";
const { ORDERS_ID, ORDERS } = SAMPLE_DATABASE;
......@@ -16,33 +17,38 @@ const questionDetails = {
CC1: ["+", ["field", ORDERS.TOTAL], 1],
CC2: ["+", ["field", ORDERS.TOTAL], 1],
},
limit: 200,
limit: 5,
},
dataset: true,
};
describe("issue 29951", () => {
describe("issue 29951", { requestTimeout: 10000 }, () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
cy.intercept("POST", "/api/dataset").as("dataset");
cy.intercept("PUT", "/api/card/*").as("updateCard");
cy.intercept("GET", `/api/database/${SAMPLE_DB_ID}/schema/PUBLIC`).as(
"publicShema",
);
});
it("should allow to run the model query after changing custom columns (metabase#29951)", () => {
cy.createQuestion(questionDetails, { visitQuestion: true });
cy.wait("@dataset");
openQuestionActions();
popover().findByText("Edit query definition").click();
cy.wait("@publicShema");
removeExpression("CC2");
// The UI shows us the "play" icon, indicating we should refresh the query,
// but the point of this repro is to save without refreshing
refreshButton().should("have.length", 1);
cy.findByRole("button", { name: "Save changes" }).click();
cy.wait(["@updateCard", "@dataset"]);
dragColumn(0, 100);
cy.findAllByRole("button", { name: "Get Answer" }).first().click();
refreshButton().first().click();
cy.wait("@dataset");
cy.findByTestId("view-footer").should("contain", "Showing 200 rows");
cy.findByTestId("view-footer").should("contain", "Showing 5 rows");
});
});
......@@ -55,8 +61,13 @@ const removeExpression = name => {
const dragColumn = (index, distance) => {
cy.get(".react-draggable")
.should("have.length", 20) // 10 columns X 2 draggable elements
.eq(index)
.trigger("mousedown", 0, 0, { force: true })
.trigger("mousemove", distance, 0, { force: true })
.trigger("mouseup", distance, 0, { force: true });
};
function refreshButton() {
return cy.findAllByRole("button", { name: "Get Answer" });
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment