argos-ci / jest-puppeteer

Run tests using Jest & Puppeteer 🎪✨
MIT License
3.54k stars 289 forks source link

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

Open jamesgpearce opened 1 month ago

jamesgpearce commented 1 month ago

🐛 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

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

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 
gregberge commented 1 month ago

Hello @jamesgpearce, maybe you should fill an issue in Puppeteer. Because browser should be ready, I mean there is no reason to warm it up on our side.