toClick timeout option is NOT respected.
See original GitHub issueHi all,
I have just begun E2E testing with jest-puppeteer and expect-puppeteer. I write the following test:
it(`should click LET'S GO`, async () => {
await jestPuppeteer.debug();
await expect(page).toClick('button', {text: `LET'S GO`})
await jestPuppeteer.debug();
}, 90000);
As expected, jestPuppeteer pauses code execution, allowing me press enter to resume. I click enter, execution resumes momentarily prior to another debug pause. I check Chromium (headless: false in this case) to ensure the button was clicked (it was), and click enter again so tests can finish:
So I feel confident in this case that after log-in, the page exposes a button with text LET'S GO
.
I attempt using the timeout
option to wait until this button is exposed to click as specified in the API:
it(`should click LET'S GO`, async () => {
await expect(page).toClick('button', {text: `LET'S GO`, timeout: 30000})
await jestPuppeteer.debug();
}, 90000);
Here I experiment with a long timeout (the button should appear after only 3-4 seconds).
Unfortunately now the tests log-in my user and, within the default 500ms, throw an error that there is no LET'S GO
button, despite the timeout I have set:
How can I correctly use timeout? Is there a better general approach?
Thank you and I appreciate any input!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
hi @BenjaminCaffrey
The
toClick
function does not support thetimeout
option. If you want to delay 3-4 seconds, you can usepage.waitFor
Thanks!