title: Cucumber JS timeout won't work
body: <p>Using the <code>protractor-cucumber-framework</code>, I'm trying to click a button a hundred times in one When-step. However, doing this would result in a timeout with the default 5000ms timeout value. I'd rather not change this default using:</p>
  
  <pre><code>var config = function() {
      this.setDefaultTimeout(60*1000);
  };
  
  module.exports = config;
  </code></pre>
  
  <p>This works, but I would rather set the timeout for that single step like so:</p>
  
  <pre><code>this.When(/^I click on the "([^"]*)" button$/, {timeout: 60*1000}, function(text, callback)
  {
      // Click the button 100 times
      var button = element(by.partialButtonText('Widget'));
      for(j = 0; j &lt; i; j++) {
          button.click();
      }
      callback();
  });
  </code></pre>
  
  <p>According to the <a href="https://github.com/cucumber/cucumber-js#timeouts" rel="nofollow">cucumber-js readme</a> this <em>should</em> work, but still results in: </p>
  
  <pre><code>Error: Step timed out after 5000 milliseconds
      at Timer.listOnTimeout (timer.js:92:15)
  </code></pre>
  
  <p>Any ideas on why this doesn't work?</p>
  
  <p>EDIT: It <em>did</em> work. However, I was using it in the wrong step. Calling <code>click()</code> a hundred times doesn't take so long. It times out on the step after it:</p>
  
  <pre><code>this.Then(/^a new widget is created$/, {timeout: 60 * 1000}, function(callback) {
      // Check if 100 widgets are created
  });
  </code></pre>
  
  <p>Can anyone explain now why the long timeout is necessary in the step <em>after</em> all the calls to <code>click</code>? Is there a more elegant way to have cucumber wait for the buttonclicks to finish?</p>