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.

element.all(locator).each(eachFunction) should return a promise #1330

@jlin412

Description

@jlin412

Currently, it is difficult to use .each method for cucumber framework because there is no promise returned so we can't end and call next callback in the last protractor call like other protractor calls.
I think that we should get a fulfilled or rejected response from .each method as feature request.

This is what I like to see:

  this.Then(/^I should be able to click on each of the navigation menu item$/, function (next) {
    element.all(by.css('ul.menu li')).each(function (item) {
      item.click();
    }).then(next);
  }

Currently, I have to do:

  this.Then(/^I should be able to click on each of the navigation menu item$/, function (next) {
     var index = 0;
    element.all(by.css('ul.menu li')).count().then(function(total) {
      element.all(by.css('ul.menu li')).each(function (item) {
        index++;
        if(total === index) {
          item.click().then(next);
        }else 
          item.click();
        }
      });
    }
  }

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