Skip to content

Commit

Permalink
waiting for button icon to render
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Galitzky <[email protected]>
  • Loading branch information
amitgalitz committed May 17, 2022
1 parent b58d171 commit c5d1789
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -54,7 +48,7 @@ describe('<AnomaliesLiveChart /> spec', () => {
});

test('AnomaliesLiveChart with Sample anomaly data', async () => {
const { container, getByText, getAllByText } = render(
const { container, getByTestId, getAllByText, getByText } = render(
<Provider store={mockedStore()}>
<CoreServicesContext.Provider value={coreServicesMock}>
<AnomaliesLiveChart {...selectedDetectors} />
Expand All @@ -63,7 +57,10 @@ describe('<AnomaliesLiveChart /> 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');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,19 @@ exports[`<AnomaliesLiveChart /> spec AnomaliesLiveChart with Sample anomaly data
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
class="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoaded euiButtonContent__icon"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
/>
>
<path
d="M13 3v4h-1V4H9V3h4zM3 3h4v1H4v3H3V3zm10 10H9v-1h3V9h1v4zM3 13V9h1v3h3v1H3zM0 1.994C0 .893.895 0 1.994 0h12.012C15.107 0 16 .895 16 1.994v12.012A1.995 1.995 0 0114.006 16H1.994A1.995 1.995 0 010 14.006V1.994zm1 0v12.012c0 .548.446.994.994.994h12.012a.995.995 0 00.994-.994V1.994A.995.995 0 0014.006 1H1.994A.995.995 0 001 1.994z"
fill-rule="evenodd"
/>
</svg>
<span
class="euiButton__text"
>
Expand Down

0 comments on commit c5d1789

Please sign in to comment.