Skip to content

test(e2e): cover drafts, candidate profiles, and the avatar gate - #110

Open
douglance wants to merge 1 commit into
siwe/candidatesfrom
siwe/remaining-specs
Open

test(e2e): cover drafts, candidate profiles, and the avatar gate#110
douglance wants to merge 1 commit into
siwe/candidatesfrom
siwe/remaining-specs

Conversation

@douglance

Copy link
Copy Markdown
Contributor

Adds the remaining SIWE e2e coverage. Every new spec replays a saved session via signedInPage(), so the suite still spends exactly five nonces per run regardless of how many tests it grows.

Running these found four real defects, all fixed here

1. POST /api/drafts/shared/:slug/submitted is behind requireSession. The UI offered the form to anonymous readers and the code comments claimed the route was unauthenticated. It requires a session but not authorship, so the form is now gated on being signed in and says so — the second wallet, which did not write the draft, records the submission in the spec.

2. Editing, publishing and deleting all require status draft (409 not_editable otherwise), because a share link has to keep resolving to what reviewers were shown. DraftList offered Delete on published and submitted drafts, where it could only ever 409. A submitted draft now offers none of the three, and the spec asserts that.

3. /elections was unreachable. next.config.mjs permanently redirects it to /security-council for old bookmarks, so the new page returned 308 and never rendered. Moved to /profile/candidate, beside the other owned surfaces. Adding it to the Security Council tab bar was the alternative, but that component's active-tab logic is a two-tab binary that a third entry would have forced me to rewrite.

4. e2e/.auth/*.json were tracked in git. They are listed in .gitignore, but that has no effect on already-committed files, so live session cookies were repository content and every run dirtied the tree. Untracked here, and the misleading "Gitignored" comment corrected.

What is deliberately not covered

The 429 avatar branch. Reaching it means exhausting the real limiter with a key that is a delegate, which would leave that key limited for the rest of the run and make the result order-dependent. It stays covered by the indexer's own unit tests.

Locator note

The proposal description is located by MDEditor's own .w-md-editor-text-input class rather than a data-testid, because ITextAreaProps rejects extra attributes and CreateProposalForm already depends on sibling library classes in its tooltip MutationObserver. No production code was bent to suit the test.

Verified: lint clean, tsc clean, 1262 unit tests, and three consecutive full e2e runs at 19 passed / 1 skipped with no database reset between them.

@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tally-zero Ready Ready Preview Aug 27, 2026 6:10pm

Request Review

Adds the remaining SIWE e2e coverage. Every new spec replays a saved
session via signedInPage(), so the suite still spends exactly five nonces
per run regardless of how many tests it grows.

Running these found four real defects, all fixed here:

  - POST /api/drafts/shared/:slug/submitted is behind requireSession. The
    UI offered the form to anonymous readers and the code comments claimed
    the route was unauthenticated. It requires a session but not
    authorship, so the form is now gated on being signed in and says so —
    the `second` wallet, which did not write the draft, records the
    submission in the spec.

  - Editing, publishing and deleting all require status `draft` (409
    not_editable otherwise), because a share link has to keep resolving to
    what reviewers were shown. DraftList offered Delete on published and
    submitted drafts, where it could only ever 409. A submitted draft now
    offers none of the three, and the spec asserts that.

  - /elections was unreachable. next.config.mjs permanently redirects it
    to /security-council for old bookmarks, so the new page never
    rendered. Moved to /profile/candidate, beside the other owned
    surfaces. Adding it to the Security Council tab bar was the
    alternative, but that component's active-tab logic is a two-tab
    binary that a third entry would have forced me to rewrite.

  - e2e/.auth/*.json were tracked in git. They are listed in .gitignore,
    but that has no effect on already-committed files, so live session
    cookies were repository content and every run dirtied the tree.

The 429 avatar branch is deliberately left uncovered: reaching it means
exhausting the real limiter with a key that is a delegate, which would
leave that key limited for the rest of the run and make the result
order-dependent.

The proposal description is located by MDEditor's own
`.w-md-editor-text-input` class rather than a data-testid, because
ITextAreaProps rejects extra attributes and CreateProposalForm already
depends on sibling library classes.

Verified: lint clean, tsc clean, 1262 unit tests, and three consecutive
full e2e runs at 19 passed / 1 skipped with no reset between them.
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