运行特定功能块时,我收到异步回调错误。如果我注释掉该调用函数,它将运行良好。无法确定可能是什么问题。我尝试在网上查找,但无法解决我的问题 在Conf.js文件中
exports.config = {
SELENIUM_PROMISE_MANAGER: false,
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 90000,
stopSpecOnExpectationFailure: true,
print: function () { }
},
}
在相同的spec.js中
var CreateNodes = require('../datafiles/CreateNodes.js'); //in this file I have three sets of data
arrayofCreateNodeData = function () {
return CreateNodes
}
it(', Navigate to deliverables', function (doneDS) {
designIcon.click().then(function () {
const nodePromiseArray = [];
for (i = 0; i < CreateNodes.length; i++) {
const nodeData = CreateNodes[i];
const result = await addNewNode(nodeData, doneDS);
nodePromiseArray.push(result);
doneDS();
};
});
这是上面的代码将调用的功能
function addNewNode(nodeData, doneAddNode) {
return new Promise(function (resolve, reject) {
vectorpo.addActionBtn.click().then(async () => {
//Select the node type
var plot = element(by.css("vector-deliverable-free-form"));
vectorpo.nodeTypeMenu.element(by.css("li button")).element(by.cssContainingText('div', 'Node')).click();
vectorpo.nodeTypeMenu.element(by.cssContainingText('div', nodeData.nodeType)).click()
browser.wait(EC.visibilityOf(element(by.css("svg.node-placer"))), 5000);
browser.actions().mouseMove(plot, { x: 490, y: 100 }).click().perform();
await element(by.css("div .yfiles-labeleditbox")).sendKeys(nodeData.nodeDescript, protractor.Key.ENTER);
browser.refresh();
await browser.wait(EC.visibilityOf(vectorpo.yfilesCanvasMain), 15000);
resolve();
doneAddNode();
}).catch(e => {
console.error(e);
})
})
}
在创建了三个新节点之后,出现以下错误。不知道我在这里做什么错。
Failures:
1) , Navigate to deliverables
Message:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Stack:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)
Executed 2 of 2 specs (1 FAILED) in 1 min 16 secs.
[22:38:10] I/local - Shutting down selenium standalone server.
[22:38:10] I/launcher - 0 instance(s) of WebDriver still running
[22:38:10] I/launcher - chrome #01 failed 1 test(s)
[22:38:10] I/launcher - overall: 1 failed spec(s)
[22:38:10] E/launcher - Process exited with error code 1
An unexpected error occured: undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! angular-ui@0.0.0 e2e: `ng e2e --dev-server-target=`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-ui@0.0.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: