andresdominguez / elementor

An improved element finder for protractor
MIT License
339 stars 27 forks source link

Possibility to use helpers and pageObjects in elementor #21

Open jusefb opened 9 years ago

jusefb commented 9 years ago

Currently I could not find how to load helper js files like you would do in protractor tests. Is there something I am missing.

andresdominguez commented 9 years ago

You need to use the chrome popup or one of the plugins (webstrom, sublime, emacs).

Load the helper node modules into the current sessions.

Imagine that you have a helper (yo.js) like this:

module.exports = {
  hello: function() {
    return 'hello ptor';
  }
}

Open the popup and enter the following command. Make sure that you use the full path:

 var yo = require('/usr/local/andres/dev/tmp/yo.js')

Then you can use the module:

yo.hello()
'hello ptor'
andresdominguez commented 9 years ago

By the way. Jasmine is not loaded into the sessions. Therefore, you cannot call expect()