You should not be doing expectations in a page object. That's defeating the purpose of a page object and somewhat bad practice. I saw the generation of the simple example on the website here:
var UnnamedPageObject = function() {
this.get = function() {
browser.get('');
};
this.a0 = element(by.css('a.a'));
this.clickA0 = function() {
this.a0.click();
};
this.a0ShouldBeVisible = function() {
expect(this.a0.isDisplayed()).toBeTruthy();
};
this.a0ShouldNotBeVisible = function() {
expect(this.a0.isDisplayed()).toBeFalsy();
};
this.a0ShouldHaveClass = function(className) {
this.a0.getAttribute('class').then(function(classes) {
expect(classes.split(' ').indexOf(className) !== -1).toBeTruthy();
});
};
this.a0ShouldNotHaveClass = function(className) {
this.a0.getAttribute('class').then(function(classes) {
expect(classes.split(' ').indexOf(className) === -1).toBeTruthy();
});
};
};
module.exports = new UnnamedPageObject();
The expectations are typically something you should do in your test file. Not in a helper class. This beats the purpose of seperation of concern.