Skip to content

Commit 742b83d

Browse files
authored
Merge pull request #4321 from plotly/test-image-flaky-mocks
Flaky image tests
2 parents 54e9c4f + 11bc625 commit 742b83d

File tree

3 files changed

+47
-35
lines changed

3 files changed

+47
-35
lines changed

.circleci/test.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ case $1 in
7575

7676
image)
7777
SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | circleci tests split)
78-
npm run test-image -- $SUITE --filter || EXIT_STATE=$?
78+
npm run test-image -- $SUITE --filter --skip-flaky || EXIT_STATE=$?
7979
exit $EXIT_STATE
8080
;;
8181

8282
image2)
83+
retry npm run test-image -- --just-flaky
8384
npm run test-export || EXIT_STATE=$?
8485
exit $EXIT_STATE
8586
;;

test/image/compare_pixels_test.js

+44-33
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ var QUEUE_WAIT = 10;
4747
* Run all gl3d image test in queue:
4848
*
4949
* npm run test-image -- gl3d_* --queue
50+
*
51+
*
5052
*/
5153

52-
var argv = minimist(process.argv.slice(2), {boolean: ['queue', 'filter' ]});
53-
var isInQueue = argv.queue;
54-
var filter = argv.filter;
54+
var argv = minimist(process.argv.slice(2), {
55+
boolean: ['queue', 'filter', 'skip-flaky', 'just-flaky']
56+
});
5557

5658
var allMock = false;
5759
// If no pattern is provided, all mocks are compared
@@ -80,40 +82,39 @@ allMockList = allMockList.filter(unique);
8082

8183
// filter out untestable mocks if no pattern is specified (ie. we're testing all mocks)
8284
// or if flag '--filter' is provided
83-
if(allMock || filter) {
85+
console.log('');
86+
if(allMock || argv.filter) {
8487
console.log('Filtering out untestable mocks:');
85-
allMockList = allMockList.filter(untestableFilter);
86-
console.log('\n');
87-
}
88-
89-
sortGl2dMockList(allMockList);
90-
91-
// main
92-
if(isInQueue) {
93-
runInQueue(allMockList);
94-
} else {
95-
runInBatch(allMockList);
88+
// Test cases:
89+
// - font-wishlist
90+
// - all mapbox
91+
// don't behave consistently from run-to-run and/or
92+
// machine-to-machine; skip over them for now.
93+
allMockList = allMockList.filter(function(mockName) {
94+
var cond = !(
95+
mockName === 'font-wishlist' ||
96+
mockName.indexOf('mapbox_') !== -1
97+
);
98+
if(!cond) console.log(' -', mockName);
99+
return cond;
100+
});
96101
}
97102

98-
/* Test cases:
99-
*
100-
* - font-wishlist
101-
* - all mapbox
102-
*
103-
* don't behave consistently from run-to-run and/or
104-
* machine-to-machine; skip over them for now.
105-
*
106-
*/
107-
function untestableFilter(mockName) {
108-
var cond =
109-
!(
110-
mockName === 'font-wishlist' ||
111-
mockName.indexOf('mapbox_') !== -1
112-
);
113-
114-
if(!cond) console.log(' -', mockName);
103+
var FLAKY_LIST = [
104+
'treemap_textposition'
105+
];
115106

116-
return cond;
107+
console.log('');
108+
if(argv['skip-flaky']) {
109+
allMockList = allMockList.filter(function(mockName) {
110+
var cond = FLAKY_LIST.indexOf(mockName) === -1;
111+
if(!cond) console.log('Skipping flaky mock', mockName);
112+
return cond;
113+
});
114+
} else if(argv['just-flaky']) {
115+
allMockList = allMockList.filter(function(mockName) {
116+
return FLAKY_LIST.indexOf(mockName) !== -1;
117+
});
117118
}
118119

119120
/* gl2d pointcloud and other non-regl gl2d mock(s)
@@ -277,3 +278,13 @@ function comparePixels(mockName, cb) {
277278
.pipe(saveImageStream)
278279
.on('close', checkImage);
279280
}
281+
282+
sortGl2dMockList(allMockList);
283+
console.log('');
284+
285+
// main
286+
if(argv.queue) {
287+
runInQueue(allMockList);
288+
} else {
289+
runInBatch(allMockList);
290+
}

test/jasmine/tests/titles_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ describe('Editable titles', function() {
11411141
.then(done);
11421142
});
11431143

1144-
it('has no hover effects for titles that used to be blank', function(done) {
1144+
it('@flaky has no hover effects for titles that used to be blank', function(done) {
11451145
Plotly.plot(gd, data, {
11461146
xaxis: {title: {text: ''}},
11471147
yaxis: {title: {text: ''}},

0 commit comments

Comments
 (0)