Q:

how to call the function in the specs - Protractor

I write this script under the module:

   var enter_search = function () {

this.clickSearch = function (value) {
    element(by.id('searchbutton')).click();
};


this.waitElementFound = function (value) {
    var EC = protractor.ExpectedConditions;
    browser.wait(EC.presenceof(value), 35000);
};

};
module.exports = new enter_search();

and to call this function on my spec, i wrote this:

var search =  require('enter_search');
var loadtxt = element (by.id('text'));

it('waits for the element', function(){
  search.waitElementFound(loadtxt);
  search.clickSearch();
});

When I execute the test, it gives me an error undefined function. Not sure what went wrong. Thanks

A:

I have resolved this, i just had to declare my variables outside the var x = function.. struggles of a newbie :) thanks anyway @Girish Sotur

