Skip to content

test(session-replay-browser): SR-2728 nested JSON body masking e2e - #1901

Open
lewgordon-amplitude wants to merge 2 commits into
mainfrom
lew/SR-2728-network-body-mask-graphql-e2e
Open

test(session-replay-browser): SR-2728 nested JSON body masking e2e#1901
lewgordon-amplitude wants to merge 2 commits into
mainfrom
lew/SR-2728-network-body-mask-graphql-e2e

Conversation

@lewgordon-amplitude

Copy link
Copy Markdown
Collaborator

Summary

  • Adds Playwright e2e coverage for excludelist masking on deeply nested JSON request bodies in the sr_logging_config network capture pipeline.
  • Verified: existing unit tests in network-body-capture.test.ts cover applyBodyMasking; branch pushed with e2e addition.

Linear: SR-2728

Made with Cursor

Cover excludelist masking on deeply nested request bodies in the
network capture pipeline.

Co-authored-by: Cursor <cursoragent@cursor.com>
@lewgordon-amplitude
lewgordon-amplitude requested a review from a team as a code owner July 22, 2026 15:06
@linear-code

linear-code Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

SR-2728

@lewgordon-amplitude

Copy link
Copy Markdown
Collaborator Author

bugbot run

Comment thread packages/session-replay-browser/e2e/capture.spec.ts Outdated
Comment thread packages/session-replay-browser/e2e/capture.spec.ts Outdated
pruneJson removes empty parent objects after excluding leaf fields.

Co-authored-by: Cursor <cursoragent@cursor.com>
@lewgordon-amplitude

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 94677d9. Configure here.

@lewgordon-amplitude lewgordon-amplitude changed the title SR-2728 test(session-replay-browser): nested JSON body masking e2e test(session-replay-browser): SR-2728 nested JSON body masking e2e Jul 22, 2026
@github-actions

Copy link
Copy Markdown

size-limit report 📦

Path Size
packages/analytics-browser/lib/scripts/amplitude-min.js.gz 61.24 KB (0%)
packages/session-replay-browser/lib/scripts/session-replay-browser-min.js.gz 134.97 KB (0%)
packages/unified/lib/scripts/amplitude-min.umd.js.gz 215.32 KB (0%)
@amplitude/element-selector (gzipped esm) 2.67 KB (0%)

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

Session Replay Browser E2E Results

passed  153 passed
flaky  2 flaky

Details

stats  155 tests across 17 suites
duration  4 minutes, 37 seconds
commit  94677d9

Flaky tests

chromium › e2e/shadow-dom.spec.ts › captureAdoptedStyleSheets option › SDK initializes without error and captures shadow host with default (true)
chromium › e2e/trc-url-rule.spec.ts › TRC URL rule — happy path › starts recording after SPA navigation to a matching URL

@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Wrong nested mask expectation
    • Updated test expectation to only include query field, as pruneJson removes empty parent objects after excluding nested fields.

Create PR

Or push these changes by commenting:

@cursor push 5300530777
Preview (5300530777)
diff --git a/packages/session-replay-browser/e2e/capture.spec.ts b/packages/session-replay-browser/e2e/capture.spec.ts
--- a/packages/session-replay-browser/e2e/capture.spec.ts
+++ b/packages/session-replay-browser/e2e/capture.spec.ts
@@ -972,7 +972,7 @@
     const evt = getFetchEvents().find((e) => String(e.url).includes('/graphql'));
     expect(evt).toBeDefined();
     expect(evt!.requestBody).toBe(
-      '{"query":"mutation Login($input: LoginInput!) { login(input: $input) { id } }","variables":{"input":{}}}',
+      '{"query":"mutation Login($input: LoginInput!) { login(input: $input) { id } }"}',
     );
   });

You can send follow-ups to the cloud agent here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant