Karma-sauce-launcher disables every test run resulting in unsuccessful runs with IE and Safari

I had this exact problem for several months, through several versions of each component (karma, .io socket, sauce mix). I am currently working on Karma 12.16.

In principle, when using https://github.com/karma-runner/karma-sauce-launcher, the Safari browser and IE started disabling each individual test run, which led to a partial trial version. Corresponding Karma Journal

Driving the web on session: abf7c976abf1420a9c72b3e06c655040 DEBUG [wd]: > RESPONSE init({"base":"SauceLabs","browserName":"internet explorer","platform":"Windows 8.1","version":"11","tags":[],"name":"Karma and Sauce Labs demo","record-video":false,"record-screenshots":true,"build":null,"device-orientation":null,"disable-popup-handler":true}) "abf7c976abf1420a9c72b3e06c655040",null INFO [launcher.sauce]: internet explorer 11 (Windows 8.1) session at https://saucelabs.com/tests/abf7c976abf1420a9c72b3e06c655040 DEBUG [launcher.sauce]: WebDriver channel for internet explorer 11 (Windows 8.1) instantiated, opening http://localhost:9876/?id=15483642 DEBUG [wd]: > CALL get("http://localhost:9876/?id=15483642") DEBUG [wd]: > POST /session/:sessionID/url {"url":"http://localhost:9876/?id=15483642"} DEBUG [web-server]: serving: /Volumes/OSXSTORAGE/Users/a/Dropbox/a/WebstormProjects/a-ui/node_modules/karma/static/client.html DEBUG [web-server]: serving: /Volumes/OSXSTORAGE/Users/a/Dropbox/a/WebstormProjects/a-ui/node_modules/karma/static/karma.js DEBUG [wd]: > RESPONSE get("http://localhost:9876/?id=15483642") DEBUG [karma]: A browser has connected on socket xXySXoeppVtPhAr8FVR4 INFO [IE 11.0.0 (Windows)]: Connected on socket xXySXoeppVtPhAr8FVR4 with id 15483642 DEBUG [launcher]: internet explorer 11 (Windows 8.1) on SauceLabs (id 15483642) captured in 17.693 secs DEBUG [web-server]: serving: /Volumes/OSXSTORAGE/Users/a/Dropbox/a/WebstormProjects/a-ui/node_modules/karma/static/context.html DEBUG [web-server]: serving (cached): /Volumes/OSXSTORAGE/Users/a/Dropbox/a/WebstormProjects/a-ui/src/components/angular/angular.js ................................................................................ ..............DEBUG [karma]: A browser has connected on socket mGf0VzQ8DKdfW_NSFVR5 DEBUG [IE 11.0.0 (Windows)]: New connection mGf0VzQ8DKdfW_NSFVR5 (already have xXySXoeppVtPhAr8FVR4) WARN [IE 11.0.0 (Windows)]: Disconnected (1 times), because no message in 10000 ms. IE 11.0.0 (Windows): Executed 94 of 94 DISCONNECTED (11.481 secs / 0.757 secs) DEBUG [launcher.sauce]: Shutting down the internet explorer 11 (Windows 8.1) driver DEBUG [wd]: > CALL get("about:blank") DEBUG [wd]: > POST /session/:sessionID/url {"url":"about:blank"} DEBUG [karma]: Run complete, exitting. DEBUG [launcher]: Disconnecting all browsers DEBUG [wd]: > RESPONSE get("about:blank") DEBUG [wd]: > CALL quit() DEBUG [wd]: > DELETE /session/:sessionID DEBUG [wd]: Ending your web drivage.. DEBUG [wd]: > RESPONSE quit() 

I tried increasing browserNoActivityTimeout to 60,000, but this just leads to test failures after 60 seconds instead of 10. Each of them failed to complete the following steps:

 DEBUG [karma]: A browser has connected on socket mGf0VzQ8DKdfW_NSFVR5 DEBUG [IE 11.0.0 (Windows)]: New connection mGf0VzQ8DKdfW_NSFVR5 (already have xXySXoeppVtPhAr8FVR4) WARN [IE 11.0.0 (Windows)]: Disconnected (1 times), because no message in 10000 ms. IE 11.0.0 (Windows): Executed 94 of 94 DISCONNECTED (11.481 secs / 0.757 secs) 

