question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

toClick timeout option is NOT respected.

See original GitHub issue

Hi 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:

image

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:

image

How can I correctly use timeout? Is there a better general approach?

Thank you and I appreciate any input!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
xiaoyuhencommented, Feb 19, 2019

hi @BenjaminCaffrey

The toClick function does not support the timeout option. If you want to delay 3-4 seconds, you can use page.waitFor

 it(`should click LET'S GO`, async () => {
    await page.waitFor(3000)
    await expect(page).toClick('button', {text: `LET'S GO`})
    await jestPuppeteer.debug();
  }, 90000);
0reactions
gregbergecommented, Feb 19, 2019

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dispatching click event on anchor in timeout stops following ...
If you change that 1001 to 1000 , the dispatch will work as expected - the link will be followed. The event handler...
Read more >
CSCvg69068 - ASDM: Session does not timeout ... - Cisco Bug
Symptom: In ASDM version 7.6.1, 7.6.2.150 and 7.8.2.151 sessions are not timing out when the idle-timeout configured expires.
Read more >
Session timeout warning — oracle-tech
When the session timesout, or about to timeout, the client is presented with a POP-UP that asks to click OK to extend the...
Read more >
Boot Timeout Setting in Intel® Server Board BIOS
An alternative option is to click the Pause/Break button on the keyboard during POST. Hit Enter to continue with the process.
Read more >
How to run vi continuously when VISA read timeout happens
If possible, just attach your VI so that we can see what went wrong. I'm sure that your VI will not stop at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found