总是有一些测试用例得到 jasmine.DEFAULT_TIMEOUT_INTERVAL
Always some test cases getting jasmine.DEFAULT_TIMEOUT_INTERVAL
我将使用带有 jasmine 和 angular 的量角器创建端到端 (e2e) 测试 6. 我已经编写了一些测试用例,将近 10 个用例。这一切都很好,但总是有些情况会失败。由于茉莉花超时,它失败了。我有如下配置超时值。但我没有得到一致的结果。有时测试用例是成功的,但在下一个 运行 它会成功或失败。我在 google 上搜索过,但没有找到任何有用的解决方案。
我已经为 wait 定义了一些通用属性
waitForElement(element: ElementFinder){
browser.waitForAngularEnabled(false);
browser.wait(() => element.isPresent(), 100000, 'timeout: ');
}
waitForUrl(url: string){
browser.wait(() => protractor.ExpectedConditions.urlContains(url), 100000, 'timeout')
}
和protractor.conf.js文件我已经定义了
jasmineNodeOpts: {
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 20000,
print: function () {
}
}
我低于错误
- Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
- Failed: stale element reference: element is not attached to the page document
(Session info: chrome=76.0.3809.100)
(Driver info: chromedriver=76.0.3809.12 (220b19a666554bdcac56dff9ffd44c300842c933-refs/branch-heads/3809@{#83}),platform=Windows NT 10.0.17134 x86_64)
我找到了解决方案:
我为单个元素配置了等待超时 100000 毫秒,查找整个脚本超时为 20000 毫秒。所以我遵循以下过程:
保持完整规范超时低于所有元素查找超时的总和。我在 jasmineNodeOpts 配置了 defaultTimeoutInterval 大于所有测试用例超时值的总和。然后在export.config里面的allScriptsTimeout:2000000加一个大值。它解决了我的问题。
注意:我给出这个答案是因为我认为它可以帮助其他将面临此类问题的人。
我将使用带有 jasmine 和 angular 的量角器创建端到端 (e2e) 测试 6. 我已经编写了一些测试用例,将近 10 个用例。这一切都很好,但总是有些情况会失败。由于茉莉花超时,它失败了。我有如下配置超时值。但我没有得到一致的结果。有时测试用例是成功的,但在下一个 运行 它会成功或失败。我在 google 上搜索过,但没有找到任何有用的解决方案。
我已经为 wait 定义了一些通用属性
waitForElement(element: ElementFinder){
browser.waitForAngularEnabled(false);
browser.wait(() => element.isPresent(), 100000, 'timeout: ');
}
waitForUrl(url: string){
browser.wait(() => protractor.ExpectedConditions.urlContains(url), 100000, 'timeout')
}
和protractor.conf.js文件我已经定义了
jasmineNodeOpts: {
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 20000,
print: function () {
}
}
我低于错误
- Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
- Failed: stale element reference: element is not attached to the page document
(Session info: chrome=76.0.3809.100)
(Driver info: chromedriver=76.0.3809.12 (220b19a666554bdcac56dff9ffd44c300842c933-refs/branch-heads/3809@{#83}),platform=Windows NT 10.0.17134 x86_64)
我找到了解决方案:
我为单个元素配置了等待超时 100000 毫秒,查找整个脚本超时为 20000 毫秒。所以我遵循以下过程:
保持完整规范超时低于所有元素查找超时的总和。我在 jasmineNodeOpts 配置了 defaultTimeoutInterval 大于所有测试用例超时值的总和。然后在export.config里面的allScriptsTimeout:2000000加一个大值。它解决了我的问题。
注意:我给出这个答案是因为我认为它可以帮助其他将面临此类问题的人。