The following code works perfectly... but it would seem using __proto__
is considered controversial. Is this true in the confines of Protractor/Nodejs? And if so, how else could I accomplish the same thing?
Given a basePage:
var BasePage = function() {
this.to = function() {
browser.get(this.url);
};
};
module.exports = new BasePage;
And a page that would extend BasePage:
var basePage = require('../pages/basePage.js');
var MyPage = function() {
this.__proto__ = basePage; // extend basePage...
this.url = 'http://myPage.com';
};
module.exports = new MyPage;
When a test calls:
var myPage = require('../pages/myPage.js');
it('should go to page', function() {
myPage.to();
};
Then win?