Skip to content

Commit ea48303

Browse files
Fix tests with Firefox (aframevr#5180)
* Run tests on Ubuntu 22.04 and install Firefox * set window.hasNativeWebVRImplementation to false before calling enterVR to fix tests on Firefox
1 parent 5189765 commit ea48303

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ permissions:
1111
jobs:
1212
test:
1313
name: Test Cases
14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-22.04
1515
strategy:
1616
matrix:
1717
node-version: ['16.x']
18+
firefox-version: ['latest']
1819
steps:
1920
- name: Checkout Repo
2021
uses: actions/checkout@v3
@@ -31,29 +32,36 @@ jobs:
3132
- name: Install dependencies
3233
run: npm install
3334

35+
- name: Check Lint
36+
run: npm run lint
37+
38+
- name: Check Build Minified
39+
run: npm run dist
40+
41+
- name: Check Docs
42+
run: npm run test:docs
43+
3444
- name: Test Cases Using Chrome
3545
uses: GabrielBB/xvfb-action@v1
3646
env:
3747
TEST_ENV: ci
3848
with:
3949
run: npm run test:chrome -- --single-run
4050

51+
- name: Install Firefox
52+
uses: browser-actions/setup-firefox@latest
53+
with:
54+
firefox-version: ${{ matrix['firefox-version'] }}
55+
56+
- run: firefox --version
57+
4158
- name: Test Cases Using Firefox
4259
uses: GabrielBB/xvfb-action@v1
4360
env:
4461
TEST_ENV: ci
4562
with:
4663
run: npm run test:firefox -- --single-run
4764

48-
- name: Check Lint
49-
run: npm run lint
50-
51-
- name: Check Build Minified
52-
run: npm run dist
53-
54-
- name: Check Docs
55-
run: npm run test:docs
56-
5765
- name: Upload coverage to Codecov
5866
uses: codecov/codecov-action@v3
5967
with:

tests/components/scene/vr-mode-ui.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ suite('vr-mode-ui', function () {
3838
el: {object3D: {}},
3939
updateProjectionMatrix: function () {}
4040
};
41+
window.hasNativeWebVRImplementation = false;
4142
scene.enterVR();
4243
UI_CLASSES.forEach(function (uiClass) {
4344
assert.ok(scene.querySelector(uiClass).className.indexOf('a-hidden'));
@@ -51,6 +52,7 @@ suite('vr-mode-ui', function () {
5152
el: {object3D: {}, getAttribute: function () { return {spectator: false}; }},
5253
updateProjectionMatrix: function () {}
5354
};
55+
window.hasNativeWebVRImplementation = false;
5456
scene.enterVR();
5557
scene.exitVR();
5658

tests/core/scene/a-scene.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ suite('a-scene (without renderer)', function () {
182182
test('calls requestPresent if headset connected', function (done) {
183183
var sceneEl = this.el;
184184
this.sinon.stub(sceneEl, 'checkHeadsetConnected').returns(true);
185+
window.hasNativeWebVRImplementation = false;
185186
sceneEl.enterVR().then(function () {
186187
assert.ok(sceneEl.renderer.xr.enabled);
187188
done();
@@ -203,6 +204,7 @@ suite('a-scene (without renderer)', function () {
203204
test('does not call requestPresent if flat desktop', function (done) {
204205
var sceneEl = this.el;
205206
this.sinon.stub(sceneEl, 'checkHeadsetConnected').returns(false);
207+
window.hasNativeWebVRImplementation = false;
206208
sceneEl.enterVR().then(function () {
207209
assert.notOk(sceneEl.renderer.xr.enabled);
208210
done();
@@ -248,6 +250,7 @@ suite('a-scene (without renderer)', function () {
248250
}
249251

250252
this.sinon.stub(sceneEl, 'checkHeadsetConnected').returns(false);
253+
window.hasNativeWebVRImplementation = false;
251254
sceneEl.enterVR().then(function () {
252255
assert.ok(fullscreenSpy.called);
253256
done();

0 commit comments

Comments
 (0)