Skip to content

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

fix(e2e): wait for collection API response in cross-version verify tests (#74773)

github-automation-metabased305bd7b1b48
diff --git a/e2e/cross-version/latest/01-pivot.cy.spec.ts b/e2e/cross-version/latest/01-pivot.cy.spec.ts
index 781e9016498..edfdf0c4b60 100644
--- a/e2e/cross-version/latest/01-pivot.cy.spec.ts
+++ b/e2e/cross-version/latest/01-pivot.cy.spec.ts
@@ -57,7 +57,7 @@ describe("Cross-version questions - pivot", () => {
it("verify: pivot table is preserved", { tags: ["@target"] }, () => {
cy.signIn("admin", { skipCache: true });
- cy.visit("/collection/root");
+ X.visitRootCollectionAndWait();
cy.log(`-- ${Q1_NAME}: Assert that the pivot table viz is preserved --`);
cy.findAllByTestId("collection-entry-name")
diff --git a/e2e/cross-version/latest/02-joins.cy.spec.ts b/e2e/cross-version/latest/02-joins.cy.spec.ts
index 43be00c3ccf..a990774fe27 100644
--- a/e2e/cross-version/latest/02-joins.cy.spec.ts
+++ b/e2e/cross-version/latest/02-joins.cy.spec.ts
@@ -52,7 +52,7 @@ describe("Cross-version questions - joins", () => {
it("verify: bar chart is preserved", { tags: ["@target"] }, () => {
cy.signIn("admin", { skipCache: true });
- cy.visit("/collection/root");
+ X.visitRootCollectionAndWait();
cy.findAllByTestId("collection-entry-name")
.filter(`:contains(${Q2_NAME})`)
.click();
diff --git a/e2e/cross-version/latest/03-nested-model.cy.spec.ts b/e2e/cross-version/latest/03-nested-model.cy.spec.ts
index 07ad93ba2fe..f4c36292047 100644
--- a/e2e/cross-version/latest/03-nested-model.cy.spec.ts
+++ b/e2e/cross-version/latest/03-nested-model.cy.spec.ts
@@ -60,7 +60,7 @@ describe("Cross-version questions - nested model", () => {
() => {
cy.signIn("admin", { skipCache: true });
- cy.visit("/collection/root");
+ X.visitRootCollectionAndWait();
H.getPinnedSection()
.findByRole("link")
diff --git a/e2e/cross-version/latest/04-sql.cy.spec.ts b/e2e/cross-version/latest/04-sql.cy.spec.ts
index e6a35784f25..9d41307726e 100644
--- a/e2e/cross-version/latest/04-sql.cy.spec.ts
+++ b/e2e/cross-version/latest/04-sql.cy.spec.ts
@@ -71,7 +71,7 @@ describe("Cross-version questions - sql", () => {
it("verify: sql question can be filtered", { tags: ["@target"] }, () => {
cy.signIn("admin", { skipCache: true });
- cy.visit("/collection/root");
+ X.visitRootCollectionAndWait();
cy.findAllByTestId("collection-entry-name")
.filter(`:contains(${Q4_SQL_NAME})`)
diff --git a/e2e/cross-version/latest/helpers.ts b/e2e/cross-version/latest/helpers.ts
index 4ddd8341da7..36860dd0dd1 100644
--- a/e2e/cross-version/latest/helpers.ts
+++ b/e2e/cross-version/latest/helpers.ts
@@ -23,6 +23,17 @@ export function selectFromPopover(item: string) {
H.popover().contains(item).should("be.visible").click();
}
+/**
+ * Visits the root collection and waits for the collection items API response
+ * before returning, ensuring the collection table is fully rendered.
+ */
+export function visitRootCollectionAndWait() {
+ cy.intercept("GET", "/api/collection/root/items?*").as("rootCollectionItems");
+ cy.visit("/collection/root");
+ cy.wait("@rootCollectionItems");
+ cy.findByTestId("collection-table").should("exist");
+}
+
export function joinTables(baseTable: string, joinTable: string) {
selectFromPopover("Sample Database");
selectFromPopover(baseTable);