I'm trying to write a test that checks whether or not an element has a class:
element('#header-menu .menu-component-item a').query(function(els, done) {
var el = els.eq(4);
el.click();
sleep(.25);
expect(browser().location().path()).toBe(el.attr('href'));
expect(el.attr('class')).toContain('selected');
done();
});
The issue is that I keep getting the error TypeError: Cannot read property 'indexOf' of undefined
. I expected el.attr('class')
to be a future but I'm not sure why it isn't. Is there another way around this?