From 1923709c5f8edccaf5793d2b18e490066cde5e19 Mon Sep 17 00:00:00 2001
From: Kamil Mielnik <kamil@kamilmielnik.com>
Date: Mon, 4 Nov 2024 22:15:26 +0700
Subject: [PATCH] Fix flaky custom column test (#49476)

* Fix flaky custom column test

* Fix flaky custom column test
---
 .../custom-column/cc-boolean-functions.cy.spec.ts  | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/e2e/test/scenarios/custom-column/cc-boolean-functions.cy.spec.ts b/e2e/test/scenarios/custom-column/cc-boolean-functions.cy.spec.ts
index 977bd95c586..fd926e4803e 100644
--- a/e2e/test/scenarios/custom-column/cc-boolean-functions.cy.spec.ts
+++ b/e2e/test/scenarios/custom-column/cc-boolean-functions.cy.spec.ts
@@ -4,6 +4,7 @@ import {
   type StructuredQuestionDetails,
   assertQueryBuilderRowCount,
   assertTableData,
+  changeSynchronousBatchUpdateSetting,
   createDashboard,
   createQuestion,
   editDashboard,
@@ -625,6 +626,17 @@ describe("scenarios > custom column > boolean functions", () => {
       );
     }
 
+    beforeEach(() => {
+      cy.signInAsAdmin();
+      changeSynchronousBatchUpdateSetting(true);
+      cy.signInAsNormalUser();
+    });
+
+    afterEach(() => {
+      cy.signInAsAdmin();
+      changeSynchronousBatchUpdateSetting(false);
+    });
+
     it("should be able setup an 'open question' click behavior", () => {
       createDashboardWithQuestion().then(dashboard =>
         visitDashboard(dashboard.id),
@@ -681,7 +693,9 @@ describe("scenarios > custom column > boolean functions", () => {
         .findByText(parameterDetails.name)
         .click();
       popover().findByText(expressionName).click();
+      cy.intercept("GET", "/api/dashboard/*").as("getDashboard");
       saveDashboard();
+      cy.wait("@getDashboard");
 
       cy.log("verify click behavior");
       getDashboardCard().within(() => {
-- 
GitLab