From b40c453b9e1bde564558d1db559a06987aa06c0f Mon Sep 17 00:00:00 2001
From: Ariya Hidayat <ariya@metabase.com>
Date: Wed, 9 Feb 2022 07:54:25 -0800
Subject: [PATCH] Collection permissions E2E: wait for the complete collection
 data (#20347)

---
 .../scenarios/collections/permissions.cy.spec.js | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/frontend/test/metabase/scenarios/collections/permissions.cy.spec.js b/frontend/test/metabase/scenarios/collections/permissions.cy.spec.js
index f15400d1341..c3f4e111368 100644
--- a/frontend/test/metabase/scenarios/collections/permissions.cy.spec.js
+++ b/frontend/test/metabase/scenarios/collections/permissions.cy.spec.js
@@ -590,25 +590,35 @@ describe("collection permissions", () => {
 
             describe("managing dashboard from the dashboard's edit menu", () => {
               it("should not be offered to edit dashboard details for dashboard in collections they have `read` access to (metabase#15280)", () => {
+                cy.intercept("GET", "/api/collection/root").as("collections");
                 cy.visit("/dashboard/1");
-                cy.icon("ellipsis").click();
+                cy.icon("ellipsis")
+                  .should("be.visible")
+                  .click();
                 popover()
                   .findByText("Edit dashboard details")
                   .should("not.exist");
               });
 
               it("should not be offered to archive dashboard in collections they have `read` access to (metabase#15280)", () => {
+                cy.intercept("GET", "/api/collection/root").as("collections");
                 cy.visit("/dashboard/1");
-                cy.icon("ellipsis").click();
+                cy.icon("ellipsis")
+                  .should("be.visible")
+                  .click();
                 popover()
                   .findByText("Archive")
                   .should("not.exist");
               });
 
               it("should be offered to duplicate dashboard in collections they have `read` access to", () => {
+                cy.intercept("GET", "/api/collection/root").as("collections");
                 const { first_name, last_name } = USERS[user];
                 cy.visit("/dashboard/1");
-                cy.icon("ellipsis").click();
+                cy.wait("@collections");
+                cy.icon("ellipsis")
+                  .should("be.visible")
+                  .click();
                 popover()
                   .findByText("Duplicate")
                   .click();
-- 
GitLab