jest-puppeteer
jest-puppeteer copied to clipboard
setDefaultTimeout is not respected by .not.toMatchElement()
🐛 Bug Report
expect(page).not.toMatchElement()
does not respect page.setDefaultTimeout(timeout)
, and times out after 500ms.
To Reproduce
page.setDefaultTimeout(5 * 1000)
await expect(page).not.toMatchElement('.auth-key.placeholder', { timeout: 5000 })
Expected behavior
I expect it to time out after 5000ms, but it times out after 500ms.
## System:
- OS: macOS Mojave 10.14.6
- CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
- Memory: 76.04 MB / 16.00 GB
- Shell: 5.3 - /bin/zsh
## Binaries:
- Node: 11.12.0 - /usr/local/bin/node
- Yarn: 1.12.3 - /usr/local/bin/yarn
- npm: 6.11.2 - /usr/local/bin/npm
## npmPackages:
- jest-dev-server: 4.3.0 => 4.3.0
- jest-puppeteer: 4.4.0 => 4.4.0
I'm experiencing this with .toMatch()
. API documentation says that timeout
defaults to 30000 (Jest default timeout), but actually I get tests failing with waiting for function failed: timeout 500ms exceeded
😕
await expect(page).toClick('button.js-new-template')
also times out after 500ms, despite
page.setDefaultTimeout(7 * 1000)
.
@lakesare I figured out how to set expect-puppeteer
timeout properly: I have a jest.setup.js
file, which I add on setupFilesAfterEnv
in Jest config. In this file, simply do:
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions
setDefaultOptions({ timeout: 10000 })
Using setDefaultOptions()
in my setupFilesAfterEnv
-equivalent does not help and I still get TimeoutError
for waitForFunction: (here used with toClick()
)
# TimeoutError: Element button (text: "Search") not found
#
# waiting for function failed: timeout 500ms exceeded
Setting page.setDefaultTimeout(10000);
in explicitly in my tests does not help either.
Please upgrade to v8 and reopen submit a new issue if you experience this problem.