Testing

May 5, 2026 · View on GitHub

This document covers how to run the various test suites in the ForgeRock Web Login Framework.

Table of Contents

Unit Tests

Unit tests use Vitest and live alongside the source code in packages/login-widget.

# Run tests in watch mode
pnpm test

# Run tests once (CI mode)
pnpm test -- --run

Storybook Tests

Storybook interaction tests verify component behavior in an isolated environment.

# Build Storybook
pnpm build:storybook

# Run Storybook interaction tests (requires Storybook to be running)
pnpm storybook         # Start Storybook on port 6006
pnpm test:storybook    # Run interaction tests against running Storybook

E2E Tests

End-to-end tests use Playwright and live in the e2e/ workspace. See e2e/README.md for detailed documentation.

Prerequisites

Before running E2E tests, you must:

  1. Build the widget: pnpm build:widget
  2. Build the login-app: pnpm build:app
  3. Install Playwright browsers: pnpm exec playwright install chromium

Running E2E Tests

# Run all E2E tests
pnpm ci:e2e

# Run with debug mode (opens browser inspector)
pnpm --filter @forgerock/login-widget-e2e run ci:e2e:debug

# Run a specific test file
pnpm ci:e2e -- tests/widget/modal/widget-modal.login.test.js

# Run with visible browser
pnpm ci:e2e -- --headed

Environment Variables

E2E tests require ForgeRock AM connection details. Set these in your environment or a .env file:

VariableDescription
VITE_FR_AM_URLForgeRock AM base URL
VITE_FR_AM_COOKIE_NAMEAM session cookie name
VITE_FR_OAUTH_PUBLIC_CLIENTOAuth 2.0 client ID
VITE_FR_REALM_PATHAM realm path
FR_AM_WELLKNOWN_URLAM wellknown URL

Linting

# Run Prettier + ESLint with auto-fix
pnpm check:lint

# Run Svelte type checking
pnpm check:svelte

CI Pipeline

The CI pipeline (.github/workflows/ci.yml) runs the following jobs on every push:

JobDescription
buildBuilds the widget release artifacts
test-lint-storybook-buildRuns linting, unit tests, Storybook build, and Storybook interaction tests
e2eRuns Playwright tests across macOS + Ubuntu with 4-shard parallelism
merge-e2e-reportMerges sharded E2E reports into a single HTML report
chromaticRuns Chromatic visual regression tests

© Copyright 2022-2025 Ping Identity Corporation. All Rights Reserved.