pet*_*ppe 2 javascript selenium node.js webstorm
我在selenium测试中有以下功能,并且setTimeout功能总是比它应该快25%.在这种情况下,要等待20秒,并在15秒后完成功能.
test.describe('basic login test',function(){
this.timeout(timeout);
// variables
test.before(...);
test.it.only('Test', function(done){
testLoginPage.load().then(...)
.then(...).then(...)
.then(...).then(...)
.then(function(){
var first = "1st: " + new Date().getTime();
console.log(first);
setTimeout(function(){
driver.getTitle().then(function(title){
assert.equal(title, 'Tittle', 'Error.');
});
console.log(first);
console.log("2nd: " + new Date().getTime());
done();
}, 20000);
}).then(...)
});
test.after();
});
Run Code Online (Sandbox Code Playgroud)
输出:
1st: 1457706590459
1st: 1457706590459
2nd: 1457706605462
Run Code Online (Sandbox Code Playgroud)
您正在使用的代码或库具有重写的自定义setTimeout函数,并且它setTimeout使用较小的毫秒调用实际函数.
您正在使用JavaScript运行时(非常旧),具有非常非常严重的问题.
其他一些function是在它们之间打印(虽然看起来不像你的代码)
| 归档时间: |
|
| 查看次数: |
178 次 |
| 最近记录: |