cli*_*oid 4 angularjs protractor
我正在使用带有angularjs的量角器来创建我的e2e测试.我有很多文件,我的specs数组很大,我想在所有文件中共享一个共同的功能.有没有办法创建一个全局的beforeEach,我可以注入我的函数?exports.config对象是否暴露了某些内容,以便我可以在所有文件中使用公共变量?目前我正在躲避"浏览器"变量,但这可能是危险的.任何帮助深表感谢.谢谢
JB *_*zet 12
是的,您可以使用量角器配置中的onPrepare()钩子轻松完成此操作:
exports.config = {
// ...
// A callback function called once protractor is ready and available, and
// before the specs are executed
// You can specify a file containing code to run by setting onPrepare to
// the filename string.
onPrepare: function() {
// you can also add properties to globals here
}
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9772 次 |
| 最近记录: |