Are you sure you're getting undefined is not a function
in line done()
?
I think your problem is here: ptor.findElement(protractor.By.repeater('message in messages'))
because by then your clearly are on an Angular page so, regarding webdriver's findElement for a repeater: you should not be doing that.
Anyway, I would do 2 things:
- Upgrade Protractor to latest
- Rewrite the whole test like below since calling
done()
here is not required at all.
Rewrite:
describe('Login screen tests', function () {
// Page Objects. TODO: Extract to separate module file.
var submitBtnElm = $('#submit');
var messagesRepElms = element.all(by.repeater('message in messages'));
describe('Blank Username & Password test', function() {
// Moved login get out of beforeEach since you need to get it once
it('Opens an Angular login page', function() {
browser.get('http://staging-machine/login/#/');
});
it('Clicks submit btn without entering required fields', function() {
submitBtnElm.click();
});
it('Should trigger validation errors', function() {
expect(messagesRepElms.first().isPresent()).toBeTruthy();
expect(messagesRepElms.first().getText()).
toContain('Username or Password can\'t be blank');
});
});
});