Repository navigation
test(e2e): port upstream ban-demo-download + punishment-comment-actions coverage - #42
Merged
Merged
Conversation
…ions coverage Closes the E2E test-coverage gap found while comparing this fork's comment/demo work (feat/mods-list-compact-actions and friends) against upstream sbpp/sourcebans-pp's sbpp#1568 ("restore punishment comment and demo actions"): upstream shipped two E2E specs this fork never grew, `ban-demo-download.spec.ts` and `punishment-comment-actions.spec.ts`. ban-demo-download.spec.ts is close to a straight port — the banlist row / drawer markup (`row-action-demo-download[-mobile]`, `drawer-demo-download`, `getdemo.php?type=B&id=<bid>`) is byte-for-byte identical between the two trees. The one adaptation: seed the demo through a new `seed-ban-demo-e2e.php` shim (`seedBanDemoE2e` in fixtures/db.ts) instead of writing straight into `../../demos` from Node the way upstream's version does — this suite runs both host-side (via `docker compose exec`) and in-container (`E2E_IN_CONTAINER=1`), and only the PHP side reliably resolves `SB_DEMOS` the same way `getdemo.php` does in both modes; a Node-side relative path guess would silently diverge under host-side execution. Cleanup still goes through `Actions.BansRemoveDemo` exactly like upstream, which unlinks the file and drops the `:prefix_demos` row in one step. punishment-comment-actions.spec.ts required a full rewrite rather than a port. Upstream drives a dedicated `#banlist-comment-form` PAGE (`row-action-comment-add` navigates to a standalone editor built from their extracted `punishment-comment-editor.tpl` partial). This fork's comment add/edit has always been entirely drawer-driven — per page_bans.tpl's own docblock, "there is no `?comment=` editor on this page" — so the ported spec instead drives the actual flow: the row's `[data-testid="ban-comment-add"]` / `[data-testid="comm-comment-add"]` button opens the player drawer with the comment composer (`[data-testid="drawer-comment-form"]`) pre-opened in one step, submit posts `bans.add_comment` and reloads the drawer, which patches the row's inline disclosure in place. Every selector in the rewrite was verified directly against theme.js / page_bans.tpl / page_comms.tpl (not guessed) — this is the same underlying sbpp#1544 contract upstream's spec locks in (Add comment reachable from the row; every existing comment exposes author/owner-gated Edit + Delete in both the inline disclosure and the drawer), just exercised through this fork's actual UI. Both specs run green against the local dev stack (3/3 passed) before committing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
3 tasks
maxijabase
approved these changes
Sep 23, 2026
The predicate matched any 200 POST to api.php, so an unrelated lazy call (e.g. a drawer pane loader) resolving first would be asserted instead of the comment add.
If the finally-block cleanup never runs (page died before the panel JS loaded), a non-hex name was never swept by ./sbpp.sh db-reset, which only deletes MD5-named files from web/demos/. Use the same shape as UploadHandler's renameToHash output.
The finally block called bans.remove_demo, which always failed with "Unable to delete demo file from disk.": the shim writes the file as the CLI user, and www-data can't unlink from a bind-mounted web/demos/ owned by the host user. The error was swallowed, so every run leaked the file and the :prefix_demos row. Add a remove mode to seed-ban-demo-e2e.php and a removeBanDemoE2e() helper, and use it for cleanup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes an E2E coverage gap surfaced while auditing this fork against upstream
sbpp/sourcebans-pp's sbpp#1568 ("restore punishment comment and demo actions"): upstream shipped two E2E specs —ban-demo-download.spec.tsandpunishment-comment-actions.spec.ts— that this fork never grew, even though the underlying features (sbpp#1544, sbpp#1554) are already implemented and merged here (fix/issue-1544,fix/issue-1554,fix/upstream-1568-demo-comment-gates).ban-demo-download.spec.ts— near-straight portThe banlist row / drawer markup is byte-for-byte identical between the two trees (
row-action-demo-download[-mobile],drawer-demo-download,getdemo.php?type=B&id=<bid>). The one adaptation: seed the demo through a newseed-ban-demo-e2e.phpshim (seedBanDemoE2einfixtures/db.ts) instead of writing straight into../../demosfrom Node the way upstream's version does. This suite runs both host-side (docker compose exec) and in-container (E2E_IN_CONTAINER=1); only the PHP side reliably resolvesSB_DEMOSthe same waygetdemo.phpdoes in both modes — a Node-side relative path guess would silently diverge under host-side execution. Cleanup still goes throughActions.BansRemoveDemo, same as upstream, which unlinks the file and drops the:prefix_demosrow in one step.punishment-comment-actions.spec.ts— full rewriteUpstream drives a dedicated
#banlist-comment-formpage (row-action-comment-addnavigates to a standalone editor built from their extractedpunishment-comment-editor.tplpartial). This fork's comment add/edit has always been entirely drawer-driven — perpage_bans.tpl's own docblock: "Add / Edit comments open the player drawer (data-comment-compose); there is no?comment=editor on this page."The rewritten spec drives the actual flow instead: the row's
[data-testid="ban-comment-add"]/[data-testid="comm-comment-add"]button opens the player drawer with the comment composer ([data-testid="drawer-comment-form"]) pre-opened in one step (loadDrawer(key, {mode: 'add'})→openCommentComposer()), submit postsbans.add_commentand reloads the drawer, which patches the row's inline disclosure in place. Every selector was verified directly againsttheme.js/page_bans.tpl/page_comms.tplsource (not guessed) — same underlying sbpp#1544 contract as upstream (Add comment reachable from the row; every existing comment exposes author/owner-gated Edit + Delete in both the inline disclosure and the drawer), exercised through this fork's actual UI.Verification
Both specs run green against the local dev stack before committing:
```
Running 3 tests using 1 worker
✓ ban-demo-download.spec.ts › row and drawer expose the attached demo download (2.3s)
✓ punishment-comment-actions.spec.ts › ban Add comment flow restores per-comment Edit and Delete (2.7s)
✓ punishment-comment-actions.spec.ts › comm-block Add comment uses the shared drawer composer and action set (2.8s)
3 passed (17.7s)
```
node --experimental-strip-types --checkon all new/changed.tsfiles: clean.php -lon the new shim: clean.web/demos/after the run (verified manually).Test plan
e2e.ymlgate green../sbpp.sh e2e specs/flows/ban-demo-download.spec.ts specs/flows/punishment-comment-actions.spec.tslocally reproduces the 3/3 pass.🤖 Generated with Claude Code