Skip to Content

Onboarding — End-to-End Test Scenarios

Overview

End-to-end test covering the full post-registration onboarding flow — from first login through context approval, strategy approval, and deliverable plan approval to a live dashboard.

Tested via: MCP Playwright browser (real browser, not CLI specs)
Portals: Dashboard (port 3000), Manage (port 3001)
Date verified: 2026-04-10


Prerequisites

Step 0 — Complete self-signup first.
The onboarding flow begins where the signup flow ends. Run Scenario A — Full Happy Path from the self-signup test scenarios doc to create a fresh tenant account before starting here.

  • All Docker containers healthy (docker ps)
  • All dev servers running (see startup procedure)
  • Queue worker running: pnpm --filter api worker
  • Scheduler worker running: pnpm --filter @leadmetrics/server-scheduler dev
  • Tenant account created via signup (email: moble+signup-a-1@leadmetrics.ai, company: BrightCoral Digital Pvt Ltd)

Actors

ActorCredentialsPortal
Tenant adminmoble+signup-a-1@leadmetrics.ai / Password123Dashboard (3000)
Super adminsuperadmin@leadmetrics.ai / adminManage (3001)

Dashboard Stage Reference

The dashboard GettingStartedView shows different content based on the pipeline stage:

StageTrigger conditionBanner title
1 (Analysing)Context not yet completed or approved”AI agents are working on your account…” (if generating) or “Your account is ready to configure”
2 (Strategy)Context approved, no goals generated yet”Building your marketing strategy…“
3 (Goals set)Goals exist, no activities yet”Goals & KPIs are set — agents will start working soon”
5+ (Regular)Activities and active period existFull RegularDashboard (stats, pipeline, etc.)

Scenario A — Full Happy Path

Step 1 — First Login

  1. Navigate to http://localhost:3000/login
  2. Enter email: moble+signup-a-1@leadmetrics.ai, password: Password123
  3. Click Sign in

Expected:

  • Redirected to /dashboard
  • GettingStartedView shown at Stage 1
  • Banner: “AI agents are working on your account…” (pulsing clock icon if generating, sparkles if not)
  • Body: “We’re researching your business and building your strategy. This usually takes 5–15 minutes. You’ll receive an email when it’s ready.”
  • 4-step workflow card: Step 1 = “In progress”, Steps 2–4 = upcoming

Step 2 — View Context (While Generating)

  1. Navigate to http://localhost:3000/client-info?tab=context

Expected (if agents are still running):

  • Blue banner: “AI agents are researching your business. This usually takes 3–8 minutes. The page will update automatically when done.”
  • Agent status panel visible with streaming updates

Note: /settings/context redirects to /client-info?tab=context. Both URLs work.


Step 3 — Wait for Context to Complete

Poll /client-info?tab=context (or wait for the context_ready email) until the status changes to completed.

Expected when complete:

  • Blue banner disappears
  • Amber banner: “Context ready for review. Review the AI-generated profile below, then approve to unlock your marketing strategy.”
  • Full business context profile rendered in markdown with 8 sections:
    • Company Overview
    • Products & Services
    • Target Audience
    • Brand Voice & Tone
    • Competitors
    • Geographic Focus
    • Key Messages
    • What NOT to Do
  • Approve Context button visible (amber)

Step 4 — Approve Context

  1. Review the generated context on /client-info?tab=context
  2. Click Approve Context

Expected:

  • Amber banner replaced with green banner: “Client context approved — strategy generation is underway.”
  • Button disappears (context now read-only)
  • Dashboard (/dashboard) now shows Stage 2: “Building your marketing strategy…”

Step 5 — Wait for Strategy

Navigate to http://localhost:3000/strategy and wait for the strategy to appear.

Expected when ready:

  • Strategy document rendered with sections:
    • Executive Summary
    • Situation Analysis / SWOT
    • Target Audience Personas
    • Marketing Goals & KPIs
    • Channel Strategy
    • Content Strategy
    • SEO Strategy
    • Monthly Execution Roadmap (Month 1–6)
    • Budget & Resource Allocation
    • Success Metrics
  • Status badge: Pending Review (amber)
  • Right sidebar: Timeline, Details, Revise tabs

Step 6 — Approve Strategy

  1. On /strategy, click the Pending Review status badge/dropdown
  2. Select Approved from the dropdown

Expected:

  • Status badge changes to Approved (green)
  • Deliverable planner agent is enqueued
  • Dashboard (/dashboard) now shows Stage 3: “Goals & KPIs are set — agents will start working soon”

Step 7 — Wait for Deliverable Plan

Navigate to http://localhost:3000/strategy/deliverable-plan and wait.

