![](/img/trans.png)
[英]Protractor unable to find config file: Error: Cannot find module '/protractor/protractor.conf_sanity.js'
[英]Error: Cannot find module 'jasmine-expect' [Protractor]
我试图运行一个简单地连接到我的应用程序的量角器测试。
当我运行(git bash/终端)时:
protractor conf.js
我收到以下错误:“
错误:找不到模块“jasmine-expect”
看到这个后,我继续安装模块:
npm install -g jasmine-expect
但我仍然收到同样的失败。
这是我的测试:
describe('DragAndDrop Test', function () {
require('protractor');
require('jasmine-expect');
beforeAll(function () {
context = new Context();
context.get();
browser.waitForAngular();
browser.driver.manage().window().maximize();
});
it('should drag and drop Application Experience tile', function () {
//target is where we are dragging the box to. Box is the Box
var target = { x: 300, y: 50 };
var box = element(by.cssContainingText('h3', 'Application Experience'));
//scope is going to hold the scope variables that tell us where the box is located
//get the standardItems Scope
box.evaluate('dashboards').then(function(scope) {
//make sure the box we are using is initially set in column 0 and Row 0
expect(scope['1'].widgets[0].col).toEqual(0);
expect(scope['1'].widgets[0].row).toEqual(0);
});
//drag and drop the box somewhere else.
browser.actions().dragAndDrop(box, target).perform();
browser.waitForAngular();
browser.driver.sleep(5000);
//get the updated scope
box.evaluate('dashboards').then(function(scope) {
//test to see that the box was actually moved to column 1 and row 0
expect(scope['1'].widgets[0].col).toEqual(1);
expect(scope['1'].widgets[0].row).toEqual(0);
});
});
});
var Context = function () {
this.ignoreSynchronization = true;
//load the website
this.get = function () {
browser.get('http://127.0.0.1:62734/index.html#/dashboard');
};
};
这是我的 conf.js:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['gridster-Test.js'],
capabilities: {
browserName: 'firefox'
}
};
有什么建议?
首先,尝试在不使用-g
标志的情况下安装软件包:
npm install jasmine-expect
另外,移动require('jasmine-expect');
从describe
进入量角器配置文件中的onPrepare()
:
onPrepare: function () {
require("jasmine-expect");
},
确保将依赖项添加到您的 package.json 文件中。
npm install jasmine-expect --save-dev
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.