diff --git a/tasks/pretest.js b/tasks/pretest.js index 69843c698c1..28fcf770f96 100644 --- a/tasks/pretest.js +++ b/tasks/pretest.js @@ -5,7 +5,6 @@ var common = require('./util/common'); // main makeCredentialsFile(); -makeSetPlotConfigFile(); makeTestImageFolders(); makeRequireJSFixture(); @@ -20,24 +19,6 @@ function makeCredentialsFile() { logger('make build/credentials.json'); } -// Create a 'set plot config' file, -// to be included in the image test index -function makeSetPlotConfigFile() { - var setPlotConfig = [ - '\'use strict\';', - '', - '/* global Plotly:false */', - '', - 'Plotly.setPlotConfig({', - ' mapboxAccessToken: \'' + constants.mapboxAccessToken + '\'', - '});', - '' - ].join('\n'); - - common.writeFile(constants.pathToSetPlotConfig, setPlotConfig); - logger('make build/set_plot_config.js'); -} - // Make artifact folders for image tests function makeTestImageFolders() { diff --git a/tasks/util/constants.js b/tasks/util/constants.js index c867dd2cf26..9c8b1aaf828 100644 --- a/tasks/util/constants.js +++ b/tasks/util/constants.js @@ -73,7 +73,6 @@ module.exports = { // more info: https://www.mapbox.com/help/define-access-token/ mapboxAccessToken: 'pk.eyJ1IjoiZXRwaW5hcmQiLCJhIjoiY2luMHIzdHE0MGFxNXVubTRxczZ2YmUxaCJ9.hwWZful0U2CQxit4ItNsiQ', pathToCredentials: path.join(pathToBuild, 'credentials.json'), - pathToSetPlotConfig: path.join(pathToBuild, 'set_plot_config.js'), testContainerImage: 'plotly/testbed:latest', testContainerName: process.env.PLOTLYJS_TEST_CONTAINER_NAME || 'imagetest', diff --git a/tasks/util/container_commands.js b/tasks/util/container_commands.js index f5f257e4abb..11743613172 100644 --- a/tasks/util/container_commands.js +++ b/tasks/util/container_commands.js @@ -3,7 +3,12 @@ var constants = require('./constants'); var containerCommands = { cdHome: 'cd ' + constants.testContainerHome, cpIndex: 'cp -f test/image/index.html ../server_app/index.html', - restart: 'supervisorctl restart nw1', + injectEnv: [ + 'sed -i', + 's/process.env.PLOTLY_MAPBOX_DEFAULT_ACCESS_TOKEN/\\\'' + constants.mapboxAccessToken + '\\\'/', + '../server_app/main.js' + ].join(' '), + restart: 'supervisorctl restart nw1' }; containerCommands.ping = [ @@ -14,6 +19,7 @@ containerCommands.ping = [ containerCommands.setup = [ containerCommands.cpIndex, + containerCommands.injectEnv, containerCommands.restart, 'sleep 1', containerCommands.ping, diff --git a/test/image/baselines/mapbox_0.png b/test/image/baselines/mapbox_0.png index 6af8251f6ab..80a431490f0 100644 Binary files a/test/image/baselines/mapbox_0.png and b/test/image/baselines/mapbox_0.png differ diff --git a/test/image/baselines/mapbox_angles.png b/test/image/baselines/mapbox_angles.png index e1e8a9ce868..611a6fc132f 100644 Binary files a/test/image/baselines/mapbox_angles.png and b/test/image/baselines/mapbox_angles.png differ diff --git a/test/image/baselines/mapbox_bubbles-text.png b/test/image/baselines/mapbox_bubbles-text.png index db8d036b0c1..a0613245a06 100644 Binary files a/test/image/baselines/mapbox_bubbles-text.png and b/test/image/baselines/mapbox_bubbles-text.png differ diff --git a/test/image/baselines/mapbox_custom-style.png b/test/image/baselines/mapbox_custom-style.png index d744a8c7500..7213f229c04 100644 Binary files a/test/image/baselines/mapbox_custom-style.png and b/test/image/baselines/mapbox_custom-style.png differ diff --git a/test/image/baselines/mapbox_fill.png b/test/image/baselines/mapbox_fill.png index c3fe0510580..ea1a2370a7d 100644 Binary files a/test/image/baselines/mapbox_fill.png and b/test/image/baselines/mapbox_fill.png differ diff --git a/test/image/baselines/mapbox_layers.png b/test/image/baselines/mapbox_layers.png index f8724dbf804..4d39e4de195 100644 Binary files a/test/image/baselines/mapbox_layers.png and b/test/image/baselines/mapbox_layers.png differ diff --git a/test/image/compare_pixels_test.js b/test/image/compare_pixels_test.js index 7d8e66665f3..ce210f88f88 100644 --- a/test/image/compare_pixels_test.js +++ b/test/image/compare_pixels_test.js @@ -53,6 +53,7 @@ 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); } @@ -252,7 +253,8 @@ function comparePixels(mockName, cb) { function onEqualityCheck(err, isEqual) { if(err) { common.touch(imagePaths.diff); - return console.error(err, mockName); + console.error(err); + return; } if(isEqual) { fs.unlinkSync(imagePaths.diff); @@ -261,7 +263,16 @@ function comparePixels(mockName, cb) { cb(isEqual, mockName); } + // 525 means a plotly.js error + function onResponse(response) { + if(+response.statusCode === 525) { + console.error('plotly.js error while generating', mockName); + cb(false, mockName); + } + } + request(requestOpts) + .on('response', onResponse) .pipe(saveImageStream) .on('close', checkImage); } diff --git a/test/image/index.html b/test/image/index.html index e7d04e93247..efa5c6d2edc 100644 --- a/test/image/index.html +++ b/test/image/index.html @@ -5,7 +5,6 @@ -