javascript - Protractor map function returning undefined -


given app multiple widgets on it, each own title , whatnot, map each widget's elements, make them easy handle in tests.

for example, page:

this.widgets = element.all(by.css('ul.widget-grid')).map(function(widget, index) {     return {         index: index,         title: widget.element(by.css('div.title')).gettext()     }; }); 

and in spec:

expect(page.widgets[0].index).tobe(0); expect(page.widgets[0].title).tobe('the title'); 

unfortunately, expects returning undefined.

what doing wrong? i'm using protractor 2.0.

this confused me thought i'd add answer others...

while understood map() returns promise, because using in expect, thought resolved, , should act array. nope. returns object, looks array, not array.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -