Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] setDefaultTimeout not respected as expected #27691

Closed
papaver opened this issue Oct 18, 2023 · 2 comments · Fixed by #27725
Closed

[BUG] setDefaultTimeout not respected as expected #27691

papaver opened this issue Oct 18, 2023 · 2 comments · Fixed by #27725

Comments

@papaver
Copy link

papaver commented Oct 18, 2023

System info

  • Playwright Version: 1.34.3
  • Operating System: macOS 12.6.3
  • Browser: Chromium
  • Other info: Note this behavior was noticed outside any test harness.

Source code

will wait forever and not respect actionTimeout:

context.setDefaultTimeout(2);
page.setDefaultTimeout(2);

await page.locator('.Paginations .form-select')
  .click();

will correctly quit after 2 milliseconds:

await page.locator('.Paginations .form-select')
  .click({timeout:2});

Expected

When actionTimeout is set in the page or context it should be respected.

Actual

When actionTimeout is set in the page or context it defaults to waiting forever.

@mxschmitt
Copy link
Member

I tried your code above and for me it was timing out after 2ms. Could you share maybe more of your project? Does this reproduce if you create a new project?

We also recommend to keep Playwright up to date, since you are using an old version, as per here.

@papaver
Copy link
Author

papaver commented Oct 19, 2023

appreciate your prompt response.

finally tracked it down to PWDEBUG=console being set in the environment. the docs are not clear that this also triggers debug mode where timeouts are reset to 0. i was setting this variable to be able to use the playwright object in the browser. seems weird to force this to reset all timeouts. in many cases not having elements available in the dom is ok, it makes the code cleaner than putting .count() and .all() wrappers everywhere.

the docs state:

When running in Debug Mode with PWDEBUG=console, a playwright object is available in the Developer tools console.

this seems to imply that debug mode and PWDEBUG=console are mutually exclusive.

is it possible to only have the playwright object in the browser without going into debug mode?

mxschmitt added a commit that referenced this issue Oct 20, 2023
Fixes #27691

Signed-off-by: Max Schmitt <max@schmitt.mx>
Germandrummer92 pushed a commit to OctoMind-dev/playwright that referenced this issue Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants