expect(page).not.toMatchElement() does not respect page.setDefaultTimeout(timeout), and times out after 500ms.
page.setDefaultTimeout(5 * 1000)
await expect(page).not.toMatchElement('.auth-key.placeholder', { timeout: 5000 })
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 })
Most helpful comment
I'm experiencing this with
.toMatch(). API documentation says thattimeoutdefaults to 30000 (Jest default timeout), but actually I get tests failing withwaiting for function failed: timeout 500ms exceeded馃槙