Closed vedhant closed 5 years ago
I think this happens only with the polyfilled version
After a ton of digging I found that the specific function - navigator.getVRDisplays()
does not work in the test files. Polyfill uses this function. It does not work because karma runs the tests in an iframe. The entire p5xr constext is in an iframe and by default webvr doesn't allow navigator.getVRDisplays
to resolve. If I run the function in the chrome debugger, it clearly works which also proves the point that the iframe is creating all the issues.
Nice detective work!
I noticed that in unit testing with karma and mocha,
p5xr.sessionCheck()
is not working. More particularly, insessionCheck()
the promisenavigator.xr.requestDevice()
never gets resolved and remains pending indefinitely. I tested by opening the karma test server on my mobile and debugged remotely. However, (this is quite strange) when I click debug button on the karma test page on my phone, this issue disappears.