I'm currently working on developing an angularjs protractor e2e test using the page objects pattern. However, I am running into some issues when trying to convert my script into a page object.
Below is a snippet from my conf.js
file:
// conf.js
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['employee.js']
}
Here is my employee.js
code:
// spec.js
var EmpPageObject = require('./EmpPageObject.js');
describe('Protractor Demo App', function() {
it('should have a title', function() {
var empPageObject = new EmpPageObject();
empPageObject.get();
empPageObject.setName('mee');
empPageObject.setPassword('123');
});
});
And here is how my EmpPageObject.js
looks like:
var EmpPageObject = function() {
var nameInput = element(by.model('login.user_name'));
var passwordInput = element(by.model('login.password'));
var addButton = element(by.css('.btn'));
this.get = function() {
browser.get('http://');
};
this.setName = function(name) {
nameInput.sendKeys(name);
};
this.setPassword = function(password) {
passwordInput.sendKeys(password);
};
addButton.click();
};
Unfortunately, my script is failing and I'm receiving the following error:
Failures:
1) Protractor Demo App should have a title
Message:
Failed: EmpPageObject is not defined
It might be a simple mistake, but being my first test, I'm having difficulty pinpointing the error. :)