Question

I have the following working e2e test code:

it('should ...', function () {
    var promise = element('#id').query(function (elements, done) {
        var children = elements.children();
        done(null, children.prevObject[0].innerHTML);
    });

    var pattern = /...some pattern.../;
    expect(promise).toMatch(pattern);
});

However, I want to return a list of data in done() and then test each element. How to do that? The angularjs's e2e document is very poor and I can't find anything useful there.

I want something like this:

it('should ...', function () {
    var promise = element('#id').query(function (elements, done) {
        var children = elements.children();
        done(null, children.prevObject);
    });

    var pattern = /...some pattern.../;
    expect(item.innerHTML in promise).toMatch(pattern);
});

Thanks in advance!

Was it helpful?

Solution

You can always loop through your array prevObject and write an expectation within the loop.

for(var i = 0; i < promise.length; i++) {
  expect(promise[i].innerHTML).toMatch(pattern);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top