Expected when ready:

  • Amber banner: “Review required — The AI has generated this deliverable plan from your approved strategy. Review the goals and monthly deliverables below, then click ‘Approve Plan’ to start executing.”
  • Summary stats: number of Goals, Deliverable types, Estimated Monthly Credits
  • Goals table: title, metric, target value, timeframe, channel, linked deliverable types
  • Monthly Deliverables table: type, priority, rationale, platforms, volume/mo, credits/unit
  • Approve Plan button (teal)

Step 8 — Approve Deliverable Plan

  1. Review the plan on /strategy/deliverable-plan
  2. Click Approve Plan

Expected:

  • Status changes to Approved (green badge)
  • Activity planner agent is enqueued for the current month period
  • Dashboard eventually progresses to Stage 5 (RegularDashboard) once activities are created

Scenario B — Context Not Yet Generating

Immediately after first login (before agents have started):

  1. Navigate to http://localhost:3000/dashboard

Expected (Stage 1, not generating):

  • Banner: “Your account is ready to configure” (sparkles icon — no pulsing clock)
  • Body: “Complete your business info so our AI agents can get started.”
  • CTA link to /client-info?tab=overview

This happens when the BullMQ setup chain hasn’t been picked up by the worker yet. Starting the worker (pnpm --filter api worker) will trigger the chain.


Scenario C — Strategy Revision Request

After context is approved and strategy is generated (Step 5 above):

  1. Navigate to /strategy
  2. In the Revise tab of the right sidebar, enter revision instructions: Focus more on LinkedIn B2B content and less on Instagram
  3. Click Regenerate Strategy

Expected:

  • Strategy status changes to Pending Review
  • New version generated by strategy-writer agent
  • Timeline tab shows: “Strategy revision requested” entry + “Marketing strategy vN generated” entry
  • New strategy content reflects the revision instructions

Scenario D — Manage Portal Tenant Verification

After completing Scenario A’s signup (tenant created with status: onboarding):

  1. Log in to http://localhost:3001 as superadmin@leadmetrics.ai / admin
  2. Navigate to Tenants → search for “BrightCoral Digital”
  3. Click the tenant row to open the detail page

Expected:

  • Tenant name: BrightCoral Digital Pvt Ltd
  • Status badge: onboarding
  • createdVia: self-signup
  • Plan: Professional
  • ▶ Activate button visible (green, top-right of tenant header)
  • Subscriptions tab: one active Professional subscription entry
  • Knowledge Base tab: 4 default datasets (client_docs, website_content, published_content, competitor_content)

Scenario E — Tenant Activation

Continuing from Scenario D:

  1. Click ▶ Activate
  2. Browser confirmation dialog: “Activate this tenant? This will generate the first invoice and send an email notification.”
  3. Click OK to confirm

Expected:

  • Status badge changes to active (green)
  • ▶ Activate button disappears
  • Tenant status changer now shows active with transitions available to suspended / cancelled
  • Invoices tab counter increments to 1
  • Invoice row visible with:
    • Invoice number: INV-YYYY-MM-XXXX
    • Type: Subscription
    • Status: pending
    • Issued: today
    • Due: 7 days from today

Sample Test Data

BrightCoral Digital Pvt Ltd (verified 2026-04-10)

  • Email: moble+signup-a-1@leadmetrics.ai
  • Company: BrightCoral Digital Pvt Ltd
  • Location: Kochi, Kerala — GST 32AABCU9603R1ZX
  • Industry: Marketing & Advertising
  • Plan: Professional (₹49,999/month)
  • Payment ID: pay_SbpHDCOVywmKyn (Razorpay test mode)
  • Post-signup URL: /login?registered=1

Known Issues / Gotchas

IssueDetail
Queue worker not started by pnpm devpnpm --filter api worker must be started separately. Without it, setup chain never runs and context stays at pending.
Context stays pending (not generating)Worker isn’t running or the BullMQ job failed. Check worker logs.
Strategy takes longer than expectedStrategy writer uses the full Claude API call. Can take 2–5 minutes on first run. Refresh /strategy manually — the page does not auto-poll.
Strategy status dropdown: Approved triggers deliverable plannerSelecting Rejected does NOT trigger anything. Selecting Draft or Pending Review just changes the label. Only Approved enqueues the deliverable planner.
Deliverable plan missing channelsIf no social channels are connected, the planner may exclude channel-specific deliverable types (e.g. GBP posts). The Planning Notes section will explain exclusions.
▶ Activate confirm dialog is a native browser confirm()Playwright must use browser_handle_dialog or page.on('dialog', ...) to accept it.
Manage portal session expiryJWT session expires. Re-login with superadmin@leadmetrics.ai / admin if pages show 401.
client-info?tab=context auto-refreshThe page does NOT automatically poll for context status changes. Refresh the page manually to see updated status.

© 2026 Leadmetrics — Internal use only