我有几个量角器测试,有时我得到一个错误说:
Message: timeout: timed out after 10000 msec waiting for spec to complete Stacktrace: undefined
它可能会在某些测试中随机发生.
我通常在BrowserStack上测试,它在3-5版本中显示错误一次.但最近我尝试了SauceLabs几乎每一个(每个!)但并非所有的测试都失败了.可能,SauceLabs只是显着慢,所以我经常得到错误…
所以这里是问题:
> Protractor / Selenium有没有办法改变测试运行超时?它也需要在BrowserStack / Saucelabs上进行更改.
>为什么我经常收到错误?我的测试有什么问题吗?大多数似乎并不复杂或长期运行.再次,在本地机器上,它几乎总是很好.
这是一个例子:
it('should check that login gives error on empty or incorrect email',function () { p.get('/#/login'); p.findElement(protractor.By.css('button[type="submit"]')).click(); expect(p.findElement(protractor.By.css('.alert-danger')).getText()).toEqual('E-mailadres is niet geldig'); p.findElement(protractor.By.model('user.email')).sendKeys('test-1xtc.vc'); p.findElement(protractor.By.css('button[type="submit"]')).click(); expect(p.findElement(protractor.By.css('.alert-danger')).getText()).toEqual('E-mailadres is niet geldig'); p.findElement(protractor.By.model('user.email')).clear(); });
该应用正在使用
AngularJS,硒2.20,量角器0.20.1
解决方法
Is there a way in Protractor/Selenium to change test running timeout?
是:)您可以通过Protractor配置中的allScriptsTimeout(从Protractor FAQ开始)
您还可以在jasmineNodeOpts选项中设置defaultTimeoutInterval(从Protractor referenceConf.js开始)
Why am I getting the error so often? Is there anything wrong with my tests? Most of the doesn’t seem complicated or long running. Again,on local machine it’s almost always fine.
很难说没有看到你的测试.你提供的例子对我来说很好.