Depending on the browser, sometimes only 50 tests are performed (50 out of 94 DISCONNECTED completed), while on others it will perform all the tests, but will still be considered a failed test run. I have never seen this happen with Chrome or Firefox.

The exact same karma.conf file will be run locally every time without problems. Has anyone come across this? I turned to saucelabs support, but they are starting to insist that this is a problem with the karma-sauce-launcher.

Karma.conf:

 var fs = require('fs'); module.exports = function(config) { // Use ENV vars on Travis and sauce.json locally to get credentials if (!process.env.SAUCE_USERNAME) { if (!fs.existsSync('sauce.json')) { console.log('Create a sauce.json with your credentials based on the sauce-sample.json file.'); process.exit(1); } else { process.env.SAUCE_USERNAME = require('./../sauce').username; process.env.SAUCE_ACCESS_KEY = require('./../sauce').accessKey; } } // Browsers to run on Sauce Labs var customLaunchers = { sl_safari_ml: { base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.9' } }; config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '../', // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine'], // list of files / patterns to load in the browser files: [ 'src/components/jquery/dist/jquery.js', 'src/components/angular/angular.js', 'src/components/angular-mocks/angular-mocks.js', 'src/components/angular-cookies/angular-cookies.js', 'src/components/angular-sanitize/angular-sanitize.js', 'src/components/angular-ui-router/release/angular-ui-router.js', 'src/components/angular-animate/angular-animate.js', 'src/components/angular-strap/dist/angular-strap.js', 'src/components/angular-strap/dist/angular-strap.tpl.js', 'src/components/speakingurl/lib/index.js', 'src/app/**/*.js', 'src/app/common/templates/*.html' ], exclude: [ 'src/app/**/*.e2e.spec.js' ], ngHtml2JsPreprocessor: { stripPrefix: 'src/app/common/', moduleName: 'mywire.templates' }, preprocessors: { // load templates 'src/app/common/templates/*.html': ['ng-html2js'] }, // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['dots'], // web server port port: 9876, colors: true, // level of logging // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG logLevel: config.LOG_INFO, sauceLabs: { testName: 'Karma and Sauce Labs demo', startConnect: false }, browserNoActivityTimeout: 60000, captureTimeout: 120000, customLaunchers: customLaunchers, // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: Object.keys(customLaunchers), singleRun: true }); }; 
+6
source share
1 answer

Starting with Karma version 0.12, a few more timeout settings have been added.

Adding them to my karma configuration resolved this issue for me.

 browserDisconnectTimeout 
  • Type: Number
  • Default: 2000
  • Description: How long does Karma wait for the browser to reconnect (in ms). With flaky, the connection is quite common that the browser is disconnected, but the actual execution is performed without problems. Karma does not apply to disconnection, since an immediate failure and, rather, wait browserDisconnectTimeout ms. If the browser reconnects during this time, everything is in order.

-

 browserDisconnectTolerance 
  • Type: Number
  • Default: 0
  • Description: number of shutdowns disabled. The disconnectTolerance value represents the maximum number of attempts that the browser will attempt to complete in case of disconnection. Usually, any disconnection is considered a failure, but this parameter allows you to determine the tolerance level when there is a broken network connection between the karma server and browsers.

-

 browserNoActivityTimeout 
  • Type: Number
  • Default: 10000
  • Description: How long does Karma wait for a message from the browser before disabling it (in ms). If at runtime Karma does not receive messages from the browser in NoActivityTimeout ms browser, it will disable the browser.

source: http://karma-runner.imtqy.com/0.12/config/configuration-file.html

more tips: http://oligofren.wordpress.com/2014/05/27/running-karma-tests-on-browserstack/

+10
source

Source: https://habr.com/ru/post/970492/


All Articles