The below piece of the config file is for parallel run, though it hangs if running one test at a time
the following error quite often accompanies
- Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
5.4Google Chrome 69.0.3497.100UbuntuChrome args:
'--disable-infobars',
'--disable-notifications',
'--window-size=1440,900',
'--headless',
'--no-sandbox',
'--disable-gpu',
'--enable-logging',
'v=1'
caps:
capabilities: {
browserName: 'chrome',
chromeOptions: chromOpt,
loggingPrefs: {
'browser': 'ALL', // "OFF", "SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "FINER", "FINEST", "ALL"
'server': 'ALL',
'driver': 'ALL'
},
shardTestFiles: true,
maxInstances: 3
},
Log:
17:01:44
17:01:44 [15:01:44] I/testLogger -
17:01:44
17:01:44 [15:01:44] I/launcher - 2 instance(s) of WebDriver still running
17:31:06 Build timed out (after 90 minutes). Marking the build as aborted.
17:33:07 [15:33:07] I/testLogger -
17:33:07 [15:33:07] I/testLogger -
17:33:07
17:33:07 [15:33:07] I/launcher - 1 instance(s) of WebDriver still running
17:33:07 /tmp/jenkins8334328386245671923.sh: line 18: 24330 Terminated protractor test.conf.js --suite=regression --disableChecks
17:33:07 Build was aborted
17:33:07 [htmlpublisher] Archiving HTML reports...
17:33:07 [htmlpublisher] Archiving at PROJECT level /var/lib/jenkins/workspace/STAGING e2e/reports to /var/lib/jenkins/jobs/STAGING e2e/htmlreports/HTML_20Report
Before protractor launch
export DBUS_SESSION_BUS_ADDRESS=/dev/null
From what I have read, the root cause of this issue might be chrome browser
However IMHO, protractor should not hang but time out if this occurs
UPDATE
after some investigation I found out that its all due to
shardTestFiles and maxInstances
Once I stopped testing in parallel all have started working ok
Same issue. Commenting onComplete solved it for us (shardTestFiles and maxInstances no commented).
If you're running tests on CI server in a docker container, try adding --disable-dev-shm-usage to Chrome args. It solved "Chrome not reachable", "no such session" and related timeout issues for us when running sharded tests on multiple instances.
Looks like Chrome's memory usage has changed drastically since v69
@Izhaki I haven't used onComplete so what should i do in that case. below is my protractor.config file
exports.config={
framework: 'jasmine2',
getPageTimeout: pageLoadTimeout,
allScriptsTimeout: allScriptsTimeout,
customerCode: customerCode,
useAllAngular2AppRoots: true,
//directConnect: true,
baseUrl: 'http://localhost:3000',
capabilities: {
browserName: 'chrome',
shardTestFiles: true,
maxInstances: 10,
chromeOptions: {
args: [
'disable-extensions',
'disable-web-security',
'--start-fullscreen',
//enableforMacOS'--headless',
//startonbackground'--disable-gpu',
'--window-size=2880,1800'
]
},
'moz:firefoxOptions': {
args: [
'--headless'
]
}
},
jasmineNodeOpts: {
defaultTimeoutInterval: extendedDefaultTimeoutInterval,
isVerbose: true,
showTiming: true,
includeStackTrace: true,
realtimeFailure: true,
showColors: true
},
suites: {
development: [
testBaseDir+'dev1.js',
testBaseDir+'dev2.js'
]
},
onCleanUp: function(results){
// some action
},
onPrepare(){
// some action
},
beforeLaunch: function(){
// some action
},
afterLaunch: function(){
// some action
}
};
I am trying to execute the test cases on Selenium GRID. The set up is on a docker container. Everything works fine up until the point of execution. Protractor indefinitely hangs and display this:
I/launcher - Running 5 instances of WebDriver
Here is my conf.js. I am using sharedTestFile: True and MaxInstances: 5. Is there something I can do to make this work?
let path = require('path');
import * as fs from "fs";
import { browser, Config } from "protractor";
import { Reporter } from "../support/reporter";
import {util} from "../utils/test";
var log4js = require( "log4js" );
import * as oracledb from 'oracledb';
const jsonReports = process.cwd() + "/reports/json";
const logs = process.cwd() + "/logger/lo.txt";
export const config: Config = {
params: {
environment: 'dit', //fdi or rit can be passed from cmd line
platform: 'browser'
},
seleniumAddress: "http://selenium.companydomain.com:4444/wd/hub",
SELENIUM_PROMISE_MANAGER: false,
baseUrl: "https://test.mycompany.com/app/home/tests",
// baseUrl: env.get(browser.params.environment),
capabilities: {
'browserName': 'chrome',
shardTestFiles: true,
maxInstances: 5,
'chromeOptions': {
'perfLoggingPrefs': {
'enableNetwork': true,
'enablePage': true
//'enableTimeline': false
}
},
loggingPrefs: {
performance: 'INFO',
browser: 'ALL'
}
},
framework: "custom",
frameworkPath: require.resolve("protractor-cucumber-framework"),
specs: [
"../../features/automation/regression/*.feature",
],
onPrepare: () => {
browser.ignoreSynchronization = true;
browser.manage().timeouts().implicitlyWait(12000);
browser.manage().window().maximize();
Reporter.createDirectory(jsonReports);
log4js.configure("./config/log4js.json");
browser.logger = log4js.getLogger("default");
browser.logger2 = log4js.getLogger("another");
browser.logger3 = log4js.getLogger("file");
// hooks.createDirectory(logs);
//return env.get(browser.params.environment);
},
beforeLaunch: () => {
if (fs.existsSync('./logs/ExecutionLog.log')) {
fs.unlinkSync('./logs/ExecutionLog.log');
}},
cucumberOpts: {
compiler: "ts:ts-node/register",
format: "json:./reports/json/cucumber_report.json",
require: ["../../typeScript/stepdefinitions/*.js",
"../../typeScript/support/*.js",
"../../dbUtils/index",
"../../data/url"
],
strict: true,
tags: "@service or @firstTestCase or @dataTable or @db or @nLogs",
//"@service or @firstTestCase or @dataTable or @db or @nLogs'
restartBrowserBetweenTests: true
},
onComplete: () => {
Reporter.createHTMLReport();
},
};
Any ideas would be helpful?
If chrome is running as a docker container then try adding
volumes:
- "/dev/shm:/dev/shm"
to chromenode
should stop chrome from crashing
Most helpful comment
If you're running tests on CI server in a docker container, try adding
--disable-dev-shm-usageto Chrome args. It solved "Chrome not reachable", "no such session" and related timeout issues for us when running sharded tests on multiple instances.Looks like Chrome's memory usage has changed drastically since v69