| 191 | } |
| 192 | |
| 193 | async 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 | |
| 223 | async function scenarioIdentify() { |
| 224 | scenario('identified visit → profile index + profile_id on events'); |