Skip to content

fix: reduce Playwright test flakiness with condition-based waits#2842

Merged
crivetimihai merged 1 commit intomainfrom
playwright-fixes
Feb 11, 2026
Merged

fix: reduce Playwright test flakiness with condition-based waits#2842
crivetimihai merged 1 commit intomainfrom
playwright-fixes

Conversation

@crivetimihai
Copy link
Copy Markdown
Member

Summary

  • Replace 20+ arbitrary wait_for_timeout calls with proper Playwright condition-based waits (wait_for_visible, wait_for_selector, expect, wait_for_load_state, wait_for_count_change)
  • Fix broken _wait_for_login_response in conftest.py — page.wait_for_response() doesn't exist in Playwright Python sync API; replaced with page.expect_response() context manager wrapping login submission
  • Narrow except Exception to except PlaywrightTimeoutError in 4 locations to surface real errors instead of silently swallowing them
  • Remove stale @pytest.mark.xfail from test_create_and_revoke_token (test passes reliably)
  • Replace time.sleep() with page.wait_for_timeout() in admin_utils.py
  • Add wait_for_count_change() helper to BasePage for search/filter result waiting

Test plan

  • Full Playwright test suite: 191 passed, 22 skipped, 0 failed (was 190 passed + 1 xpassed)

Replace arbitrary wait_for_timeout calls with proper Playwright
condition-based waits (wait_for_visible, wait_for_selector, expect,
wait_for_load_state, wait_for_count_change). Fix broken login response
handling that used non-existent wait_for_response API (was silently
swallowed by broad except Exception). Narrow exception handling from
Exception to PlaywrightTimeoutError to surface real errors.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai crivetimihai merged commit a79c7cc into main Feb 11, 2026
37 checks passed
@crivetimihai crivetimihai deleted the playwright-fixes branch February 11, 2026 13:08
ja8zyjits pushed a commit that referenced this pull request Feb 13, 2026
Replace arbitrary wait_for_timeout calls with proper Playwright
condition-based waits (wait_for_visible, wait_for_selector, expect,
wait_for_load_state, wait_for_count_change). Fix broken login response
handling that used non-existent wait_for_response API (was silently
swallowed by broad except Exception). Narrow exception handling from
Exception to PlaywrightTimeoutError to surface real errors.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
vishu-bh pushed a commit that referenced this pull request Feb 18, 2026
Replace arbitrary wait_for_timeout calls with proper Playwright
condition-based waits (wait_for_visible, wait_for_selector, expect,
wait_for_load_state, wait_for_count_change). Fix broken login response
handling that used non-existent wait_for_response API (was silently
swallowed by broad except Exception). Narrow exception handling from
Exception to PlaywrightTimeoutError to surface real errors.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Vishu Bhatnagar <vishu.bhatnagar@ibm.com>
kcostell06 pushed a commit to kcostell06/mcp-context-forge that referenced this pull request Feb 24, 2026
…#2842)

Replace arbitrary wait_for_timeout calls with proper Playwright
condition-based waits (wait_for_visible, wait_for_selector, expect,
wait_for_load_state, wait_for_count_change). Fix broken login response
handling that used non-existent wait_for_response API (was silently
swallowed by broad except Exception). Narrow exception handling from
Exception to PlaywrightTimeoutError to surface real errors.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
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 this pull request may close these issues.

1 participant