Merge "Add AbstractBlock parent class for Block"
[lhc/web/wiklou.git] / tests / selenium / wdio.conf.js
index 916ee74..5b4a9d5 100644 (file)
@@ -52,6 +52,7 @@ exports.config = {
 
        // ==================
        // Test Files
+       // FIXME: The non-core patterns to be removed once T199116 is fixed.
        // ==================
        specs: [
                relPath( './tests/selenium/wdio-mediawiki/specs/*.js' ),
@@ -63,7 +64,9 @@ exports.config = {
        ],
        // Patterns to exclude
        exclude: [
-               relPath( './extensions/CirrusSearch/tests/selenium/specs/**/*.js' )
+               relPath( './extensions/CirrusSearch/tests/selenium/specs/**/*.js' ),
+               // Disabled per T222517
+               relPath( './skins/MinervaNeue/tests/selenium/specs/**/*.js' )
        ],
 
        // ============
@@ -117,7 +120,8 @@ exports.config = {
 
        // Setting this enables automatic screenshots for when a browser command fails
        // It is also used by afterTest for capturig failed assertions.
-       screenshotPath: logPath,
+       // We disable it since we have our screenshot handler in the afterTest hook.
+       screenshotPath: null,
 
        // Default timeout for each waitFor* command.
        waitforTimeout: 10 * 1000,
@@ -153,7 +157,8 @@ exports.config = {
        */
        beforeTest: function ( test ) {
                if ( process.env.DISPLAY && process.env.DISPLAY.startsWith( ':' ) ) {
-                       let videoPath = filePath( test, this.screenshotPath, 'mp4' );
+                       var logBuffer;
+                       let videoPath = filePath( test, logPath, 'mp4' );
                        const { spawn } = require( 'child_process' );
                        ffmpeg = spawn( 'ffmpeg', [
                                '-f', 'x11grab', //  grab the X11 display
@@ -165,17 +170,29 @@ exports.config = {
                                videoPath // output file
                        ] );
 
+                       logBuffer = function ( buffer, prefix ) {
+                               let lines = buffer.toString().trim().split( '\n' );
+                               lines.forEach( function ( line ) {
+                                       console.log( prefix + line );
+                               } );
+                       };
+
                        ffmpeg.stdout.on( 'data', ( data ) => {
-                               console.log( `ffmpeg stdout: ${data}` );
+                               logBuffer( data, 'ffmpeg stdout: ' );
                        } );
 
                        ffmpeg.stderr.on( 'data', ( data ) => {
-                               console.log( `ffmpeg stderr: ${data}` );
+                               logBuffer( data, 'ffmpeg stderr: ' );
                        } );
 
-                       ffmpeg.on( 'close', ( code ) => {
+                       ffmpeg.on( 'close', ( code, signal ) => {
                                console.log( '\n\tVideo location:', videoPath, '\n' );
-                               console.log( `ffmpeg exited with code ${code}` );
+                               if ( code !== null ) {
+                                       console.log( `\tffmpeg exited with code ${code} ${videoPath}` );
+                               }
+                               if ( signal !== null ) {
+                                       console.log( `\tffmpeg received signal ${signal} ${videoPath}` );
+                               }
                        } );
                }
        },
@@ -196,8 +213,8 @@ exports.config = {
                        return;
                }
                // save screenshot
-               let screenshotPath = filePath( test, this.screenshotPath, 'png' );
-               browser.saveScreenshot( screenshotPath );
-               console.log( '\n\tScreenshot location:', screenshotPath, '\n' );
+               let screenshotfile = filePath( test, logPath, 'png' );
+               browser.saveScreenshot( screenshotfile );
+               console.log( '\n\tScreenshot location:', screenshotfile, '\n' );
        }
 };