I have a setting in my angular based website that turns a dropdown on and off. If it is off, then it does not show on the main page.
With Protractor, I need to check to
none of these answers which include count()
worked for me;
the typeof $$('.selector').count() is
'object'
you have to use the promise to pull the count
value out like this.
const nameSelector = '[data-automation="name-input"]';
const nameInputIsDisplayed = () => {
return $$(nameSelector).count()
.then(count => count !== 0)
}
it('should not be displayed', () => {
nameInputIsDisplayed().then(isDisplayed => {
expect(isDisplayed).toBeFalsy()
})
})