You want to test an onboarding flow before any real user sees it. This guide shows you how to walk it by hand from first login to activation, script it so it reruns on every pull request, and promote it to production with a rollback ready. A separate staging environment credential keeps test sessions out of your production analytics. If you only need to preview a flow before it goes live, the Userflow Chrome Extension previews drafts right in your app without publishing.
Key Takeaways
- Isolate staging with separate credentials and data so test activity never reaches production users or analytics.
- Seed users with the exact properties and start events that each targeted flow expects.
- Walk each critical journey manually before scripting its states and assertions for repeatable testing.
- Gate promotion with smoke tests and accessibility checks, then run the full staging suite in continuous integration.
- Verify analytics routing before promotion, then keep both an unpublish path and an application rollback ready.
How to Test Onboarding Flows in Staging: The Short Procedure
Run these eight steps in order each time you test userflow staging before promotion, whether the change is one reworded tooltip or a rebuilt signup tour.
- Isolate staging with its own URL and database, plus a separate userflow.js token or environment credential for each SDK that sends data.
- Seed test users whose attributes match the flow’s targeting rules, and reset the database between runs.
- Pick the journeys that predict activation: signup, first key action, checkout, or form submission.
- Walk each journey by hand with a test account, then script it with Playwright or Cypress. Selenium also works.
- Scan every state the flow produces with axe, and confirm screen-reader output with JAWS Inspect.
- Run the smoke subset pre-merge and the full suite pre-deploy in CI.
- Confirm every event landed in the staging analytics project and none reached production.
- Publish to staging, promote to production, and keep both an unpublish path and a deploy rollback ready.
Prerequisites
Set these up before step 1 to keep staging traffic off your production credential.
- An isolated staging URL: A staging hostname serves your app against a non-production database.
- Separate credentials: Your team stores a separate staging environment credential for each SDK that sends data as an environment-scoped secret in CI (continuous integration).
- Test accounts and sandboxes: Logins for each role the flow targets, plus sandbox keys for payments, email, and single sign-on (SSO).
- CI runner access: You can add a job and a secret to the pipeline that deploys staging.
How to Test Onboarding Flows in Staging: Step by Step
Follow them in order the first time. After that, steps 4 through 8 repeat per change.
Step 1: Set Up an Isolated Staging Environment
Give Userflow and each SDK that sends data a separate environment credential where the vendor supports one. The credential your app loads decides where the data lands. Analytics tools follow the same pattern: a separate source per environment with its own write key. Apply it to your userflow.js loader, analytics key, and feature-flag key.
Staging needs its own datastore for user records, identify calls, and flow state, not only a separate hostname. Swap the Userflow token at initialization from an environment variable, never a hardcoded string:
In GitHub Actions, environment-scoped secrets are visible only to jobs that reference that environment. An environment secret overrides a repository secret of the same name, so a job tied to staging resolves to the staging value.
Step 2: Seed Test Users, Test Data and Logins
Seed accounts carrying the attributes your flow’s targeting reads (plan, role, signup date, lifecycle stage), and send those attributes on the identify call. Ask engineering for idempotent seeds and a named reset command in your runbook (truncate, then re-seed).
Point payment and email integrations at sandboxes: use Stripe’s 4242 4242 4242 4242 test card and SendGrid’s sandbox_mode. Use an Auth0 test tenant with the multi-factor authentication (MFA) policy set to Never. Auth0’s developer keys for social connections break SSO and MFA, so register your own client credentials on the test tenant if the flow depends on either.
Step 3: Pick the Critical User Flows Worth Testing
Test the journeys where a broken step costs you an activation. For most product-led SaaS teams that means the signup tour, the first key action you count as activation, checkout, and any multi-step form in the flow.
Define activation for your product as the first action that predicts sustained use before you pick flows.
Note the targeting conditions each flow needs: segment, page URL, attribute value, and start event. For a trial-admin tour that means segment equals trial, page URL /welcome, plan attribute set to trial, and a start event of first login. Your seeded user from step 2 has to satisfy all four.
Step 4: Walk the Flow Manually, Then Script It
Walk the flow once by hand with a real test account first.
Start that manual pass with the Userflow Chrome Extension: it lets you preview draft flows directly in your app before you publish—even before userflow.js is installed—so you can spot UI or timing issues in context before a single line of test code exists. Open your app in Chrome, activate the extension, and step through the draft flow as a real user would, noting every state change your script will need to reproduce—that record becomes the setup checklist for your test. Playwright’s authentication guide recommends a setup project that logs in once and saves cookies and local storage to playwright/.auth/user.json (add it to .gitignore). Every other test can then start authenticated through storageState.
Cypress follows the same shape with cy.session(). Set baseURL: process.env.BASE_URL || 'http://localhost:3000' and storageState: 'playwright/.auth/user.json' in playwright.config.ts, then assert after every step of the walk:
Run it against staging with BASE_URL=https://staging.example.com npx playwright test.
Step 5: Validate Accessibility Across the Flow
Test every state the flow creates; a landing-page scan never sees the modal that opens two clicks later. With @axe-core/playwright, interact through locators first, then call analyze() with .withTags(['wcag2a','wcag2aa','wcag22aa']) to match Web Content Accessibility Guidelines (WCAG) 2.2 AA.
Deque’s paid axe DevTools CLI adds axe spec <file>, which scans a multi-step workflow in one command. Confirm every image and icon the flow injects carries alt text.
Automated rules will not catch these:
- Modal focus behavior: The W3C’s modal dialog pattern requires
role="dialog"witharia-modal="true". Focus must move into the dialog on open, stay there, and return to the trigger on close. - Screen-reader output: JAWS Inspect logs screen-reader speech as text in its Speech Viewer on Windows without a JAWS license. Vispero states it is not a replacement for JAWS, so keep one manual pass.
Step 6: Wire the Tests into Your CI/CD Pipeline
Run the smoke subset on every pull request and the full suite after each deploy to staging. Pre-merge runs only the critical journeys, tagged @smoke; pre-deploy runs everything against the freshly deployed staging URL and gates the production deploy.
Configure retries: process.env.CI ? 2 : 0 and trace: 'on-first-retry' so a flaky step leaves a trace you can replay:
The --exit flag returns exit code 1 when any rule fails, so the scan blocks the merge.
Step 7: Verify Events Land in Staging, Not Production
Search your staging analytics project for the test user’s ID right after a run, then search production for the same ID and expect nothing. Check the flow analytics you read in Product Adoption Insights too: a completion recorded on staging should never appear where you evaluate production drop-off. A filter added after ingestion only stops future events, so exclude test user IDs from the saved report views your team reads.
Step 8: Publish to Staging Only, Then Promote with a Rollback Path
Publish the flow to staging first. Production sessions load the production credential from step 1, so Userflow serves the staging-token version only on staging. Before promotion, save the currently published flow version with its targeting so you can republish it instead of rebuilding it. Unpublishing applies to the environment you promoted to, so pulling the production version leaves the staging copy in place.
Then publish to production and be ready to unpublish during the first hour — you can manage the flow through publication yourself without engineering. If any app change shipped alongside it, ask engineering for a one-command deploy rollback. On Vercel that is vercel rollback [deployment-id|url], an alias change with no rebuild.
Staging vs. Production: What You Still Cannot Test
Staging proves the flow works for one user with sandboxed dependencies, so run a short smoke pass after each production deploy for the conditions only real traffic creates:
Martin Fowler describes production smoke tests as very fast but not comprehensive. If the post-deploy pass fails, use the rollback from step 8.
Troubleshooting: Why Your Flow Does Not Trigger in Staging
Open the Userflow Debugger in the Chrome Extension first—it shows you exactly why a flow starts or does not start, so you can check targeting rules and trigger conditions without stepping through each row by hand—then scan the table below for the most common causes.
Ephemeral Environments: localhost and PR Preview Deploys
The same procedure works on localhost and per-pull-request preview URLs. On localhost the BASE_URL fallback from step 4 applies and the staging credential stays in place.
Ask engineering to handle the platform items below. The rest of the procedure is unchanged.
- Vercel preview deployments: Each commit gets a new URL, and Google OAuth allows no wildcards, so logins fail unless Auth.js keeps
redirect_urion a stable deployment. - Netlify Deploy Previews: Append
?ntl-drawer-state=hiddenso the collaboration drawer doesn’t cover elements your script clicks.
“Userflow” can mean the Userflow product’s flows or user flows generally. The procedure applies either way; only the credential in step 1 changes to whichever tool renders your onboarding.
FAQ
Use these answers to choose the right test depth, protect analytics, and measure the promoted flow.
Should I test onboarding flows manually, with scripts, or with full end-to-end tests?
Do all three. Walk the flow manually once per change, run scripted checks of critical journeys on every pull request, and run the full suite against staging before each deploy. The manual pass finds design problems. The scripts find regressions.
How do I keep test sessions out of production analytics?
Use the environment separation from step 1 so staging events never enter the production project. If test data already landed, exclude those user IDs from saved report views, then confirm production returns zero results after the next staging run.
How do I measure drop-off and task completion once the flow is live?
Define the task as the activation action, not the last tour step. Then read step-level completion and drop-off for production users in Product Adoption Insights. Compare each release against your trailing baseline because a flow can reach high completion while the action it drives stays flat.
Can a product manager build and update onboarding flows without engineering?
Yes. In Userflow, you build and target product tours in the no-code browser-extension builder by selecting elements on live pages, then publish them without engineering. Engineering installs the userflow.js loader once.
Ship the Flow You Already Tested
Build, target, and publish your next onboarding flow on a 14-day free trial, no credit card required: start your free trial. Use the staging workflow above to validate the flow before you expose it to production users.
.png)

