Given an application with several widgets on it, each with its own name and much more, I would like to map each element of the widget to simplify their processing in tests.
For example, the 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 then in my specification:
expect(page.widgets[0].index).toBe(0);
expect(page.widgets[0].title).toBe('The Title');
Unfortunately, my expectations come back undefined.
What am I doing wrong? I am using Protractor 2.0.
Brine source
share