I am testing a form in Angular 9, and I want to check if any error messages are displayed using Protractor 5.4.3. Error messages are shown according to an *ngIf.
Outside the test, the code works normally.
If I do the search as the official documentation recommends, there is no element:
const elements = await element.all(by.css('.my-class')).getWebElements();
But if I do it this way, the result is returned correctly:
const elements = await browser.findElements(by.css('.my-class'));
Although my test works using the second solution, I would like to understand what the difference is between the two, and what I'm doing wrong so the first way doesn't work. Could anyone explain? Thanks.
Ps: As I understand it, the two forms would be equivalent, because according to official documentation, it would be just syntactic sugar. But there is obviously some difference between them, since only one works for me, or else it is a bug.