Skip to content

test: replace fixed waitForTimeout sleeps with event-driven waits - #1244

Open
kptdobe wants to merge 4 commits into
mainfrom
fastwait
Open

test: replace fixed waitForTimeout sleeps with event-driven waits#1244
kptdobe wants to merge 4 commits into
mainfrom
fastwait

Conversation

@kptdobe

@kptdobe kptdobe commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace post-edit "wait to ensure it's saved" fixed sleeps with the existing waitForSave() helper (polls the actual POST /source response instead of guessing a duration)
  • Drop sleeps that were already redundant with the following expect()'s built-in polling (e.g. a 500ms wait immediately before expect(locator).toBeVisible())
  • Leave Y.js-websocket-stabilization-before-typing and directory-listing eventual-consistency sleeps untouched — no DOM/network signal to poll on for those

Net: 63 waitForTimeout calls / 149.8s of fixed sleep -> 30 calls / 57.3s across the e2e suite.

Test plan

  • npm run lint clean (done locally)
  • Playwright CI (playwright.yml / playwright-hlx.yml) green
  • Spot-check flakiness over a few runs, especially versions/copy_rename/collab specs where several sleeps were consolidated into waitForSave()

🤖 Generated with Claude Code

Fixed sleeps guessed how long a save/UI transition would take,
adding dead time to every run regardless of actual latency. Swap
"wait then hope it saved" for the existing waitForSave() network-
response helper, and drop sleeps that were already redundant with
the following expect()'s built-in polling. 63 calls / 149.8s of
fixed sleep -> 30 calls / 57.3s across the suite; the remainder
(Y.js websocket stabilization before typing, directory-listing
eventual consistency) has no observable signal to poll on and is
left as-is.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Aug 13, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

waitForSave() watches for a client-side POST /source response, but
ProseMirror document content persists to da-admin via da-collab's
WebSocket/Yjs sync, not a direct browser request - the client never
sees that response, so every swapped call timed out after 10s. Only
sheet.spec.js's saves are genuine client-side POST /source calls
(jspreadsheet), which is why that one kept passing.

Revert the doc-save sites (edit/versions/copy_rename/preview_publish/
formatting/acl_browse) back to fixed sleeps; keep sheet.spec.js as-is.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@kptdobe

kptdobe commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Local test run surfaced 10 failures — all waitForSave() timeouts on ProseMirror doc saves (edit/versions/copy_rename/preview_publish/formatting/acl_browse). Root cause: doc content persists to da-admin via da-collab's WebSocket/Yjs sync, not a client-side POST /source — so the browser-visible response waitForSave() polls for never arrives. Only sheet.spec.js's saves are genuine client-side POST calls (jspreadsheet), which is why that one passed.

Pushed a follow-up commit reverting the doc-save sites back to fixed sleeps; kept everything else (redundant pre-assert sleep removals, auth.setup.js, delete.spec.js modal-click fix, sheet.spec.js's pre-existing waitForSave usage).

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.

3 participants