From c5d1789ad71ceb41303919c724ad28b618b52baf Mon Sep 17 00:00:00 2001 From: Amit Galitzky Date: Wed, 11 May 2022 22:23:51 +0000 Subject: [PATCH] waiting for button icon to render Signed-off-by: Amit Galitzky --- .../__tests__/AnomaliesLiveCharts.test.tsx | 13 +++++-------- .../__snapshots__/AnomaliesLiveCharts.test.tsx.snap | 9 +++++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/public/pages/Dashboard/Components/__tests__/AnomaliesLiveCharts.test.tsx b/public/pages/Dashboard/Components/__tests__/AnomaliesLiveCharts.test.tsx index b72b44b53..f50f0384a 100644 --- a/public/pages/Dashboard/Components/__tests__/AnomaliesLiveCharts.test.tsx +++ b/public/pages/Dashboard/Components/__tests__/AnomaliesLiveCharts.test.tsx @@ -7,18 +7,12 @@ import { render, waitFor } from '@testing-library/react'; import React from 'react'; import { AnomaliesLiveChart, - INITIAL_HEATMAP_DISPLAY_OPTION, } from '../AnomaliesLiveChart'; import { selectedDetectors } from '../../../../pages/utils/__tests__/constants'; import { Provider } from 'react-redux'; import { coreServicesMock } from '../../../../../test/mocks'; import { CoreServicesContext } from '../../../../components/CoreServices/CoreServices'; import { mockedStore } from '../../../../redux/utils/testUtils'; -import { - getLatestAnomalyResultsForDetectorsByTimeRange, - getFloorPlotTime, - getLatestAnomalyResultsByTimeRange, -} from '../../utils/utils'; const anomalyResponse = [ { ok: true, @@ -54,7 +48,7 @@ describe(' spec', () => { }); test('AnomaliesLiveChart with Sample anomaly data', async () => { - const { container, getByText, getAllByText } = render( + const { container, getByTestId, getAllByText, getByText } = render( @@ -63,7 +57,10 @@ describe(' spec', () => { ); //mock current last update to a specific date so doesn't produce new snapshot each minute Date.now = jest.fn().mockReturnValue(new Date('2021-06-06T12:33:37.000Z')); - await waitFor(() => {}); + await waitFor(() => { + expect(getByTestId('dashboardFullScreenButton').innerHTML.includes('euiIcon-isssLoaded')) + }); + await waitFor(()=> {}) expect(container).toMatchSnapshot(); getAllByText('Detector with the most recent anomaly'); }); diff --git a/public/pages/Dashboard/Components/__tests__/__snapshots__/AnomaliesLiveCharts.test.tsx.snap b/public/pages/Dashboard/Components/__tests__/__snapshots__/AnomaliesLiveCharts.test.tsx.snap index 4ec39d984..93b783318 100644 --- a/public/pages/Dashboard/Components/__tests__/__snapshots__/AnomaliesLiveCharts.test.tsx.snap +++ b/public/pages/Dashboard/Components/__tests__/__snapshots__/AnomaliesLiveCharts.test.tsx.snap @@ -78,14 +78,19 @@ exports[` spec AnomaliesLiveChart with Sample anomaly data > + > + +