## Implementation Plan ### 1. Fix `data-stop-propagation` inconsistency on gist list cards **File:** `templates/gists.html` (line ~62) **Change:** Replace `{% set _stop = True %}` with `{% set _stop = False %}`. This aligns gist list card voting with all other vote contexts (project cards, post detail, gist detail) which use AJAX via `VoteManager`. Without this fix, clicks on gist list cards are intercepted by `DomUtils.initStopPropagation()` and result in a full-page form submission, which the user perceives as unresponsive. **Rationale:** The investigation identifies this as the single concrete, reproducible cause of non-AJAX voting on the gist list page. Changing this one value eliminates the inconsistency. --- ### 2. Add Playwright e2e test for vote button on post detail page **File:** `tests/e2e/test_vote.py` (create new) **Content outline:** ```python import pytest from django.urls import reverse pytestmark = pytest.mark.skipif( not hasattr(pytest, "playwright"), reason="Playwright not available" ) def test_post_vote_flow(live_server, page, user, post): """Click upvote on a post detail page and verify optimistic UI update.""" page.goto(live_server.url + reverse("post_detail", args=[post.id])) vote_button = page.locator(".vote-up") initial_count = vote_button.locator("..").text_content() vote_button.click() # Wait for the optimistic update (class change and counter increment) page.locator(".vote-up.voted").wait_for(timeout=3000) new_count = vote_button.locator("..").text_content() assert int(new_count) == int(initial_count) + 1 ``` Assumptions for fixtures: The project’s test suite already provides `live_server`, `page`, `user`, `post` fixtures (common in `pytest-playwright` + Django setups). If not, adjust to inline setup using `db` and `django_user`. The test uses `pytest.mark.skipif` to silently skip in environments without Playwright, so it never breaks the unit test suite. **Rationale:** Addresses the #1 recommendation from the investigation – closes the e2e test gap that could have caught this bug earlier. --- ### 3. Run validation Execute the project’s verification commands: ```bash pip install -e '.[dev]' -q python -m pytest tests/unit tests/api # or the full suite ``` Also verify no new lint violations: ```bash ruff check . ruff format --check . ``` --- ## Definition of Done - [ ] `templates/gists.html` has `_stop` set to `False` (or the assignment removed, defaulting to `False`). - [ ] A new test file `tests/e2e/test_vote.py` exists with a Playwright test that clicks the upvote button on a post detail page and asserts that the `.voted` class is applied and the counter increments. - [ ] The project’s test command `pip install -e '.[dev]' -q && python -m pytest` passes with zero failures (the Playwright test is skipped if Playwright or browser is unavailable). - [ ] No new lint violations are introduced (verified by running `ruff check` and `ruff format --check` on the changed files).