@Danny is on the right track. Except that you are simply missing the 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 that you can spot this kind of problems much earlier in the process - statically even before executing your tests and trying to figure out what went wrong. If you would use ESLint
and eslint-plugin-protractor
plugin (>=1.29.0), the valid-locator-type
rule would warn you if you have passed a literal to element()
or element.all()
, or if you have passed a "by" locator to $()
or $$()
.
And, if you have ESLint
configured in your IDE of choice, here is how you would get the warning during the live-coding (example from PyCharm):
