model-viewer icon indicating copy to clipboard operation
model-viewer copied to clipboard

Tests without WebGL Context

Open AmitMY opened this issue 1 year ago • 3 comments

@google/model-viewer v4.0.0 (also tried v3.5.0)

When running tests in CI (GitHub Actions, without a screen), there seems to be an issue i was not having before:

TypeError: this.threeRenderer is undefined thrown

and

Uncaught TypeError: Cannot read properties of undefined (reading 'xr') thrown

which come together with (it seems):

Chrome Headless 131.0.0.0 (Mac OS 10.15.7) WARN: Error: Error creating WebGL context.
Error: Error creating WebGL context.
    at new WebGLRenderer (http://localhost:9876/_karma_webpack_/webpack:/node_modules/three/build/three.module.js:14906:13)
    at new Renderer (http://localhost:9876/_karma_webpack_/@google/webpack:/node_modules/@google/model-viewer/lib/three-components/Renderer.js:73:34)
    at Function.singleton (http://localhost:9876/_karma_webpack_/@google/webpack:/node_modules/@google/model-viewer/lib/three-components/Renderer.js:103:31)
    at new LoadingModelViewerElement (http://localhost:9876/_karma_webpack_/@google/webpack:/node_modules/@google/model-viewer/lib/features/loading.js:177:22)
    at new ARModelViewerElement (http://localhost:9876/_karma_webpack_/@google/webpack:/node_modules/@google/model-viewer/lib/features/ar.js:58:13)
    at new ControlsModelViewerElement (http://localhost:9876/_karma_webpack_/@google/webpack:/node_modules/@google/model-viewer/lib/features/controls.js:178:13)
    at new EnvironmentModelViewerElement (http://localhost:9876/_karma_webpack_/@google/webpack:/node_modules/@google/model-viewer/lib/features/environment.js:37:13)
    at new StagingModelViewerElement (http://localhost:9876/_karma_webpack_/@google/webpack:/node_modules/@google/model-viewer/lib/features/staging.js:42:13)
    at new SceneGraphModelViewerElement (http://localhost:9876/_karma_webpack_/@google/webpack:/node_modules/@google/model-viewer/lib/features/scene-graph.js:41:13)
    at new AnnotationModelViewerElement (http://localhost:9876/_karma_webpack_/@google/webpack:/node_modules/@google/model-viewer/lib/features/annotation.js:35:13)

AmitMY avatar Dec 11 '24 14:12 AmitMY

Hmm, I haven't seen that - I'm guessing something else is different, since our CI is not having this problem. Would you mind sending a PR to see if you can trigger the problem here on our CI?

elalish avatar Dec 11 '24 16:12 elalish

Seems like you were having the same issue: https://github.com/karma-runner/karma-chrome-launcher/issues/263 Unfortunately, using Angular, it seems like I can't easily migrate off of Karma.

We're currently evaluating Web Test Runner, Vitest, and Jest as candidates for a new test runner for Angular projects while preserving Jasmine as assertion library to not break existing tests.

So it might be a problem of the test runner rather than the library

AmitMY avatar Dec 12 '24 14:12 AmitMY

Oh yeah, Karma is dead. We moved to web-test-runner; it's way better.

elalish avatar Dec 12 '24 17:12 elalish