test: add playwright script that proxies Amplitude scripts to test customer pages#1682
test: add playwright script that proxies Amplitude scripts to test customer pages#1682daniel-graham-amplitude wants to merge 11 commits intomainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for all 3 issues found in the latest run.
- ✅ Fixed: Playwright added as production dependency instead of dev
- Moved
playwrightfromdependenciestodevDependenciesso it is not installed in production contexts.
- Moved
- ✅ Fixed: Playwright version mismatch with @playwright/test dependency
- Pinned
playwrightto1.55.0to match the existing@playwright/testversion and updated lockfile entries accordingly.
- Pinned
- ✅ Fixed: ESM import syntax in .js without "type": "module"
- Converted
e2e/manual-test.jsto CommonJS (require) and corrected usage text/comments so it runs with plain Node.js.
- Converted
Or push these changes by commenting:
@cursor push 7665094b95
Preview (7665094b95)
diff --git a/e2e/manual-test.js b/e2e/manual-test.js
--- a/e2e/manual-test.js
+++ b/e2e/manual-test.js
@@ -1,12 +1,12 @@
-// playwright-proxy.ts
-import { chromium } from 'playwright';
+// playwright-proxy.js
+const { chromium } = require('playwright');
// Get URL from command line args
const targetUrl = process.argv[2];
if (!targetUrl) {
- console.error('Usage: npx ts-node playwright-proxy.ts <url>');
- console.error('Example: npx ts-node playwright-proxy.ts https://example.com');
+ console.error('Usage: node e2e/manual-test.js <url>');
+ console.error('Example: node e2e/manual-test.js https://example.com');
process.exit(1);
}
diff --git a/package.json b/package.json
--- a/package.json
+++ b/package.json
@@ -78,6 +78,7 @@
"morgan": "^1.10.0",
"nodemon": "^3.0.1",
"nx": "^21.2.1",
+ "playwright": "1.55.0",
"prettier": "^2.8.1",
"rimraf": "^3.0.2",
"source-map": "^0.7.4",
@@ -95,7 +96,6 @@
]
},
"dependencies": {
- "playwright": "^1.59.1",
"tslib": "^2.4.1"
},
"packageManager": "pnpm@10.26.1+sha512.664074abc367d2c9324fdc18037097ce0a8f126034160f709928e9e9f95d98714347044e5c3164d65bd5da6c59c6be362b107546292a8eecb7999196e5ce58fa"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -8,9 +8,6 @@
.:
dependencies:
- playwright:
- specifier: ^1.59.1
- version: 1.59.1
tslib:
specifier: ^2.4.1
version: 2.8.1
@@ -111,6 +108,9 @@
nx:
specifier: ^21.2.1
version: 21.6.8
+ playwright:
+ specifier: 1.55.0
+ version: 1.55.0
prettier:
specifier: ^2.8.1
version: 2.8.8You can send follow-ups to the cloud agent here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 4 total unresolved issues (including 3 from previous reviews).
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Usage error message references wrong filename and command
- Updated
e2e/manual-test.jsto reference the correct script filename and invocation command in both the header comment and missing-argument usage/example messages.
- Updated
Or push these changes by commenting:
@cursor push d8388b0d1d
Preview (d8388b0d1d)
diff --git a/e2e/manual-test.js b/e2e/manual-test.js
--- a/e2e/manual-test.js
+++ b/e2e/manual-test.js
@@ -1,12 +1,12 @@
-// playwright-proxy.ts
+// manual-test.js
import { chromium } from 'playwright';
// Get URL from command line args
const targetUrl = process.argv[2];
if (!targetUrl) {
- console.error('Usage: npx ts-node playwright-proxy.ts <url>');
- console.error('Example: npx ts-node playwright-proxy.ts https://example.com');
+ console.error('Usage: node ./e2e/manual-test.js <website-url>');
+ console.error('Example: node ./e2e/manual-test.js https://example.com');
process.exit(1);
}You can send follow-ups to the cloud agent here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
There are 4 total unresolved issues (including 1 from previous review).
Autofix Details
Bugbot Autofix prepared fixes for all 3 issues found in the latest run.
- ✅ Fixed:
replaceonly strips first occurrence of each hash- Replaced hash stripping calls with replaceAll so every occurrence of each integrity hash is removed in GTM and document rewrite paths.
- ✅ Fixed: Redundant duplicate hash stripping for HTML documents
- Removed the second HTML-specific integrity stripping loop and fulfilled HTML responses directly from the already-stripped content.
- ✅ Fixed: Non-HTML fulfill path missing encoding header removal
- Updated the non-HTML fulfill branch to set status and dropped encoding/length headers before returning the decompressed text body.
Or push these changes by commenting:
@cursor push 8a47623b97
Preview (8a47623b97)
diff --git a/e2e/manual-test.js b/e2e/manual-test.js
--- a/e2e/manual-test.js
+++ b/e2e/manual-test.js
@@ -71,7 +71,7 @@
const response = await route.fetch();
let body = await response.text();
for (const hash of INTEGRITY_HASHES) {
- body = body.replace(hash, '');
+ body = body.replaceAll(hash, '');
}
await route.fulfill({
status: response.status(),
@@ -102,23 +102,22 @@
}
let content = await response.text();
for (const hash of INTEGRITY_HASHES) {
- content = content.replace(hash, '');
+ content = content.replaceAll(hash, '');
}
const ct = (response.headers()['content-type'] || '').toLowerCase();
if (!ct.includes('text/html')) {
- return route.fulfill({ response, body: content });
+ return route.fulfill({
+ status: response.status(),
+ headers: dropEncodingHeaders(response.headers()),
+ body: content,
+ });
}
- let html = content;
- for (const hash of INTEGRITY_HASHES) {
- html = html.replace(hash, '');
- }
-
await route.fulfill({
status: response.status(),
headers: dropEncodingHeaders(response.headers()),
- body: html,
+ body: content,
});
});You can send follow-ups to the cloud agent here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 5 total unresolved issues (including 4 from previous reviews).
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Debug console.log accidentally committed in production SDK
- Removed the accidental
console.log('AI WEEK CODING CHANGES')fromAmplitudeBrowser.initso SDK initialization no longer emits debug output.
- Removed the accidental
Or push these changes by commenting:
@cursor push 337b19c541
Preview (337b19c541)
diff --git a/packages/analytics-browser/src/browser-client.ts b/packages/analytics-browser/src/browser-client.ts
--- a/packages/analytics-browser/src/browser-client.ts
+++ b/packages/analytics-browser/src/browser-client.ts
@@ -97,7 +97,6 @@
init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {
let userId: string | undefined;
let options: BrowserOptions | undefined;
- console.log('AI WEEK CODING CHANGES');
if (arguments.length > 2) {
userId = userIdOrOptions as string | undefined;
options = maybeOptions;You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit c6f000e. Configure here.
12033d2 to
e825749
Compare


Summary
Checklist
Note
Low Risk
Adds a new headed Playwright-based manual testing script plus devDependency updates; it does not change shipped SDK/runtime code but introduces new local tooling that could affect developer workflows and repo installs.
Overview
Adds a new
e2e/manual-test.jsheaded Playwright runner that proxies a target website to swap Amplitude CDN bundles for locally served bundles (viapnpm dev:ssh) and strips known SRI integrity hashes to prevent validation failures.The script also supports overriding bundle versions and API keys via env vars, and keeps the browser open for interactive/manual customer-site verification.
Updates repo hygiene by adding
playwrightto devDependencies and ignoring Playwright MCP artifacts in.gitignore, plus adds a Cursor skill doc describing the monorepo workflow and the manual test flow.Reviewed by Cursor Bugbot for commit e825749. Bugbot is set up for automated code reviews on this repo. Configure here.