Skip to content

Need to wait a second before the first page.goto with Puppeteer 23.4 #596

Description

@jamesgpearce

🐛 Bug Report

Filing here for visibility, though it seems to be wholly caused by upgrading Puppeteer 23.4. (I wonder if it's to do with how jest-puppeteer initializes the browser?)

To Reproduce

  • Ensure Puppeteer 23.4
  • Run a test suite containing multiple await page.goto('...');
  • The first one or two will fail: net::ERR_CONNECTION_REFUSED at ...
  • Subsequent tests will pass

The failures can be fixed by sleeping for a second before the first page.goto, as though somehow the browser isn't ready, or isn't immediately connected to the network properly.

https://github.com/tinyplex/tinybase/blob/248bb46c69e7963bede5e9c2d25768335f9d093b/test/e2e/common.ts#L40-L47

Expected behavior

  • With Puppeteer 23.3 they all pass.

npx envinfo

## System:
 - OS: macOS 14.5
 - CPU: (8) arm64 Apple M2
 - Memory: 826.06 MB / 16.00 GB
 - Shell: 5.9 - /bin/zsh
## Binaries:
 - Node: 22.8.0 - /opt/homebrew/bin/node
 - npm: 10.8.2 - /opt/homebrew/bin/npm
 - pnpm: 9.1.4 - /opt/homebrew/bin/pnpm
 - bun: 1.1.3 - ~/.bun/bin/bun
 - Watchman: 2024.09.09.00 - /opt/homebrew/bin/watchman
## npmPackages:
 - jest-puppeteer: ^10.1.1 => 10.1.1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions