Skip to content
Snippets Groups Projects
Unverified Commit 44fb3171 authored by Mahatthana (Kelvin) Nomsawadi's avatar Mahatthana (Kelvin) Nomsawadi Committed by GitHub
Browse files

Fix flaky `interactive-embedding.cy.spec.js` (#43588)

* Fix flaky test

* Fix the flake for real

* Fix stress test failing because of mismatched height

* Review: Move viewport setting to shared config
parent 1e4fe0f1
Branches
Tags
No related merge requests found
......@@ -156,13 +156,13 @@ const defaultConfig = {
// 1. testFiles and
// 2. integrationFolder
specPattern: "e2e/test/**/*.cy.spec.{js,ts}",
viewportHeight: 800,
viewportWidth: 1280,
};
const mainConfig = {
...defaultConfig,
projectId: "ywjy9z",
viewportHeight: 800,
viewportWidth: 1280,
numTestsKeptInMemory: process.env["CI"] ? 1 : 50,
reporter: "cypress-multi-reporters",
reporterOptions: {
......
......@@ -492,26 +492,19 @@ describeEE("scenarios > embedding > full app", () => {
},
});
});
cy.get("@postMessage")
.should("have.been.calledWith", {
metabase: {
type: "frame",
frame: {
mode: "fit",
height: Cypress.sinon.match(value => value > 1000),
},
},
})
.and("not.have.been.calledWith", {
metabase: {
type: "frame",
frame: {
mode: "fit",
height: Cypress.sinon.match(value => value < 400),
},
// TODO: Find a way to assert that this is the last call.
cy.get("@postMessage").should("have.been.calledWith", {
metabase: {
type: "frame",
frame: {
mode: "fit",
height: Cypress.sinon.match(value => value > 1000),
},
});
},
});
cy.get("@postMessage").invoke("resetHistory");
cy.findByRole("tab", { name: TAB_2.name }).click();
cy.get("@postMessage").should("have.been.calledWith", {
metabase: {
......@@ -523,23 +516,20 @@ describeEE("scenarios > embedding > full app", () => {
},
});
cy.get("@postMessage").invoke("resetHistory");
cy.findByTestId("app-bar").findByText("Our analytics").click();
cy.findByRole("heading", { name: "Metabase analytics" }).should(
"be.visible",
);
cy.get("@postMessage").then(postMessage => {
expect(
postMessage.lastCall.calledWith({
metabase: {
type: "frame",
frame: {
mode: "fit",
height: 800,
},
},
}),
).to.be.true;
cy.get("@postMessage").should("have.been.calledWith", {
metabase: {
type: "frame",
frame: {
mode: "fit",
height: 800,
},
},
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment