Files
igny8/master-docs/CONTENT-MANAGER-REMOVAL-TESTS.md
2025-11-29 11:23:42 +05:00

54 lines
2.7 KiB
Markdown

# Content Manager Removal — Tests, E2E Flows & Rollback
Purpose: a concise, actionable test plan and rollback instructions to validate the first non-destructive sprint before full cleanup.
1) Smoke tests (manual or scriptable)
- Create content from Planner → verify Content record exists with `content_html` populated.
- Generate image prompts for a Content item (draft) → verify image prompt records created and UI shows "Image Prompts Generated".
- Generate images → verify images tasks start and images appear in `/writer/images`.
- Move Content to `review` status → call Publish → verify backend returns `external_id` and `external_url` set on Content and WP plugin creates post.
- Trigger plugin webhook simulation with `task` payload that includes `content_id` → verify WP post body uses `content_html`.
2) Unit tests (backend)
- `ContentViewSet.publish()`:
- publishes and sets `external_id` and `external_url`.
- rejects publish when site credentials missing.
- `ContentSyncService._sync_to_wordpress`:
- queries `status='published'` (not 'publish').
- writes `content.external_id` on success.
3) Frontend unit tests
- `ContentViewTemplate`:
- buttons visibility by `status` (`draft`: Edit + Generate; `review`: Edit + Publish).
- Edit button navigates to `/sites/{siteId}/posts/{contentId}/edit`.
- `Review` page:
- Title renders as link to `/writer/content/{id}`.
- Categories and Tags columns appear and persist via ColumnSelector.
- `Images` page:
- Content image cells do not show prompt text, only image and status badge.
4) E2E test (recommended - scriptable)
- Flow:
1. Create Idea → create Task → generate content (AI) → assert Content record created.
2. For created Content (status draft) call generate image prompts → start generation → wait for images generated.
3. Change status to review → call publish endpoint → assert WP post exists via plugin test endpoint and `external_id` present.
5) Monitoring & metrics to watch in staging
- Publish success rate (per-minute/hour).
- WP plugin webhook failures and missing credentials.
- Content with `content_id` but empty `content_html`.
6) Rollback steps (fast)
- Flip account setting `feature.content_manager_refactor` OFF (server-side account setting) — this hides/refuses new UI.
- If publish failures spike, set WP plugin option `igny8_connection_enabled` = 0 to stop outbound syncs and webhooks.
- Revert UI commits in the release branch and redeploy.
7) Test artifacts
- Store E2E run logs and failing request/response pairs in `staging/e2e-runs/{timestamp}/`.
Notes
- Automate the E2E with Cypress or Playwright; prefer Playwright for headless CI runs.
- Use test WP site with test credentials; do not use production credentials for staging tests.