I'm still learning Protractor so I'm not sure if this is a simple answer that I'm not getting but I'm just trying to have the browser wait until the attribute I'm retrieving is true.
I'm testing the pizza option for this site.
Complete code:
browser.get('https://material.angularjs.org/latest/#/demo/material.components.select');
var topping = element(by.model('topping'));
topping.click();
browser.wait(function() {
return topping.getAttribute('aria-expanded').then(function(value) {
return value == 'true';
});
}, 5000);
var toppingOptions = element.all(by.css('[role="option"]'));
toppingOptions.get(5).click();
expect(topping.getText()).toBe('Onion');
This gives me the error:
Element is not clickable at point (436, 693). Other element would receive the click:
<md-backdrop class="md-select-backdrop md-click-catcher md-default-theme"></md-backdrop>
One more note, if I put browser.sleep(1000);
after topping.click()
and before browser.wait()
then the test passes. So I know the rest of the test isn't what's failing. For some reason the call to wait isn't working.
I'm thinking it might have something to do with the fact that the option I'm trying to click is not technically visible when topping
is clicked because it's in a ComboBox with a scroll element. If anyone knows a good way to simulate scrolling to the "onion" element it would be much appreciated as well.