Repository navigation
feat: add UI capture sample shops for React, Next.js and plain HTML - #116
Merged
Merged
Conversation
One small shop built three ways (React + Vite + React Router, Next.js App Router, plain HTML pages with no bundler), each recorded in the browser with @keploy/capture-sdk, pinned to 3.1.0-rc.2. They share the same pages, data-testids and /api routes, so their flows carry the same names. Each folder has a README (run it, where the ingest key goes, what is recorded and masked), a .env.example with placeholders, a lockfile, `npm run demo:visits` (five scripted visits; the single-page shops mark each visit complete so it becomes flows at once) and `npm test`: a Playwright smoke test against a local fake ingest. It checks that the pinned SDK version is sent, that every page, click and request made once the capture is recording arrives, that typed values are masked, that the order's email is redacted, that the blocked and masked regions and the key appear nowhere, and that demo:visits records every visit whole. The shops never hold their own requests back for the SDK, so a request a page makes while init() is still loading rrweb is not recorded; the READMEs say so and the test prints whether each load request made it. A GitHub Actions workflow per folder runs install, build and the smoke test on Node 22.22 and 24 for changes to that folder. No Keploy credentials are needed or stored. Signed-off-by: slayerjain <shubhamkjain@outlook.com>
@keploy/capture-sdk 3.1.0 is on npm's latest tag. Pin it exactly in the three shops' package.json, in place of 3.1.0-rc.2. Each lockfile is regenerated for the new pin with npm install --package-lock-only against the existing lockfile, so only the SDK's lines change: the root entry's pin, and the SDK entry's version, tarball and integrity. 3.1.0 depends on rrweb ^2.1.6 as the rc did, so no other locked package moves. For all three folders, npm ci, the build where the folder has one and npm test pass (6 of 6), the tests checking that every batch carries the pinned 3.1.0. Signed-off-by: slayerjain <shubhamkjain@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds three sample apps for Keploy UI capture: one small shop built three ways, each recorded in the browser with
@keploy/capture-sdk(pinned to3.1.0). All three have the same pages (Home, Products with a search box, Cart, Checkout, About), the samedata-testids and the same/apiroutes.ui-capture-react-shopsrc/keploy.tsimported first insrc/main.tsx;privacyMode: "balanced"written out, withmaskSelectors,blockSelectorsand a commentedsecretRoutes; anonErrorthat ignoresKUI_E_CAPTURE_DECLINED; logs its session id. One session per visit, every route change recorded with itscause.ui-capture-next-shopinit()frominstrumentation-client.ts, before hydration;NEXT_PUBLIC_variables; client components that fetch in the browser; Next's own?_rsc=fetches are recorded too.ui-capture-html-shopdist/served as npm installed it, with an import map forrrweb;keploy.jsloaded as its ownasyncmodule script. Every page load is a session of its own.Each folder has:
.env.examplewith placeholders, and a lockfile;npm run demo:visits: five scripted visits in headless Chromium. The two single-page shops end each visit and mark it complete (POST /ui/v1/sessions/<id>/complete), so it becomes flows at once.npm test: a Playwright smoke test against a local fake ingest (test/fake-ingest.mjs). No Keploy account or key is needed. It checks:?q=kettle, whichbalancedkeeps);demo:visitsrecords every visit whole.The shops never hold their own requests back until the SDK is recording, so the SDK never slows them. A request a page makes while
init()is still loading rrweb is not recorded, as the SDK's README says. Each README says so, andnpm testprints whether each page's load request made it.One GitHub Actions workflow per folder (
.github/workflows/ui-capture-*-shop.yml) runsnpm ci, the build andnpm teston Node 22.22 and 24, for changes to that folder only. No secrets are used.Verified before opening:
npm testfor all three folders: run on Linux withnpm ci, the build andnpm test, as CI does: 6 of 6 pass, on3.1.0-rc.2and again on3.1.0.3.1.0-rc.2, before the bump to3.1.0): each used its own disposable app, built with a freshly minted ingest key, and was driven by its ownnpm run demo:visits.FLOWS_READY.Click on /,Click on /cart,Click on /products,Fill on /checkout,Fill on /products,Navigate on /about,Navigate on /cart.The root README lists the three samples.