ConusAI vendor v0.1.0-dev.20261013+85463d22
This commit is contained in:
parent
c3c6526952
commit
0da8a2a81b
@@ -0,0 +1,40 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
|
||||
// Proves, against a real production build (next build + next start, plan D18), that a
|
||||
// visit actually uploads a session replay segment — not just that the SDK is configured
|
||||
// to try. instrumentation-client.ts's /api/_conusai/* calls are same-origin and answered
|
||||
// by the platform's edge on a real deployment (docs/how-to/use-platform-analytics-in-an-
|
||||
// app.md §"Why this works"); this app has no edge in front of it here, so the test stands
|
||||
// in for it with the minimum the SDK needs: a session id from /ids, and a place to post
|
||||
// the envelope. This caught the stage regression (2026-10-11, showcase plan D24) where
|
||||
// mode: 'always' alone produced zero /api/_conusai/envelope requests because replay is a
|
||||
// 'consented' item and the default consent mode never sends those.
|
||||
|
||||
const SESSION_ID = '11111111-1111-1111-1111-111111111111'
|
||||
|
||||
test('a visit uploads a session replay segment within 15 s on a production build', async ({ page }) => {
|
||||
let envelopePosts = 0
|
||||
|
||||
// Analytics, vitals and errors also call the same-origin /api/_conusai/* paths; answer
|
||||
// them all generically so the run is quiet and deterministic, except the two the
|
||||
// recorder actually needs.
|
||||
await page.route('**/api/_conusai/**', (route) => {
|
||||
const url = route.request().url()
|
||||
if (url.includes('/api/_conusai/ids')) {
|
||||
return route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ v: 1, session_id: SESSION_ID }) })
|
||||
}
|
||||
if (url.includes('/api/_conusai/envelope')) {
|
||||
envelopePosts += 1
|
||||
return route.fulfill({ status: 200, contentType: 'application/json', body: '{}' })
|
||||
}
|
||||
return route.fulfill({ status: 200, contentType: 'application/json', body: '{}' })
|
||||
})
|
||||
|
||||
await page.goto('/')
|
||||
await page.getByLabel('Title').click()
|
||||
await page.mouse.wheel(0, 200)
|
||||
await page.goto('/audit')
|
||||
await page.goto('/')
|
||||
|
||||
await expect.poll(() => envelopePosts, { timeout: 15_000, message: 'no POST to /api/_conusai/envelope (replay segment)' }).toBeGreaterThan(0)
|
||||
})
|
||||
Reference in New Issue
Block a user