Skip to main content

Doctor (E2E)

Backend end-to-end (E2E) tests for the Subscriberbot product. This repo exercises the workspace microservice wspace-subscriberbot-svc through the workspaces public GraphQL gateway. It is a focused backend test suite only — no UI or service-startup automation lives here.

What's inside

.
├── Makefile # Root test orchestration
├── README.md # This file
├── core/scripts/common.sh # Shared harness copied from workspaces-doctor
└── wspace/modules/subscriberbot/
├── Makefile # Module-level targets
├── README.md # Detailed coverage notes
└── scripts/
├── test-subscriberbot.sh # Per-domain CRUDL suite
├── test-subscriberbot-stories.sh # 12 website story scenarios
└── test-subscriberbot-onboarding-journey.sh # Spec-driven onboarding journey

Prerequisites

  • curl, jq, make

  • For local runs, source the shared env file from workspaces-doctor to get tokens (do not run bootstrap-env from this repo):

    source /home/ubuntu/products/workspaces/workspaces-doctor/core/env/e2e-env.sh

    This provides E2E_AUTH_TOKEN, E2E_WORKSPACE_TOKEN, E2E_WORKSPACE_ID, etc.

  • For alpha/prod runs, export the credentials directly (they override the shared env file values):

    export AUTH_TOKEN="<alpha-or-prod-jwt>"
    export WORKSPACE_TOKEN="<workspace-access-jwt>"
    export WORKSPACE_ID="<workspace-uuid>"
    export USER_ID="<user-uuid>"

Target environment

The suite defaults to the production workspaces public gateway. Select the target with SUBSCRIBERBOT_TARGET:

TargetSUBSCRIBERBOT_TARGETCanonical endpoint
prodprod (default)https://graphqlworkspaces.burdenoff.com/workspaces/graphql
alphaalphahttps://alphagraphqlworkspaces.burdenoff.com/workspaces/graphql
locallocalhttp://localhost:4003/workspaces/graphql

Direct endpoint overrides take precedence:

SUBSCRIBERBOT_ENDPOINT=http://localhost:4003/workspaces/graphql make test-health

E2E_WSPACE_PUBLIC_GATEWAY / E2E_WORKSPACE_GATEWAY / WSPACE_GATEWAY_URL are also honored before the target default.

Running tests

Smoke / story tests (default: prod)

make test

Runs test-stories (all 12 story scenarios) and test-onboarding.

Local smoke / story tests

SUBSCRIBERBOT_TARGET=local make test

Everything

make test-all

Runs the CRUDL domain suite, the 12 story scenarios, and the onboarding journey.

Individual suites

make test-health
make test-provider
make test-relationship
make test-inbox
...
make test-stories
make test-onboarding

See make help for the full list.

Alpha with Cloudflare Access

When SUBSCRIBERBOT_TARGET=alpha, the suite automatically attaches CF-Access-Client-Id and CF-Access-Client-Secret headers if the env vars are set:

export CF_ACCESS_CLIENT_ID="..."
export CF_ACCESS_CLIENT_SECRET="..."
SUBSCRIBERBOT_TARGET=alpha make test

Custom endpoint / run label

SUBSCRIBERBOT_ENDPOINT=http://localhost:4003/workspaces/graphql \
RUN_ID=ci-run-42 \
make test-stories

Test coverage

CRUDL suite (test-subscriberbot.sh)

DomainOperations
healthsubHealth
providersubCreateProvider / subListProviders / subProvider / subUpdateProvider / subArchiveProvider
plansubCreatePlan / subListPlans
relationshipsubCreateRelationship / subListRelationships / subRelationship / subUpdateRelationship / subTransitionRelationship / subCancelRelationship
entitlementsubCreateEntitlement / subListEntitlements
assetsubCreateAsset / subListAssets
channelsubCreateChannel / subListChannels / subVerifyChannel
inboxsubIngestMessage / subListInboxMessages / subMarkMessageRead
invoicesubCreateInvoice / subListInvoices / subMarkInvoicePaid
paymentsubCreatePaymentInstrument / subListPaymentInstruments / subRemovePaymentInstrument
agentsubCreateAgent / subListAgents / subAgent / subSetAgentStatus
policysubCreatePolicy / subListPolicies
workflowsubCreateWorkflow / subListWorkflows / subActivateWorkflow
renewalsubListRenewalEvents

Story scenarios (test-subscriberbot-stories.sh)

Twelve multi-step user journeys matching the product website stories, e.g. discover-hidden-subscriptions, one-place-manage-cancel, universal-inbox, cut-wasted-spend, autonomous-management, etc.

Onboarding journey (test-subscriberbot-onboarding-journey.sh)

A spec-driven end-to-end flow based on subscriberbot-specs/journey/END_TO_END_USER_JOURNEY.md:

  1. Health probe
  2. Connect and verify an email channel
  3. Discovery surfaces a provider, plan, and linked relationship
  4. Universal inbox ingests and marks-read a message
  5. Relationship lifecycle control (pause + resume)
  6. AI cost agent + autonomous policy + activated workflow

Notes

  • Tests rely on the shared harness in core/scripts/common.sh. The harness is self-contained to this repo and sources /home/ubuntu/products/workspaces/workspaces-doctor/core/env/e2e-env.sh at runtime via the caller's environment.
  • Permission/RBAC walls are treated as FAIL in the onboarding journey and as SKIP in the CRUDL/story suites, matching the conventions of the source workspaces-doctor tests.
  • Cleanup is best-effort: relationships are cancelled and providers archived where the schema supports terminal mutations.
Environment selection

The doctor suite defaults to production. Use SUBSCRIBERBOT_TARGET=local|alpha to switch. See Environment Selection for endpoint details.