javascript - Verifying amount of elements using expect -
so have element identified
var erroralert = element.all('[id*="type-alert"]'); i trying create function verify there 2 alerts displayed..
this.isalertsdisplayed = function() { return expect(erroralert.count()).toequal(2); }; i keep gettin friken typeerror : .toequal not function when have seen example work others.. doing wrong?
@danny on right track. except missing by.css() part, replace:
var erroralert = element.all('[id*="type-alert"]'); with:
var erroralert = element.all(by.css('[id*="type-alert"]')); or with:
var erroralert = $$('[id*="type-alert"]'); note can spot kind of problems earlier in process - statically before executing tests , trying figure out went wrong. if use eslint , eslint-plugin-protractor plugin (>=1.29.0), valid-locator-type rule warn if have passed literal element() or element.all(), or if have passed "by" locator $() or $$().
and, if have eslint configured in ide of choice, here how warning during live-coding (example pycharm):

Comments
Post a Comment