Skip to content

[Suggestion] Add the ability to extend page timeouts #285

Open
@jacktan165

Description

@jacktan165

We should add the ability to extend page timeouts in setup-page.js.

const setupPage = async (page, timeout) => {
  const targetURL = sanitizeURL(process.env.TARGET_URL || `http://localhost:6006`);
  const viewMode = process.env.VIEW_MODE || 'story';
  const renderedEvent = viewMode === 'docs' ? 'docsRendered' : 'storyRendered';
  const referenceURL = process.env.REFERENCE_URL && sanitizeURL(process.env.REFERENCE_URL);
  const debugPrintLimit = process.env.DEBUG_PRINT_LIMIT ? Number(process.env.DEBUG_PRINT_LIMIT) : 1000;

  if ('TARGET_URL' in process.env && !process.env.TARGET_URL) {
    console.log(`Received TARGET_URL but with a falsy value: ${process.env.TARGET_URL}, will fallback to ${targetURL} instead.`);
  }

  await page.goto(`${targetURL}iframe.html`, {
    waitUntil: 'load',
    timeout <-- add timeout option here
  }).catch(err => {

There were many times my integration tests were failing due to slow startup time, but when I increased the timeout manually in node_modules, all my tests passed.
No idea why it takes quite a long time to build storybook but it is quite annoying.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions