Skip to content

Retry page loads and API calls that time out on the slow demo site - #9

Merged
niranjankagri merged 3 commits into
mainfrom
fix/retry-slow-demo-site
Nov 20, 2026
Merged

niranjankagri merged 3 commits into
mainfrom
fix/retry-slow-demo-site

Conversation

@niranjankagri

Copy link
Copy Markdown
Owner

Why

The nightly run failed three times in a row (Nov 18–19), every time because practice.expandtesting.com was slow, not because a test found a bug:

  • 34× Page.goto: Timeout 15000ms exceeded
  • 7× ReadTimeout on the API, mostly register while a fixture was setting up a test user

What changes

  • framework/retry.py: with_retries() retries only timeouts and lost connections, waiting 2 s, then 4 s. A wrong answer (a 400, a wrong body, a missing element) still fails at once, and every retry is logged in the report.
  • Page loads (framework/pages/navigation.py): open_page() gives navigation its own 30 s timeout. It retries the load together with the page's own "ready" wait, so a page that arrived but never finished loading its list gets reloaded too. Reloading never changes app data.
  • API client: only calls that are safe to repeat are retried: GET, PUT, PATCH, DELETE and login. Other POSTs are sent once (a repeated create_note would make two notes). logout is sent once too, because a repeated logout gets 401.
  • Fixtures: a timed-out registration starts over with a new user, never the same email (that would get 409). The account and second_account fixtures now share this one helper.
  • New settings: NOTES_UI_NAVIGATION_TIMEOUT_MS (30000) and NOTES_ATTEMPTS (3; 1 turns retrying off), documented in the README.

Verified

  • ruff check and ruff format --check pass.
  • A local server that never answers confirmed the retry rules: GET and login are tried 3 times; create_note and logout once; any other error is raised at once.
  • Against the live site: 32/32 API tests pass. In one parallel UI run (-n 3), 3 tests failed on a 5 s expect while the site was slow; all 3 pass when run again. Retrying checks that failed is deliberately left out, because it would hide real bugs.

🤖 Generated with Claude Code

practice.expandtesting.com sometimes takes longer than the timeout to answer, which failed
whole batches of UI and hybrid tests at setup (page.goto and register timeouts).

- framework/retry.py: with_retries, retries only timeouts / lost connections, with backoff
- page loads get their own 30 s timeout and are retried (framework/pages/navigation.py)
- the API client repeats only calls that are safe to repeat: GET, PUT, PATCH, DELETE, login
- fixtures retry a timed-out registration with a new user, never the same email
- NOTES_UI_NAVIGATION_TIMEOUT_MS and NOTES_ATTEMPTS settings, documented in the README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
niranjankagri and others added 2 commits November 19, 2026 20:53
The UI jobs timed out even with retries while API (-n 4) and three browser jobs (-n 3 each)
hit the shared demo site together: 13 sessions. API_WORKERS and UI_WORKERS (2 each) and
max-parallel: 1 on the browser matrix keep it to 4, documented in the README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With retries and lower CI load, the remaining UI failures were steps inside tests: a saved note's
card or the progress text taking over 15 s (wait_for) or 5 s (expect) on the slow demo site.
Those steps are not retried (that could hide bugs or duplicate a note); they get a longer wait
instead: NOTES_UI_SERVER_TIMEOUT_MS (30000) for the NotesPage waits on the server and as the
default of expect(). A wrong result still fails, only later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@niranjankagri
niranjankagri merged commit a042b16 into main Nov 20, 2026
14 of 18 checks passed
@niranjankagri
niranjankagri deleted the fix/retry-slow-demo-site branch November 20, 2026 00:43
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