-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Issue: Timeout Async callback in Protractor. we are using protractor with jasmine framework #5381
Description
While running our End to End scripts we are getting below error,
"Issue with Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT"
tried to increase default timeout interval in config, but still the scripts are passing partially.
Also, used the below lines in spec file. overall script execution time is getting delayed because of the below code.
const interval =20000;
beforeEach(function() {
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = interval;
});
afterEach(function() {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});
Chrome version 79.0.3945.79
driver version 79.0.3945.36
we are working on angular 8 version web based application.
below is our config file
const { SpecReporter } = require('jasmine-spec-reporter'),
HtmlReporter = require('protractor-jasmine2-html-reporter'),
JasmineReporters = require('jasmine-reporters');
let specReporter = new SpecReporter({
spec: {
displayStacktrace: false,
displayFailed: true,
displayErrorMessages: true,
},
}),
htmlReporter = new HtmlReporter({
savePath: './test/reports',
screenshotsFolder: 'imgs',
takeScreenshots: true,
takeScreenshotsOnlyOnFailures: false,
fixedScreenshotName: false,
fileName: 'index',
consolidate: 'false',
}),
junitReporter = new JasmineReporters.JUnitXmlReporter({
consolidateAll: true,
savePath: './test/reports',
filePrefix: 'TTS-JUnitXML-report',
});
exports.config = {
allScriptsTimeout: 30000,
specs: ['./test///.e2e-spec.ts'],
suites: {
view: './test//.view-spec.ts',
},
capabilities: {
browserName: 'chrome',
unexpectedAlertBehaviour: 'accept',
chromeOptions: {
args: ['--headless', '--disable-gpu', '--window-size=1680,1050'],
prefs: {
download: {
directory_upgrade: true,
prompt_for_download: false,
default_directory: './test/reports/downloads',
},
},
},
},
directConnect: true,
baseUrl: 'http://localhost:4200',
useAllAngular2AppRoots: true,
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 20000,
print: function() {},
},
onPrepare() {
require('ts-node').register({
project: 'test/tsconfig.e2e.json',
});
global.all = require('./test/common/all');
browser.driver.sendChromiumCommand('Page.setDownloadBehavior', {
behavior: 'allow',
downloadPath: process.cwd() + '\\test\\reports\\downloads',
});
await browser.waitForAngularEnabled(true);
jasmine.getEnv().addReporter(specReporter);
jasmine.getEnv().addReporter(htmlReporter);
jasmine.getEnv().addReporter(junitReporter);
},
};