javascript - Protractor:Assertion on arrayofelements.getText() is returning empty list -
below assertion code not working in ci(due slowness,maybe) works fine in local system in ci,i dont list of elements @ or returns 1 or 2 elements in array of actual elements
var expectedfromlevels = ['level 2', 'level 3', 'level 4']; var expectedtolevels= ['level 3', 'level 4','level 5']; expect(dashboard.getallfromlevels()).toequal(expectedfromlevels) expect(dashboard.getalltolevels()).toequal(expectedtolevels)//this has called after getallfromlevels assertion complete //definition of getallfromlevels() getallfromlevels : { value: function () { return element.all(by.css('#from-levels .nlq-sel--level')).gettext(); } //definition of getalltolevels() getalltolevels : { value: function() { return element.all(by.css('#to-levels .nlq-sel--level')).gettext(); }; **results::** in local system: passed **in ci:::** expected [ 'level 2', 'level 3' ] equal [ 'level 2', 'level 3', 'level 4' ]. expected [ 'level 3', '' ] equal [ 'level 3', 'level 4', 'level 5' ].
i fixed issue in ci adding browser wait statements-i know not ideal way of doing workaround works time being-
getalllevelscount : { value: function (elements, n) { return function () { return elements.count(function (count) { return count >= n; }); }; } browser.wait(dashboard.getalllevelscount($$("cssid"), 3) , 10000);
Comments
Post a Comment