Skip to content

[BUG] timeout not properly restored in pause() #2154

@pelme

Description

@pelme

System info

  • Playwright Version: v1.39.0
  • Operating System: All
  • Browser: All

Source code

def test_invalid_link_should_timeout(page):
    page.goto("https://playwright.dev/")

    print("before pause")
    page.pause()  # <-- causes timeouts to not work
    print("after pause")

    page.get_by_role("link", name="Invalid link - should timeout!").click()

Steps

  • Run the test with pytest -s.

Expected

The test should fail after the default timeout of 30 seconds with an output like this:

E       playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
E       =========================== logs ===========================
E       waiting for get_by_role("link", name="Invalid link - should timeout!")
E       ============================================================

.venv/lib/python3.12/site-packages/playwright/_impl/_connection.py:99: TimeoutError
=============================================== short test summary info ================================================
FAILED test_stuck_after_pause.py::test_invalid_link_should_timeout[chromium] - playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
================================================== 1 failed in 31.09s ==================================================

Actual

The test gets stuck on page.get_by_role(...) forever and never times out. Commenting out page.pause() makes the test behave as expected.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions