A rather common mistake can occur when it is needed to find multiple elements in the context of an element using chaining. Example:
element(by.css('.parent')).element.all(by.css('.child'));
// element IS NOT NEEDED^^^^^^^
Correct chaining:
element(by.css('.parent')).all(by.css('.child'));
Fixable: This rule is automatically fixable using the --fix
flag on the command line.
👎 Any use of the following patterns are considered warnings:
element(by.css('.parent')).element.all(by.css('.child'));
$('.parent').element.all(by.css('.child'));
element.all(by.css('.child')).first().element.all(by.css('.child'));
$$('.parent').first().element.all(by.css('.child'));
👍 The following patterns are not warnings:
element(by.css('.parent')).all(by.css('.child'));
$('.parent').all(by.css('.child'));
element.all(by.css('.child')).first().all(by.css('.child'));
$$('.parent').first().all(by.css('.child'));
element(by.css('.parent')).element(by.css('.child'));