MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / scenarioReplay

Function scenarioReplay

apps/api/e2e/session-e2e.ts:193–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

191}
192
193async function scenarioReplay() {
194 scenario('replay chunk files under the echoed session id');
195 const ip = `10.${(runId >> 16) & 255}.3.${runId & 255 || 1}`;
196
197 const { sessionId } = await screenView(ip, '/replay');
198 await track(
199 {
200 type: 'replay',
201 payload: {
202 sessionId,
203 chunk_index: 0,
204 events_count: 1,
205 is_full_snapshot: true,
206 started_at: new Date(runId).toISOString(),
207 ended_at: new Date(runId + 1000).toISOString(),
208 payload: '[]',
209 },
210 },
211 ip
212 );
213
214 const found = await pollUntil(async () => {
215 const rows = await chQuery<{ c: string }>(
216 `SELECT count() AS c FROM session_replay_chunks WHERE project_id = '${PROJECT_ID}' AND session_id = '${sessionId}'`
217 );
218 return Number(rows[0]?.c ?? 0) > 0 ? true : null;
219 });
220 check('clickhouse: replay chunk stored under the session id', !!found);
221}
222
223async function scenarioIdentify() {
224 scenario('identified visit → profile index + profile_id on events');

Callers 1

mainFunction · 0.85

Calls 5

scenarioFunction · 0.90
screenViewFunction · 0.90
trackFunction · 0.90
pollUntilFunction · 0.90
checkFunction · 0.90

Tested by

no test coverage detected