anomaly-detection-dashboards-plugin
anomaly-detection-dashboards-plugin copied to clipboard
[BUG] Jest Snapshot for AlertsFlyout and ConfirmModal are empty
What is the bug? After version bumping to 2.0. The new snapshots created by jest tests show only the following markup:
<div
aria-hidden="true"
data-aria-hidden="true"
/>
instead of the full component for each snapshot test. This is happening for AlertsFlyout and ConfirmModal on this PR: https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/pull/230
This can be viewed in the file changes in public/pages/AnomalyCharts/components/AlertsFlyout/__tests__/__snapshots__/AlertsFlyout.test.tsx.snap and public/pages/DetectorDetail/components/ConfirmModal/__tests__/__snapshots__/ConfirmModal.test.tsx.snap
When testing out the cluster after the version bump the flyout and confirm modal correctly renders but doesn't on the tests
What is the expected behavior? The same markup before the file changes on the snapshots
After investigating, the reason for the snapshot not rendering is because of a change in Eui. The new changes in EUI causes the children not to be rendered until a useEffect is called. These tests don't account for the useEffect being called so we just see null returned. Will need to look into adding a sort of mounted snapshot in order to test these components with snapshots. However since these were tested manually and no other changes occurred for 2.0 bump this isn't a blocking issue anymore.