MotirBuilding in public
MOTIR · moooon
onMotir
You’re viewing a public project. Anyone can view it — no account needed. Sign in to submit, upvote, or comment on requests.View-only — you can’t edit work items
MOTIR-93

2.3.8 Story E2E — create → edit → status-change lifecycle (Playwright)

Done
Description

Estimate: 14m · Depends on: 2.3.3, 2.3.6

The Story-closing Playwright suite at tests/e2e/issue-create-edit-flow.spec.ts, driving the real stack end-to-end and surfacing any UI ↔ service-layer seam bugs that unit tests structurally can't catch (the 1.6.6 pattern — real-stack E2E found two production bugs the unit tests masked). Sibling to 2.3.2's delete-with-reassign E2E.

Scenarios (all single specs against the real Next.js dev server + Postgres):

  • Happy-path create: sign in, navigate to a project, press "C", fill type=Story / title="My story" / description-with-bold-and-image-paste, submit; toast surfaces the PROD-N identifier; navigate via the toast link to the edit route; verify every field round-tripped including the rendered image.
  • Type-parent validation surfaced inline: open create modal, set type=Subtask, open parent picker → assert only Story/Task/Bug options appear (no Epics, no other Subtasks); switch type=Epic → assert the parent picker now shows no candidates ("No parent" only).
  • Edit non-status fields: navigate to /.../edit for an existing issue, change title + priority, submit; verify the update + a single revision row of changeKind=updated.
  • Status edit goes through the gated path: on the same edit form, change status from todoin_progress (legal); verify success. Then try changing to a custom status with NO transition row (illegal restricted-mode); verify the inline picker error fires AND no revision row was written.
  • Stale-edit detection: open the edit form, externally bump the row's updatedAt via the _test harness, submit; verify the StaleWorkItemError 409 surfaces as the refresh banner.
  • Cross-workspace isolation: sign in as user-A in workspace-A, navigate to a URL with workspace-B's issue key → 404 (does not leak title/existence).

Reusable helpers lifted from 2.2.7's tests/e2e/_helpers/workflow.ts + 1.5.6's tests/e2e/_helpers/shell-session.ts. Any new helper goes under tests/e2e/_helpers/issues.ts (createIssue, openEditForm, submitEditForm).

Acceptance criteria

  • pnpm test:e2e --grep issue-create-edit-flow passes locally + in CI against a fresh-DB run.
  • All six scenarios above present as separate specs with the documented assertions.
  • Uses stable data-testid hooks added in 2.3.3 / 2.3.6 if any are missing — no brittle text/role-only selectors.
  • Image-paste scenario uses the Playwright clipboard / file-paste API; if the image-upload Subtask 2.3.7 hasn't landed at the time 2.3.8 runs, that single assertion drops to verifying the "image uploads aren't enabled" notice instead (the Subtask's spec must handle both states cleanly — gated by an env var or a runtime feature-flag read).
  • No flake under 10 consecutive runs in CI mode.
  • The new /.../edit route joins the STRICT shell-a11y sweep (if it didn't already in 2.3.6).

Context refs

  • tests/e2e/_helpers/workflow.ts (2.2.7) — createItem / transition helpers
  • tests/e2e/_helpers/shell-session.ts (1.5.6) — sign-in + createWorkspace + createProject helpers
  • tests/e2e/workflow-delete-reassign.spec.ts (2.3.2 — sibling) — the existing Story 2.3 E2E to mirror conventions with
  • app/api/_test/work-items/route.ts — the test harness for forging row state (used for stale-edit)
  • playwright.config.ts — webServer block