Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeJS example timing out #804

Closed
edwinwright opened this issue Mar 30, 2017 · 3 comments
Closed

NodeJS example timing out #804

edwinwright opened this issue Mar 30, 2017 · 3 comments

Comments

@edwinwright
Copy link

I'm following the example on this page cucumber-js/docs/nodejs_example.md

Sometimes it passes, but I get a lot of timeouts too. Does the example need updating, or is this a problem with the test runner?

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)
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)
@charlierudolph
Copy link
Member

I confirmed this was working for me. Please try upping your timeout.

@raseel-mohamed
Copy link

raseel-mohamed commented Jun 8, 2017

Edit: Sorry to have bothered you. In 5 minutes of posting this message I found a solution to increase the step timeout described here. Leaving the comment here for anybody who finds this issue
@charlierudolph, where do you increase the timeout? This is the function that I wrote for me to login using 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();
            });

        })
    }

I know that I gave the browser.driver.wait function a timeout of 15 seconds, but that doesn't matter, the step times out with 5 secs.
I then tried to add the following values globally in the config.ts

    allScriptsTimeout: 60000,
    getPageTimeout: 60000,
    setDefaultTimeout: 60000,

Even after all this I still get the following error

 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)

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants