CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

java.net.SocketException: Connection reset by peer (connect failed)

Open innopreneur opened this issue 8 years ago • 7 comments

What are you trying to achieve?

I am trying to execute data driven tests using Data(arrayOfTestData).Scenario() functionality of codeceptjs. (update - it is not data driven issue, but it still fails with normal run as well)

What do you get instead?

When I start execution, scenario is executed for few times and then it fails with java.net.SocketException: Connection reset by peer (connect failed). I looked up this issue and found issue linked here but looks like it was found in selenium-standalone version 3.5+ and current selenium version is 6.12.0

Provide console output if related. Use --verbose mode for more details.

1) @translations - I look for missing translations for all services: "before each" hook: codeceptjs.before for "I look for missing translations | {"isoCode":"<some-isoCode>","languageCode":"<some-lang-code>","service":{"name":"test-plus","waitFor":"//element]":
     java.net.SocketException: Connection reset by peer (connect failed)




[mochawesome] Report JSON saved to /output/mochawesome.json

[mochawesome] Report HTML saved to /output/mochawesome.html

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] codecept: `codeceptjs run -c codecept-config.js --verbose --grep translations --steps --reporter mochawesome`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] codecept script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /.npm/_logs/2017-12-15T10_00_17_810Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] param: `cross-env INSTANCE=CT npm run codecept`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] param script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /.npm/_logs/2017-12-15T10_00_17_850Z-debug.log

Provide test source code if related

const config = require('../../testConfig');
const portalPage = require('../pages/Portal');
let languageCodes = require('../../resources/languageCodes');
let services = require('../../resources/services');
let prepareTestData = require('../common/testDataPrep');
let codes = new DataTable(['variable1',"variable2","variable3","variable4"]);

prepareTestData(codes, languageCodes, services);

Feature('@translations - I look for missing translations for all services');

Data(codes).Scenario('I look for missing translations', {retries: 3}, (I, current) => {
  console.log('Options - ' + JSON.stringify(current));
  if (current.env !== 'SomeEnv') {
    I.amOnPage('/');
    //login into portal
    portalPage.loginIntoPortal(
      current.variable1.test[config.env].username || config.username,
      config.password
    );
  }
  //go to service
  I.amOnPage(
      current.variable1.trim() +
      '/' +
      current.variable2.trim() +
      '/' +
      current.variable3.name +
      '/' +
      current.variable4
  );
  //I pause  for 3 seconds for all translation keys to be loaded
  I.pauseFor(2);
  //wait for element for maximum 10 seconds
  I.waitForElement(current.service.waitFor, 10);

  I.dontSee('[missing]');
});

Details

  • CodeceptJS version: 1.0.3
  • NodeJS Version: 6.8.0
  • Operating System: MasOS Sierra 10.12.6
  • WebDriverIO : 6.12.0
  • Configuration file:
let config = require('./testConfig');

exports.config = {
  output: './results',
  helpers: {
    WebDriverIO: {
      url: config.baseUrl ,
      browser: 'chrome',
      windowSize: 'maximize',
      smartWait: '10000',
      timeout: '10000',
      restart: 'false',
      keepCookies: 'true',
      desiredCapabilities: {
        browserName: 'chrome',
        chromeOptions: {
          args: [] 
        }
      }
    },
    WebDriverIOHelper: {
      require: './src/helpers/webDriverIOHelper.js'
    }
  },
  include: {
    portalPage: './src/pages/Portal.js'
  },
  mocha: {
    reporterOptions: {
      reportDir: './output'
    }
  },
  bootstrap: null,
  teardown: null,
  hooks: [],
  tests: './src/test/**/*.js',
  timeout: 10000,
  name: 'SanityCheck'
};

innopreneur avatar Dec 15 '17 10:12 innopreneur

I tested without using Data().Scenario, it still fails with same error. Looks like it is not data driven issue. But its still an issue

innopreneur avatar Dec 15 '17 11:12 innopreneur

Anyone has a clue how to fix this issue?

dwaned avatar Jan 02 '18 21:01 dwaned

Any suggestions here? We are seeing this issue as well. It seems to happen with only some subset of tests.

manand77 avatar Jan 09 '18 22:01 manand77

I'm completely lost on this. The error shows up randomly and stops tests abruptly. Tried switching from using selenium-standalone through the bootstrap, to manually starting selenium through webdriver-manager however nothing seems to be helping.

dwaned avatar Jan 10 '18 22:01 dwaned

I was able to find a fix for this problem, see #899. I was experiencing the exact same problem and by dev setup is almost identical to yours.

It looks like that this only affected webdriverio and the chrome driver (see links in the PR for related problems in both the wd repo and the chromedriver repo.

I found that by changing the webdriverio api calls to execute serially rather in parallel then the problem went away :) The PR should be merged soondish (fingers crossed).

reubenmiller avatar Feb 03 '18 23:02 reubenmiller

Hi @reubenmiller thanks for that, great stuff! So I believe it is part of the 1.1.3 release then :-)

testautonation avatar Feb 05 '18 10:02 testautonation

@DavertMik I think we can close this now :) Fixed in #899

reubenmiller avatar Feb 10 '18 09:02 reubenmiller