I want to use lodash functions in my protractor spec, I'm using _.forEach() to fill a form with values.
How do I get lodash into my protractor script so that I can use it?
I'm not asking how to use it in my app, but in the actual running protractor scripts
You can use the native Array.forEach(). If you need lodash do this:
Get the node dependency.
npm install lodash --save-dev
Then use it in your test.
var _ = require('lodash');
describe('foo', function() {
it('should do stuff', function() {
_.each();
});
})
来源:https://stackoverflow.com/questions/25467600/how-do-i-include-lodash-in-my-protractor-test-specs