Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Fixes a flaky e2e test for guest embedding (#66954)

Sébastiene31368df3e61
diff --git a/e2e/support/helpers/e2e-embedding-iframe-sdk-helpers.ts b/e2e/support/helpers/e2e-embedding-iframe-sdk-helpers.ts
index 205e082e7fc..bbee083a841 100644
--- a/e2e/support/helpers/e2e-embedding-iframe-sdk-helpers.ts
+++ b/e2e/support/helpers/e2e-embedding-iframe-sdk-helpers.ts
@@ -60,10 +60,19 @@ export interface MetabaseElement {
};
}
export const waitForSimpleEmbedIframesToLoad = (n: number = 1) => {
- cy.get("iframe[data-metabase-embed]").should("have.length", n);
- cy.get("iframe[data-iframe-loaded]").should("have.length", n, {
- timeout: 10_000, // the iframe can slow to load, we need to wait to decrease flakiness
- });
+ // we do need _all_ these timeouts to decrease flakiness
+ // see https://github.com/metabase/metabase/pull/66954#issuecomment-3661512082
+ cy.get("iframe[data-metabase-embed]", { timeout: 40_000 }).should(
+ "have.length",
+ n,
+ );
+ cy.get("iframe[data-iframe-loaded]", { timeout: 40_000 }).should(
+ "have.length",
+ n,
+ {
+ timeout: 40_000, // the iframe can slow to load, we need to wait to decrease flakiness
+ },
+ );
};
export const getSimpleEmbedIframeContent = (iframeIndex = 0) => {
@@ -79,7 +88,7 @@ export const getSimpleEmbedIframeContent = (iframeIndex = 0) => {
"have.length.greaterThan",
iframeIndex,
{
- timeout: 10_000, // the iframe can slow to load, we need to wait to decrease flakiness
+ timeout: 40_000, // the iframe can slow to load, we need to wait to decrease flakiness
},
);
diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js.cy.spec.ts
index 0c86915a8cb..e6bb72f7ba7 100644
--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js.cy.spec.ts
+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js.cy.spec.ts
@@ -88,10 +88,22 @@ describe(
.should("be.visible")
.should("be.disabled");
+ // Going to the next step and selecting "Orders in a dashboard" explicitely
+ // because sometimes it selects another one that's been used recently
+ // see EMB-1106
+ cy.log("Navigating to embed flow step 2 and selecting an item to embed");
+ cy.findByRole("button", { name: "Next" }).click();
+ cy.get('[data-testid="embed-recent-item-card"]')
+ .should("have.length.greaterThan", 0)
+ .contains("Orders in a dashboard")
+ .click();
+
cy.log("Preview should load after embedding is enabled");
H.waitForSimpleEmbedIframesToLoad();
H.getSimpleEmbedIframeContent().within(() => {
- cy.findByText("Orders in a dashboard").should("be.visible");
+ cy.findByText("Orders in a dashboard", { timeout: 60_000 }).should(
+ "be.visible",
+ );
});
});