jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403710 )

Change subject: Catch timeout errors in screenshot scripts
......................................................................


Catch timeout errors in screenshot scripts

Bug: T184724
Change-Id: Ifbc03b1291c291dcfc862487766e3786f9bd437c
---
M Gruntfile.js
M build/screenshots.js
2 files changed, 29 insertions(+), 7 deletions(-)

Approvals:
  Zfilipin: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Gruntfile.js b/Gruntfile.js
index f25fad1..9436bfb 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -11,7 +11,9 @@
        var modules = grunt.file.readJSON( 'lib/ve/build/modules.json' ),
                screenshotOptions = {
                        reporter: 'spec',
-                       timeout: 40000,
+                       // TODO: Work out how to catch this timeout and 
continue.
+                       // For now just make it very long.
+                       timeout: 5 * 60 * 1000,
                        require: [
                                function () {
                                        // eslint-disable-next-line no-undef, 
no-implicit-globals
@@ -21,7 +23,9 @@
                },
                screenshotOptionsAll = {
                        reporter: 'spec',
-                       timeout: 40000,
+                       // TODO: Work out how to catch this timeout and 
continue.
+                       // For now just make it very long.
+                       timeout: 5 * 60 * 1000,
                        require: [
                                function () {
                                        // eslint-disable-next-line no-undef, 
no-implicit-globals
diff --git a/build/screenshots.js b/build/screenshots.js
index d163a43..f7d6fee 100644
--- a/build/screenshots.js
+++ b/build/screenshots.js
@@ -1,5 +1,7 @@
 /* global seleniumUtils */
 
+/* eslint-disable no-console */
+
 ( function () {
        'use strict';
        var accessKey = process.env.SAUCE_ONDEMAND_ACCESS_KEY,
@@ -7,7 +9,8 @@
                fs = require( 'fs' ),
                Jimp = require( 'jimp' ),
                username = process.env.SAUCE_ONDEMAND_USERNAME,
-               webdriver = require( 'selenium-webdriver' );
+               webdriver = require( 'selenium-webdriver' ),
+               TIMEOUT = 40 * 1000;
 
        function createScreenshotEnvironment( test, beforeEach ) {
                var clientSize, driver;
@@ -29,7 +32,7 @@
                                driver = new chrome.Driver();
                        }
 
-                       driver.manage().timeouts().setScriptTimeout( 40000 );
+                       driver.manage().timeouts().setScriptTimeout( TIMEOUT );
                        driver.manage().window().setSize( 1200, 1000 );
 
                        driver.get( 
'https://en.wikipedia.org/wiki/Help:Sample_page?veaction=edit&uselang=' + lang 
);
@@ -132,10 +135,22 @@
                                        }
                                ).then( function ( cs ) {
                                        clientSize = cs;
+                               }, function ( e ) {
+                                       // Log error (timeout)
+                                       console.error( e.message );
                                } )
                        );
                        if ( beforeEach ) {
-                               driver.wait( driver.executeAsyncScript( 
beforeEach ) );
+                               driver.manage().timeouts().setScriptTimeout( 
TIMEOUT );
+                               driver.wait(
+                                       driver.executeAsyncScript( beforeEach 
).then(
+                                               function () {},
+                                               function ( e ) {
+                                                       // Log error (timeout)
+                                                       console.error( 
e.message );
+                                               }
+                                       )
+                               );
                        }
                } );
 
@@ -165,6 +180,7 @@
                function runScreenshotTest( name, lang, clientScript, padding ) 
{
                        var filename = './screenshots/' + name + '-' + lang + 
'.png';
 
+                       driver.manage().timeouts().setScriptTimeout( TIMEOUT );
                        driver.wait(
                                driver.executeAsyncScript( clientScript ).then( 
function ( rect ) {
                                        return driver.takeScreenshot().then( 
function ( base64Image ) {
@@ -176,8 +192,10 @@
                                                        fs.writeFile( filename, 
base64Image, 'base64' );
                                                }
                                        } );
-                               } ),
-                               40000
+                               }, function ( e ) {
+                                       // Log error (timeout)
+                                       console.error( e );
+                               } )
                        );
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/403710
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifbc03b1291c291dcfc862487766e3786f9bd437c
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to