1
1
import { expect , Page } from '@playwright/test' ;
2
+ import { Event } from '@sentry/types' ;
2
3
3
4
import { sentryTest } from '../../../../utils/fixtures' ;
4
- import { getSentryTransactionRequest } from '../../../../utils/helpers' ;
5
+ import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers' ;
5
6
6
7
sentryTest . beforeEach ( ( { browserName } ) => {
7
8
if ( browserName !== 'chromium' ) {
@@ -23,7 +24,7 @@ async function createSessionWithLatency(page: Page, latency: number) {
23
24
24
25
sentryTest ( 'should capture a `connection.rtt` metric.' , async ( { getLocalTestPath, page } ) => {
25
26
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
26
- const eventData = await getSentryTransactionRequest ( page , url ) ;
27
+ const eventData = await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
27
28
28
29
expect ( eventData . measurements ) . toBeDefined ( ) ;
29
30
expect ( eventData . measurements ?. [ 'connection.rtt' ] ?. value ) . toBe ( 0 ) ;
@@ -35,7 +36,7 @@ sentryTest(
35
36
const session = await createSessionWithLatency ( page , 200 ) ;
36
37
37
38
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
38
- const eventData = await getSentryTransactionRequest ( page , url ) ;
39
+ const eventData = await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
39
40
40
41
await session . detach ( ) ;
41
42
@@ -50,7 +51,7 @@ sentryTest(
50
51
const session = await createSessionWithLatency ( page , 100 ) ;
51
52
52
53
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
53
- const eventData = await getSentryTransactionRequest ( page , url ) ;
54
+ const eventData = await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
54
55
55
56
await session . detach ( ) ;
56
57
@@ -65,7 +66,7 @@ sentryTest(
65
66
const session = await createSessionWithLatency ( page , 50 ) ;
66
67
67
68
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
68
- const eventData = await getSentryTransactionRequest ( page , url ) ;
69
+ const eventData = await getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
69
70
70
71
await session . detach ( ) ;
71
72
0 commit comments