Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Moving to async/await while keeping filter raises 'Connection refused: connect' and 'ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444' #4706

@dubzzz

Description

@dubzzz

Bug report

  • Node Version: v8.5.0
  • Protractor Version: 5.1.0
  • Angular Version: 1.6.7
  • Browser(s): Chrome 64.0.3282.140
  • Operating System and Version Windows 7

While trying to move away from the promise manager of Selenium, I encountered new random failures which were not occurring before. After analyze it appeared that it might be linked to the filter function offered by Protractor.

Here is an extract of the configuration and scripts I am using. All the code is available on https://github.com/dubzzz/protractor-move-async-await. The localhost:3000 exposes the todolist example of AngularJS official website with a list of a thousand entries.

Using the promise manager:

conf.js

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['todo-spec.js'],
  SELENIUM_PROMISE_MANAGER: 1
};

todo-spec.js

browser.get('http://localhost:3000/index.html');
element.all(by.repeater('todo in todoList.todos'))
  .filter(todo => todo.getText().then(label => label.indexOf('#10') !== -1))
  .each(todo => todo.element(by.css('input')).click());

Using async/await:

conf.js

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['todo-spec.js'],
  SELENIUM_PROMISE_MANAGER: 0
};

todo-spec.js

await browser.get('http://localhost:3000/index.html');
await element(by.model('todoList.todoText')).sendKeys('write first protractor test');
await element(by.css('[value="add"]')).click();
await element.all(by.repeater('todo in todoList.todos'))
  .filter(todo => todo.getText().then(label => label.indexOf('#10') !== -1))
  .each(todo => todo.element(by.css('input')).click());

The asynchronous version failed with the following error:

1) [async] angularjs homepage todo list should add a todo
  Message:
    Failed: java.net.ConnectException: Connection refused: connect

The full proof off concept is available on my personal Github at https://github.com/dubzzz/protractor-move-async-await

Is the bug coming from an issue in my configuration or is there a real issue?

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions