diff --git a/public/app/features/scopes/tests/selector.test.ts b/public/app/features/scopes/tests/selector.test.ts index 6435de6280..b282c7b099 100644 --- a/public/app/features/scopes/tests/selector.test.ts +++ b/public/app/features/scopes/tests/selector.test.ts @@ -1,7 +1,10 @@ +import {act} from "@testing-library/react"; + import { config } from '@grafana/runtime'; import { sceneGraph } from '@grafana/scenes'; import { DashboardScene } from 'app/features/dashboard-scene/scene/DashboardScene'; +import {scopesSelectorScene} from "../instance"; import { getClosestScopesFacade } from '../utils'; import { applyScopes, cancelScopes, openSelector, selectResultCloud, updateScopes } from './utils/actions'; @@ -22,12 +25,20 @@ describe('Selector', () => { let dashboardScene: DashboardScene; beforeAll(() => { + config.featureToggles.singleTopNav = true; config.featureToggles.scopeFilters = true; config.featureToggles.groupByVariable = true; }); - beforeEach(() => { + beforeEach(async () => { dashboardScene = renderDashboard(); + // Enable the scope selector + scopesSelectorScene?.enable(); + + await act(async () => { + await scopesSelectorScene?.fetchBaseNodes(); + await new Promise(resolve => setTimeout(resolve, 0)); + }); }); afterEach(async () => {