我在非角度网站上使用Protractor。我的测试在application.FindFreeCancellationRate()中的所有异步代码完成之前完成
正如你所看到的 - 11.461中的“已完成”,但是在测试完成后,一些语句仍然在控制台中打印。
$Users = Import-Csv Test.csv
foreach ($User in $Users)
{
Get-ADUser $User.Employees | Set-ADUser -Initials $User.abbreviation
}
application.FindFreeCancellationRate代码:
it('should find a Free Cancelation rate', application.FindFreeCancellationRate, 20000000000);
it('should finish the test', function () {
console.log("THE END");
});
和其他2个功能:
async(function () {
console.log("starting the async test ");
var hrefs = await(app.GetAllResults());
console.log("OpenResults is starting start");
for (var i = 0; i < hrefs.length; i++) {
(function (_i) {
console.log("result " + i + " of " + hrefs.length);
var resultFound = await(app.checkHotelResults(hrefs[i]));
console.log("openResults - result found");
console.log(resultFound);
if (resultFound) {
console.log("result found = true");
return resultFound;
}
else {
console.log("continue");
}
})(i)
}
console.log("OpenResults finished");
console.log("finishing the async test ");
return;
});
为什么在执行所有代码之前退出? 我在哪里弄错了?