[SOLVED] Protractor example include external js class definition

So you have an external PageObject class you would like to include:
This is your PageObject placed in the AngularHomepage.js file

exports.AngularHomepage = function() {
this.nameInput = element(by.model('yourName'));
this.greeting = element(by.binding('yourName'));</code>

this.get = function() {

this.setName = function(name) {

The main script is (specs.js):

var homepage = require('./AngularHomepage.js');
describe('angularjs homepage', function() {
it('should greet the named user', function() {
var angularHomepage = new homepage.AngularHomepage();


expect(angularHomepage.greeting.getText()).toEqual('Hello Julie!');

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s