aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.61k stars 3.94k forks source link

Failing Tests Firefox #5179

Closed dmarcos closed 1 year ago

dmarcos commented 1 year ago

@vincentfretin any ideas?

vincentfretin commented 1 year ago

The latest working version was Firefox 105.0 Ubuntu 20.04. Currently tests fails at the end with timeout 30s with Firefox 107.0 Ubuntu 20.04, but I have no idea why.

vincentfretin commented 1 year ago

On Firefox 105.0 Ubuntu 22.04, the tests fail in the same way. Firefox is blocking on the two following tests https://github.com/aframevr/aframe/blob/5189765cbbd81fc4eefe880045662e33aebd138f/tests/core/scene/a-scene.test.js#L203-L210

https://github.com/aframevr/aframe/blob/5189765cbbd81fc4eefe880045662e33aebd138f/tests/core/scene/a-scene.test.js#L238-L255

If I comment them, tests pass on Firefox 105.0 Ubuntu 22.04. I tested again with those commented tests on Firefox 107.0 Ubuntu 22.04

ERROR: 'An uncaught exception was thrown between tests'
  ✖ "after each" hook for "does not call exitPresent on desktop without a headset"

Finished in 23.867 secs / 3.701 secs @ 08:45:28 GMT+0000 (Coordinated Universal Time)

SUMMARY:
✔ 745 tests completed
ℹ 4 tests skipped
✖ 1 test failed

FAILED TESTS:
  ✖ "after each" hook for "does not call exitPresent on desktop without a headset"
    Firefox 107.0 (Linux x86_64)
  too much recursion
  enterVRSuccess@build/commons.js:185602:26
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
  enterVRSuccess@build/commons.js:185564:16
  enterVR@build/commons.js:185541:5
  onVRPresentChange@build/commons.js:185810:12
  bound@build/commons.js:225185:17
vincentfretin commented 1 year ago

It seems that when the test ends, it triggers the vrdisplaypresentchange event and we enter infinite loop of enterVR. The two commented tests are probably the same issue.

vincentfretin commented 1 year ago

The three tests having the issue have in common the line

this.sinon.stub(sceneEl, 'checkHeadsetConnected').returns(false)
vincentfretin commented 1 year ago

From my understanding, in those tests we reach this code https://github.com/aframevr/aframe/blob/5189765cbbd81fc4eefe880045662e33aebd138f/src/core/scene/a-scene.js#L333-L348 The only way we get an infinite recursion is if window.hasNativeWebVRImplementation is true. I have it to false on my desktop but maybe it's true in CI.

vincentfretin commented 1 year ago

Actually in CI window.hasNativeWebVRImplementation is true on both Chrome and Firefox, my guess is that because of how the tests are run, the webvr-polyfill is already loaded when executing those tests. Setting it to false in those tests should fix the issue.