diff --git a/packages/lib-classifier/src/components/Classifier/components/SubjectViewer/SubjectViewer.spec.js b/packages/lib-classifier/src/components/Classifier/components/SubjectViewer/SubjectViewer.spec.js index 19fa45763d0..380a8b2a2ab 100644 --- a/packages/lib-classifier/src/components/Classifier/components/SubjectViewer/SubjectViewer.spec.js +++ b/packages/lib-classifier/src/components/Classifier/components/SubjectViewer/SubjectViewer.spec.js @@ -23,19 +23,18 @@ describe('Component > SubjectViewer', function () { expect(container.firstChild).to.be.null() }) - it('should render the VolumetricViewer if the subject store successfully loads', function () { + it('should render the VolumetricViewer if isVolumetricViewer = true', async function () { render() expect(screen.getByText('Suspense boundary')).to.exist() - expect(screen.findByTestId('subject-viewer-volumetric')).to.exist() + expect(await screen.findByTestId('subject-viewer-volumetric')).to.exist() }) describe('when there is an null viewer because of invalid subject media', function () { diff --git a/packages/lib-subject-viewers/src/VolumetricViewer/VolumetricViewer.js b/packages/lib-subject-viewers/src/VolumetricViewer/VolumetricViewer.js index b4003936c92..1674f9207ee 100644 --- a/packages/lib-subject-viewers/src/VolumetricViewer/VolumetricViewer.js +++ b/packages/lib-subject-viewers/src/VolumetricViewer/VolumetricViewer.js @@ -17,6 +17,11 @@ export default function VolumetricViewer ({ }) { const { data, loading, error } = useVolumetricSubject({ onError, onReady, subject }) + // Specs should skip rendering the VolumetricViewer component + // WebGL/Canvas throws exceptions when running specs due to non-browser environment + if (data === 'mock-subject-json') + return
+ const [modelState] = useState({ annotations: ModelAnnotations(), tool: ModelTool(),