How do I include lodash in my protractor test specs?

梦想与她 提交于 2019-12-10 10:06:17

问题


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


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!