0

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
      })
    );
  }
};
Pritam Bohra
  • 3,912
  • 8
  • 41
  • 72
  • can we take a look at your config? tag me please when you upload it – Sergey Pleshakov Nov 03 '18 at 00:30
  • try different version of `chrome` on CD – Oleksii Nov 04 '18 at 19:40
  • @SergeyPleshakov I have added protractor.conf.js file – Pritam Bohra Nov 05 '18 at 13:50
  • Still not enough information. But to save our time I'll post my guess and if it'll work I'll post full information about the solution. In my **conf.js** I have `capabilities` obj, where I specify my browser as `"browserName": "chrome"` and that object takes property `"chromeOptions"` which in turn takes `"args"`. The value of `"args"` property is an array of arguments for chrome to execute it with. So that array must include "--no-sandbox" argument in order to start tests from host. IT WON'T WORK WITHOUT IT. If you can't figure out what to do, post your `ENV.PROTRACTOR_CHROME_DRIVER` – Sergey Pleshakov Nov 05 '18 at 20:35

0 Answers0