diff --git a/src/__tests__/accessiblity/accessibility.test.tsx b/src/__tests__/accessiblity/accessibility.test.tsx index 9e0ef284b..11760dca4 100644 --- a/src/__tests__/accessiblity/accessibility.test.tsx +++ b/src/__tests__/accessiblity/accessibility.test.tsx @@ -1,4 +1,5 @@ import { axe, toHaveNoViolations } from 'jest-axe'; +import { act } from 'react-dom/test-utils'; import CompareResultsView from '../../components/CompareResults/CompareResultsView'; import SearchDropdown from '../../components/Search/SearchDropdown'; @@ -22,9 +23,11 @@ describe('Accessibility', () => { }); it('SearchInput should have no violations', async () => { - const { container } = renderWithRouter(); - const results = await axe(container); - expect(results).toHaveNoViolations(); + await act(async () => { + const { container } = renderWithRouter(); + const results = await axe(container); + expect(results).toHaveNoViolations(); + }); }); it('SearchResultsList should have no violations', async () => { @@ -41,7 +44,7 @@ describe('Accessibility', () => { const { testData } = getTestData(); store.dispatch(updateSearchResults(testData)); - const { container } = renderWithRouter(); + const { container } = renderWithRouter(); const results = await axe(container); expect(results).toHaveNoViolations(); }); @@ -58,7 +61,7 @@ describe('Accessibility', () => { expect(results).toHaveNoViolations(); }); - it('CompareResultsView should have no violations', async () => { + it('CompareResultsView should have no violations in light mode', async () => { const { testData } = getTestData(); const selectedRevisions = testData.slice(0, 4); store.dispatch(setSelectedRevisions(selectedRevisions)); @@ -67,4 +70,16 @@ describe('Accessibility', () => { const results = await axe(container); expect(results).toHaveNoViolations(); }); + + // TO DO: resolve 'Axe is already running' issue and re-enable test + // https://github.com/mozilla/perfcompare/issues/222 + // it('CompareResultsView should have no violations in dark mode', async () => { + // const { testData } = getTestData(); + // const selectedRevisions = testData.slice(0, 4); + // store.dispatch(setSelectedRevisions(selectedRevisions)); + + // const { container } = renderWithRouter(); + // const results = await axe(container); + // expect(results).toHaveNoViolations(); + // }); });