I have the following code:
const inputBoxes = await landingPage.getPortIdInputBox();
await inputBoxes[0].sendKeys('0040');
await inputBoxes[1].sendKeys('9142');
const url: string = await browser.getCurrentUrl();
expect(url).toContain('/profile?fund1=0040&fund2=9142');
I am writing e2e test cases for my Angular 6 app with Protractor and Jasmine, all the tests seem to be running fine but at times the flow stops after entering the text into the input boxes.
It stops for around a minute and then successfully confirms the result.
I have 2 methods that checks for the user inputs by using sendKeys
method form WebdriverJS
, sometimes the flow stops in the first function and at times it stops in the second function after entering the text in the input box.
I am even using async/awaut
to take care of the promises returned by the WebdriverJS
methods. This is resulting in the build getting failed in the CD pipeline with the following error:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Not sure where I am going wrong. Locally all the tests pass well within the timeout range but they fail in the CD pipeline.
Here's my protractor.conf.js file:
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
const JUnitXmlReporter = require('jasmine-reporters').JUnitXmlReporter;
const ENV = require('../variables.js');
const path = require('path');
const tsNode = require('ts-node');
exports.config = {
logLevel: 'DEBUG',
SELENIUM_PROMISE_MANAGER: false,
allScriptsTimeout: 120000,
getPageTimeout: 120000,
specs: [path.join(__dirname, 'src', '**/*.e2e-spec.ts')],
directConnect: ENV.PROTRACTOR_DIRECT_CONNECT,
multiCapabilities: ENV.PROTRACTOR_MULTI_CAPABILITIES,
seleniumAddress: ENV.PROTRACTOR_SELENIUM_ADDRESS,
chromeDriver: ENV.PROTRACTOR_CHROME_DRIVER,
resultJsonOutputFile: ENV.TEST_E2E_REPORT_FILE,
baseUrl: ENV.BASE_URL,
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 120000,
print: function() {}
},
onPrepare() {
tsNode.register({ project: path.join(__dirname, './tsconfig.e2e.json') });
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
jasmine.getEnv().addReporter(
new JUnitXmlReporter({
savePath: ENV.TEST_E2E_REPORT_DIRECTORY
})
);
}
};