I'm starting to figure this out a little better. But I still have a question. Suppose I've got function class that looks like the following:
module.exports = myFunc;
var containerValue = element(by.css('div#container'));
function myFunc() {}
myFunc.prototype = {
section1: {
__myBlock: containerValue.$('div#myBlock'),
myRow: {
label: function() {
return __myBlock.$('label');
}
input: function() {
return __myBlock.$('input');
}
}
}
}
First, let me point out that the above will fail. I've banged my head against that wall and finally realized that. The reason is that __myBlock is not within the scope of myRow's block of code. I fixed this by doing the following:
return myFunc.prototype.section1.__myBlock.$('label');
However, one of the methods I tried (and failed) was to pull the __myBlock into the myRow scope by doing the following:
myRow: {
__myBlock: myFunc.prototype.section1.__myBlock,
label: {
return this.__myBlock.$('label');
}
// ...
}
My question is, is my working "fix" the best way to do this? Is there a better way to accomplish what I'm trying to do?