File structure

01.spec.js - - - I call assistants from the protractor specification, which is good
describe('should click on element', function () { var helper1 = require('../../modules/helpers/helper1.js'); it('should click and assert...', function() { helper1.clickOnCircle('Accounts'); }); });
... but use any helper functions from another helper file ...
helpers1.js - - - I have to require an assistant in every function
module.exports = { clickOnCircle: clickOnCircle, clickOnBox : clickOnBox }; var helper2 = require('./helper2.js'); //node require doesn't hit something like this function clickOnCircle(circleText) { var helper2 = require('./helper2.js'); //needed in every function helper2.doSomething(circleText); } function clickOnBox(boxText) { var helper2 = require('./helper2.js'); //needed in every function helper2.doSomething(boxText); }
Itβs as if I want the supporting files to be available worldwide. I was messing around using configuration options, but I still ended up requiring an assistant from each function
luker02 Jul 24 '15 at 13:50 2015-07-24 13:50
source share