Skip to content

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

Fix the action creator modal flake (#80282)

Nemanja Glumac3fea6bf3fc98
diff --git a/frontend/src/metabase/models/containers/ActionCreatorModal/ActionCreatorModal.unit.spec.tsx b/frontend/src/metabase/models/containers/ActionCreatorModal/ActionCreatorModal.unit.spec.tsx
index f4b0faf9bde..8769dceccd8 100644
--- a/frontend/src/metabase/models/containers/ActionCreatorModal/ActionCreatorModal.unit.spec.tsx
+++ b/frontend/src/metabase/models/containers/ActionCreatorModal/ActionCreatorModal.unit.spec.tsx
@@ -13,6 +13,7 @@ import {
waitFor,
waitForLoaderToBeRemoved,
} from "__support__/ui";
+import { loadActionCreator } from "metabase/querying/action-creator";
import { Route, useLocation, useParams } from "metabase/router";
import { checkNotNull } from "metabase/utils/types";
import type { Card, WritebackAction } from "metabase-types/api";
@@ -52,6 +53,11 @@ async function setup({
model = MODEL,
action = ACTION,
}: SetupOpts) {
+ // `modalRoute` awaits the editor's chunk before it mounts the modal. Without
+ // the same wait here the import lands inside the assertions, where the
+ // editor's `Suspense` boundary renders nothing.
+ await loadActionCreator();
+
setupDatabasesEndpoints([DATABASE]);
setupCardsEndpoints([model]);
diff --git a/frontend/src/metabase/new/components/NewModals/NewModals.unit.spec.tsx b/frontend/src/metabase/new/components/NewModals/NewModals.unit.spec.tsx
index 5b76fbcd6e2..7805587f48c 100644
--- a/frontend/src/metabase/new/components/NewModals/NewModals.unit.spec.tsx
+++ b/frontend/src/metabase/new/components/NewModals/NewModals.unit.spec.tsx
@@ -6,6 +6,7 @@ import {
setupDatabasesEndpoints,
} from "__support__/server-mocks";
import { act, renderWithProviders, screen, waitFor } from "__support__/ui";
+import { loadActionCreator } from "metabase/querying/action-creator";
import { setOpenModal } from "metabase/redux/ui";
import { Route } from "metabase/router";
import { createMockDatabase } from "metabase-types/api/mocks";
@@ -13,6 +14,10 @@ import { createMockDatabase } from "metabase-types/api/mocks";
import { NewModals } from "./NewModals";
async function setup() {
+ // The editor is a chunk of its own, so keep its import out of the window the
+ // assertions below wait in.
+ await loadActionCreator();
+
setupDatabasesEndpoints([createMockDatabase()]);
setupCardsEndpoints([]);
setupCollectionsEndpoints({ collections: [] });