Loading challenge...
A like button updates instantly then reverts on a server 500 — test the rollback branch, not just the click
The like button updates instantly, then reconciles with the server — and rolls back if the server rejects the change
Clicking the heart flips the liked state and adjusts the count before the network request resolves. When POST /api/lab/like succeeds the UI keeps the optimistic value; when it fails the component reverts both the liked flag and the count, then shows an error.
Tick Force failure to make the request hit ?fail=1, which always responds 500 — the rollback branch only runs in that case.
Toggle failure mode, click like, and watch whether the count sticks or reverts
Automation hints
#like-button, assert count went up) NEVER exercises the rollback branch — the happy path always passes and hides the bug#force-fail first, then click #like-button; assert #like-count REVERTS to its original value and #like-errorappears with text containing "reverted"#like-button[data-liked] ("true"/"false") rather than the visible glyph — attributes are locale-proofroute.fulfill to inject the 500 for /api/lab/like instead of relying on the checkbox — that isolates the client rollback logic from the server