Skip to content

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

Deflake the SQL default-parameters embed wizard test (#81759)

Sébastien0da75ad4a3d6
diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-parameters.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-parameters.cy.spec.ts
index 693a298d96f..a12e2fb9e2e 100644
--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-parameters.cy.spec.ts
+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-parameters.cy.spec.ts
@@ -179,6 +179,8 @@ describe(suiteTitle, () => {
});
it("can set default parameters for SQL questions", () => {
+ cy.intercept("POST", "/api/card/*/query").as("cardQuery");
+
navigateToEmbedOptionsStep({
experience: "chart",
resourceName: "Question with Parameters",
@@ -190,21 +192,30 @@ describe(suiteTitle, () => {
cy.findByLabelText("ID").should("be.visible");
});
+ cy.log("the preview runs {{id}} unset, so the backend rejects the query");
+ cy.wait("@cardQuery");
+
H.getSimpleEmbedIframeContent()
.findByText(/missing required parameters/)
- .should("exist");
+ .should("be.visible");
getEmbedSidebar().within(() => {
cy.findByLabelText("ID").type("123");
cy.press("Tab"); //.blur() doesn't easily work here
});
+ cy.log("the new value re-runs the question in the preview iframe");
+ cy.wait("@cardQuery");
+
H.getSimpleEmbedIframeContent().within(() => {
- cy.findByText(/missing required parameters/).should("not.exist");
+ // Anchor on the row first: a mid-rerender iframe body is empty, which
+ // satisfies the "not.exist" check below on its own (EMB-2338).
cy.findByText("123").should("be.visible");
// value in a subtotal field
cy.findAllByText("75.41").first().should("be.visible");
+
+ cy.findByText(/missing required parameters/).should("not.exist");
});
getEmbedSidebar().within(() => {