0

Hi I am currently working on an application that includes series of page navigation for an user to complete info. In order to navigate to a certain part of the page, I tried creating a generic step definition as a "background" step to cover all the precondition steps.

Background:
           Given I am the Page10 of the application

Given(/^I am on a specific Page$/,function(){
//Implementation of Page 1 to Page 9 
})

Every such page has its seperate step definition and page object functions .. And in this specfic page10 , I tried including all the page object functions. But unfortunately I am getting "function timed out, ensure the promise resolves within 100000 milliseconds"

Is there a way to fix this?

timeout: 300000,     // <number> timeout for step definitions

As above, I set my wdio.conf.js timeout parameter as 20000 to 300000 , but have to keep increasing it more and more as the page navigation gets wider. Also, I feel this is not a right approach. As the light weight steps would then wait for a longer period to throw error messages

Please let me know the best way to fix this?

PS: As I reckon this issue self explanatory and hence no code added. Let me know if you need more information.

Vinee
  • 402
  • 2
  • 10
  • 27

1 Answers1

1

You can specify a specific timeout for your background step:

Given('your step', { timeout: 70000 }, function () {
    // your code here
})

Please let me know if that's not the answer you were looking for.

Kignuf
  • 96
  • 7
  • This is a new approach to me. So instead of considering the default time-outs I can pass it in the step definition as well? A decent workaround to the one I have. Will try it out first and update. – Vinee Aug 31 '18 at 09:54
  • Exactly ! [Here is the official documentation for this](https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/timeouts.md) – Kignuf Aug 31 '18 at 16:33