Skip to content

fix(journey-suites): use mock API for otp-register e2e test#595

Merged
ryanbas21 merged 1 commit into
mainfrom
fix/journey-client-otp-register
Apr 28, 2026
Merged

fix(journey-suites): use mock API for otp-register e2e test#595
ryanbas21 merged 1 commit into
mainfrom
fix/journey-client-otp-register

Conversation

@ryanbas21
Copy link
Copy Markdown
Collaborator

@ryanbas21 ryanbas21 commented Apr 28, 2026

Summary

e2e/journey-suites/src/otp-register.test.ts was hitting the real backend at openam-sdks.forgeblocks.com (clientId=tenant + journey=TEST_OTPRegistration). A TODO in the test signalled it should migrate to the mock API once OTP support landed. That landed (qrCodeCallbacksResponse for the QRCodeTest journey), but the test was never migrated.

The shared sandbox account / journey state on openam-sdks.forgeblocks.com no longer authenticates sdkuser/password for TEST_OTPRegistration — the auth flow loops back to the username/password form instead of advancing to the QR step. As a result, every PR opened or pushed since the underlying state changed has been failing this test, blocking CI for unrelated work.

Changes

  • Switch URL to ?journey=QRCodeTest (default basic config → local mock at localhost:9443), aligning with qr-code.test.ts.
  • Update the messageArray assertion from .includes() (exact match) to .some(msg => msg.includes(...)) (substring) — the QR-code component logs the message wrapped in JSON via console.log('QR Code data:', JSON.stringify(qrCodeData)), so the exact-string match never worked once rendering moved through renderQRCodeStep.
  • Drop the now-obsolete // TODO: Use when AM Mock API is available comment.

Verification

  • nx run @forgerock/journey-suites:e2e-ci--src/otp-register.test.ts — passes locally (17s).
  • nx typecheck @forgerock/journey-suites — clean.
  • nx lint @forgerock/journey-suites — clean.

Test plan

  • e2e test passes locally
  • typecheck + lint clean
  • CI green

Summary by CodeRabbit

  • Tests
    • Updated end-to-end test to cover QR code authentication journey with improved console message verification logic.
    • Removed incomplete test assertions.

The test hit the real backend (openam-sdks.forgeblocks.com/TEST_OTPRegistration)
but a TODO indicated it should migrate to the mock once support landed. The mock
now has qrCodeCallbacksResponse for the QRCodeTest journey, so switching removes
the hidden dependency on a shared sandbox and makes the test deterministic. This
unblocks every PR currently failing this same test.

Also switch the messageArray assertion from .includes (exact) to .some +
substring — the QR component logs the message wrapped in JSON, so an exact match
on the bare message string never worked once rendering moved through
renderQRCodeStep.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 28, 2026

⚠️ No Changeset found

Latest commit: a250b8c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 157eab4b-c95f-45db-a2f8-4508a6e10222

📥 Commits

Reviewing files that changed from the base of the PR and between b081582 and a250b8c.

📒 Files selected for processing (1)
  • e2e/journey-suites/src/otp-register.test.ts

📝 Walkthrough

Walkthrough

The e2e test for OTP registration was updated to navigate to a QRCodeTest journey instead of the previous OTP registration journey. Console message verification was changed from an exact-match approach to a substring-based predicate check. Previously commented-out AM Mock API assertions were removed.

Changes

Cohort / File(s) Summary
E2E Test Update
e2e/journey-suites/src/otp-register.test.ts
Modified navigation target to QRCodeTest journey; changed console message verification from includes (array method) to some (predicate-based substring check); removed commented-out TODO assertions for AM Mock API (otpauth://totp/... string and success message).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • cerebrl
  • SteinGabriel

Poem

🐰 A new path we hop today,
From OTP to QR's way,
Old TODOs rest in comment's grave,
Predicates now help us behave,
The test suite dances, fresh and spry! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: migrating the otp-register e2e test to use the mock API instead of the real backend.
Description check ✅ Passed The pull request description is comprehensive and well-structured, covering summary, changes, verification, and test plan sections that go beyond the template requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/journey-client-otp-register

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Apr 28, 2026

View your CI Pipeline Execution ↗ for commit a250b8c

Command Status Duration Result
nx run-many -t build --no-agents ✅ Succeeded 3s View ↗
nx affected -t build lint test typecheck e2e-ci ✅ Succeeded 2m 8s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-28 21:40:59 UTC

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 28, 2026

Open in StackBlitz

@forgerock/davinci-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/davinci-client@595

@forgerock/device-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/device-client@595

@forgerock/journey-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/journey-client@595

@forgerock/oidc-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/oidc-client@595

@forgerock/protect

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/protect@595

@forgerock/sdk-types

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-types@595

@forgerock/sdk-utilities

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-utilities@595

@forgerock/iframe-manager

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/iframe-manager@595

@forgerock/sdk-logger

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-logger@595

@forgerock/sdk-oidc

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-oidc@595

@forgerock/sdk-request-middleware

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-request-middleware@595

@forgerock/storage

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/storage@595

commit: a250b8c

@github-actions
Copy link
Copy Markdown
Contributor

Deployed 5d53299 to https://ForgeRock.github.io/ping-javascript-sdk/pr-595/5d53299e6c81e5243790e0e32b4062b11392075f branch gh-pages in ForgeRock/ping-javascript-sdk

@github-actions
Copy link
Copy Markdown
Contributor

📦 Bundle Size Analysis

📦 Bundle Size Analysis

🚨 Significant Changes

🔻 @forgerock/device-client - 0.0 KB (-9.9 KB, -100.0%)
🔻 @forgerock/journey-client - 0.0 KB (-89.9 KB, -100.0%)

📊 Minor Changes

📉 @forgerock/device-client - 9.9 KB (-0.0 KB)
📈 @forgerock/journey-client - 90.1 KB (+0.2 KB)

➖ No Changes

@forgerock/davinci-client - 48.0 KB
@forgerock/oidc-client - 25.2 KB
@forgerock/sdk-utilities - 11.2 KB
@forgerock/sdk-types - 7.9 KB
@forgerock/protect - 150.1 KB
@forgerock/storage - 1.5 KB
@forgerock/sdk-oidc - 4.8 KB
@forgerock/sdk-request-middleware - 4.5 KB
@forgerock/sdk-logger - 1.6 KB
@forgerock/iframe-manager - 2.4 KB


14 packages analyzed • Baseline from latest main build

Legend

🆕 New package
🔺 Size increased
🔻 Size decreased
➖ No change

ℹ️ How bundle sizes are calculated
  • Current Size: Total gzipped size of all files in the package's dist directory
  • Baseline: Comparison against the latest build from the main branch
  • Files included: All build outputs except source maps and TypeScript build cache
  • Exclusions: .map, .tsbuildinfo, and .d.ts.map files

🔄 Updated automatically on each push to this PR

@ryanbas21 ryanbas21 merged commit f42f440 into main Apr 28, 2026
8 checks passed
@ryanbas21 ryanbas21 deleted the fix/journey-client-otp-register branch April 28, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants