Skip to content

Commit 17fc17c

Browse files
committed
test no-webgl environments using --disabel-webgl CLI flag
1 parent 6ee0f25 commit 17fc17c

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
var Plotly = require('@lib');
2+
3+
var createGraphDiv = require('../assets/create_graph_div');
4+
var destroyGraphDiv = require('../assets/destroy_graph_div');
5+
var failTest = require('../assets/fail_test');
6+
7+
describe('Plotly w/o WebGL support:', function() {
8+
var gd;
9+
10+
beforeEach(function() {
11+
gd = createGraphDiv();
12+
});
13+
14+
afterEach(function() {
15+
Plotly.purge(gd);
16+
destroyGraphDiv();
17+
});
18+
19+
function checkNoWebGLMsg(visible) {
20+
var glDiv = gd.querySelector('div.gl-container');
21+
var msg = glDiv.querySelector('div.no-webgl');
22+
if(visible) {
23+
expect(msg.innerHTML.substr(0, 22)).toBe('WebGL is not supported');
24+
} else {
25+
expect(msg).toBe(null);
26+
}
27+
}
28+
29+
it('gl3d subplots', function(done) {
30+
Plotly.react(gd, require('@mocks/gl3d_autocolorscale.json'))
31+
.then(function() {
32+
checkNoWebGLMsg(true);
33+
return Plotly.react(gd, require('@mocks/10.json'));
34+
})
35+
.then(function() {
36+
checkNoWebGLMsg(false);
37+
})
38+
.catch(failTest)
39+
.then(done);
40+
});
41+
});

test/jasmine/karma.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ func.defaultConfig = {
188188
flags: [
189189
'--touch-events',
190190
'--window-size=' + argv.width + ',' + argv.height,
191-
isCI ? '--ignore-gpu-blacklist' : ''
191+
isCI ? '--ignore-gpu-blacklist' : '',
192+
(isBundleTest && basename(testFileGlob) === 'no_webgl') ? '--disable-webgl' : ''
192193
]
193194
},
194195
_Firefox: {

0 commit comments

Comments
 (0)