Skip to content
This repository was archived by the owner on Jun 11, 2021. It is now read-only.
This repository was archived by the owner on Jun 11, 2021. It is now read-only.

Timeout errors #46

Closed
Closed
@thernstig

Description

@thernstig

For reference, see microsoft/playwright#2031

This piece of code will not work when running inside Jest:

const playwright = require('playwright');
try {
  await page.waitForSelector('.foo');
} catch (e) {
  if (e instanceof playwright.errors.TimeoutError) {
    // Do something if this is a timeout.
  }
  } else {
    console.log(err);
  }
}

It is possible that the TimeoutError is a different instance because Jest test cases is run inside a vm context, whereas PlaywrightRunnerE2E runs in Node.js.

This does work:

if (err.name === 'TimeoutError')

Note: Have not tested this with playwright-runner, but just assuming this is a problem here as well since it was with jest-playwright.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions