我正在关注这个页面上的例子cucumber-js/docs/nodejs_example.md
有时它会过去,但我也有很多超时。 该示例是否需要更新,或者这是测试运行器的问题?
NodeJS v6.9.1
"chromedriver": "^2.28.0",
"cucumber": "2.0.0-rc.9",
"selenium-webdriver": "^3.3.0"
Feature: Example feature
As a user of Cucumber.js
I want to have documentation on Cucumber
So that I can concentrate on building awesome applications
Scenario: Reading documentation
✔ Given I am on the Cucumber.js GitHub repository
✔ When I click on "CLI"
✖ Then I should see "Running specific features"
Failures:
1) Scenario: Reading documentation - features/documentation.feature:6
Step: Then I should see "Running specific features" - features/documentation.feature:9
Step Definition: features/step_definitions/browser_steps.js:15
Message:
Error: function timed out after 5000 milliseconds
at Timeout.<anonymous> (node_modules/cucumber/lib/user_code_runner.js:91:22)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
1 scenario (1 failed)
3 steps (1 failed, 2 passed)
md5-2a2c7c10e6fd71308dbd83970eac71b5
Feature: Example feature
As a user of Cucumber.js
I want to have documentation on Cucumber
So that I can concentrate on building awesome applications
Scenario: Reading documentation
✖ Given I am on the Cucumber.js GitHub repository
- When I click on "CLI"
- Then I should see "Running specific features"
Failures:
1) Scenario: Reading documentation - features/documentation.feature:6
Step: Given I am on the Cucumber.js GitHub repository - features/documentation.feature:7
Step Definition: features/step_definitions/browser_steps.js:5
Message:
Error: function timed out after 5000 milliseconds
at Timeout.<anonymous> (node_modules/cucumber/lib/user_code_runner.js:91:22)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
1 scenario (1 failed)
3 steps (1 failed, 2 skipped)
我确认这对我有用。 请尝试增加您的超时时间。
编辑:抱歉打扰你了。 在发布此消息的 5 分钟内,我找到了增加此处描述的步骤超时的解决方案。 在这里为发现此问题的任何人留下评论
@charlierudolph ,你在哪里增加超时? 这是我写给我使用auth0登录的函数
login(userId, password): void {
let self: any = this;
self.signInButton.click().then(function () {
self.password.sendKeys(password)
// element(by.css('input[name="password"]')).sendKeys(password);
browser.waitForAngularEnabled(false);
self.email.sendKeys(userId);
self.loginSubmitButton.click().then(function() {
browser.driver.wait(function() {
return self.loginConfirmationWindow.isPresent();
}, 15000).then(function() {
return;
}, function(){
console.log(new Error('Login confirmed window did not show up'));
return;
})
self.loginConfirmationClose.click();
});
})
}
我知道我给browser.driver.wait
函数设置了 15 秒的超时时间,但这没关系,该步骤超时 5 秒。
然后我尝试在 config.ts 中全局添加以下值
allScriptsTimeout: 60000,
getPageTimeout: 60000,
setDefaultTimeout: 60000,
即使在这一切之后,我仍然收到以下错误
Error: function timed out after 5000 milliseconds
at Timeout.<anonymous> (/Users/mohamedr2/workspace/test_app/node_modules/cucumber/lib/user_code_runner.js:91:22)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
由于关闭后没有任何近期活动,因此该线程已自动锁定。 请为相关错误打开一个新问题。
最有用的评论
编辑:抱歉打扰你了。 在发布此消息的 5 分钟内,我找到了增加此处描述的步骤超时的解决方案。 在这里为发现此问题的任何人留下评论
@charlierudolph ,你在哪里增加超时? 这是我写给我使用auth0登录的函数
我知道我给
browser.driver.wait
函数设置了 15 秒的超时时间,但这没关系,该步骤超时 5 秒。然后我尝试在 config.ts 中全局添加以下值
即使在这一切之后,我仍然收到以下错误