-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
gl2d image tests (finally) #1037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
13b5825
73c34e6
e64b05c
a3ac96d
84bcb63
9daf1b2
0c116dc
de73692
563b368
1e04e9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,15 +51,33 @@ var QUEUE_WAIT = 10; | |
var pattern = process.argv[2]; | ||
var mockList = getMockList(pattern); | ||
var isInQueue = (process.argv[3] === '--queue'); | ||
var isCI = process.env.CIRCLECI; | ||
|
||
if(mockList.length === 0) { | ||
throw new Error('No mocks found with pattern ' + pattern); | ||
} | ||
|
||
// filter out untestable mocks if no pattern is specified | ||
if(!pattern) { | ||
console.log('Filtering out untestable mocks\n'); | ||
console.log('Filtering out untestable mocks:'); | ||
mockList = mockList.filter(untestableFilter); | ||
console.log('\n'); | ||
} | ||
|
||
// gl2d have limited image-test support | ||
if(pattern === 'gl2d_*') { | ||
|
||
if(!isInQueue) { | ||
console.log('WARN: Running gl2d image tests in batch may lead to unwanted results\n'); | ||
} | ||
|
||
if(isCI) { | ||
console.log('Filtering out multiple-subplot gl2d mocks:'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this could be a slightly more general log entry b/c the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
that would be great! |
||
mockList = mockList | ||
.filter(untestableGL2DonCIfilter) | ||
.sort(sortForGL2DonCI); | ||
console.log('\n'); | ||
} | ||
} | ||
|
||
// main | ||
|
@@ -81,18 +99,64 @@ else { | |
* | ||
*/ | ||
function untestableFilter(mockName) { | ||
return !( | ||
var cond = !( | ||
mockName === 'font-wishlist' || | ||
mockName.indexOf('gl2d_') !== -1 || | ||
mockName.indexOf('mapbox_') !== -1 | ||
); | ||
|
||
if(!cond) console.log(' -', mockName); | ||
|
||
return cond; | ||
} | ||
|
||
/* gl2d mocks that have multiple subplots | ||
* can't be generated properly on CircleCI | ||
* at the moment. | ||
* | ||
* For more info see: | ||
* https://github.com/plotly/plotly.js/pull/980 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice doc reference in the code! |
||
* | ||
*/ | ||
function untestableGL2DonCIfilter(mockName) { | ||
var cond = [ | ||
'gl2d_multiple_subplots', | ||
'gl2d_simple_inset', | ||
'gl2d_stacked_coupled_subplots', | ||
'gl2d_stacked_subplots' | ||
].indexOf(mockName) === -1; | ||
|
||
if(!cond) console.log(' -', mockName); | ||
|
||
return cond; | ||
} | ||
|
||
/* gl2d pointcloud mock(s) must be tested first | ||
* on CircleCI in order to work; sort them here. | ||
* | ||
* Pointcloud relies on gl-shader@4.2.1 whereas | ||
* other gl2d trace modules rely on gl-shader@4.2.0, | ||
* we suspect that the lone gl context on CircleCI is | ||
* having issues with dealing with the two different | ||
* gl-shader versions. | ||
* | ||
* More info here: | ||
* https://github.com/plotly/plotly.js/pull/1037 | ||
*/ | ||
function sortForGL2DonCI(a, b) { | ||
var root = 'gl2d_pointcloud', | ||
ai = a.indexOf(root), | ||
bi = b.indexOf(root); | ||
|
||
if(ai < bi) return 1; | ||
if(ai > bi) return -1; | ||
|
||
return 0; | ||
} | ||
|
||
function runInBatch(mockList) { | ||
var running = 0; | ||
|
||
// remove mapbox mocks if circle ci | ||
|
||
test('testing mocks in batch', function(t) { | ||
t.plan(mockList.length); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run
npm run test-image-gl2d
to run gl2d image tests locally.