Merge "screenshots: Catch get/quit errors and log"

This commit is contained in:
jenkins-bot 2020-06-24 19:24:53 +00:00 committed by Gerrit Code Review
commit c6d444e251

View file

@ -6,7 +6,7 @@ const accessKey = process.env.SAUCE_ONDEMAND_ACCESS_KEY,
Jimp = require( 'jimp' ), Jimp = require( 'jimp' ),
username = process.env.SAUCE_ONDEMAND_USERNAME, username = process.env.SAUCE_ONDEMAND_USERNAME,
webdriver = require( 'selenium-webdriver' ), webdriver = require( 'selenium-webdriver' ),
TIMEOUT = 40 * 1000; TIMEOUT = 10 * 1000;
function createScreenshotEnvironment( test, beforeEach ) { function createScreenshotEnvironment( test, beforeEach ) {
let clientSize, driver; let clientSize, driver;
@ -31,7 +31,10 @@ function createScreenshotEnvironment( test, beforeEach ) {
driver.manage().timeouts().setScriptTimeout( TIMEOUT ); driver.manage().timeouts().setScriptTimeout( TIMEOUT );
driver.manage().window().setSize( 1200, 1000 ); driver.manage().window().setSize( 1200, 1000 );
driver.get( 'https://en.wikipedia.org/wiki/Help:Sample_page?veaction=edit&uselang=' + lang ); driver.get( 'https://en.wikipedia.org/wiki/Help:Sample_page?veaction=edit&uselang=' + lang )
.then( null, function ( e ) {
console.error( e.message );
} );
driver.wait( driver.wait(
driver.executeAsyncScript( driver.executeAsyncScript(
require( './screenshots-client/utils.js' ) require( './screenshots-client/utils.js' )
@ -57,7 +60,10 @@ function createScreenshotEnvironment( test, beforeEach ) {
} ); } );
test.afterEach( function () { test.afterEach( function () {
driver.quit(); driver.quit()
.then( null, function ( e ) {
console.error( e.message );
} );
} ); } );
function cropScreenshot( filename, imageBuffer, rect, padding ) { function cropScreenshot( filename, imageBuffer, rect, padding ) {