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

Global: define default timeouts #78

Closed
Niceplace opened this issue Jun 13, 2018 · 2 comments
Closed

Global: define default timeouts #78

Niceplace opened this issue Jun 13, 2018 · 2 comments

Comments

@Niceplace
Copy link

Niceplace commented Jun 13, 2018

I see in the documentation in expect-puppeteer :

timeout maximum time to wait for in milliseconds. Defaults to 500.

However, I'd like to be able to set the default value globally, do you think this could be possible ?
I haven't found an official way to set it even in puppeteer :(

Puppeteer has a partial solution with page.setDefaultNavigationTimeout() but it only has effect on a subset of the functions exposed by puppeteer: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetdefaultnavigationtimeouttimeout

It would be amazing if we could have control over a global timeout variable for

  • expect-puppeteer
  • puppeteer

An example to illustrate my point:

describe('A test with login in page objects', () => {

  beforeAll(async () => {
     // Have function attached to page reference ?
      await page.setGlobalTimeout(30000); 
  });

  it('should display "Google" text on page', async () => {
      await page.goto('https://google.com'); // Would use 30 seconds timeout instead of puppeteer default
      await expect(page).toMatch('Google'); // Would use 30 seconds timeout instead of 500ms
  });
});
@Niceplace
Copy link
Author

Update : Ooops, I see that this is supported in expect-puppeteer https://github.com/smooth-code/jest-puppeteer/blob/master/packages/expect-puppeteer/README.md#configure-default-options.

However, I still would like to know if this propagates to native puppeteer functions as well or if its just used for the functions exposed by expect-puppeteer.

@gregberge
Copy link
Member

It is only used in expect-puppeteer methods. I don't know if Puppeteer provides the same system or not, if not I suggest you to post an issue on Puppeteer project. On our side we already have it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants