1
1
import type { Route } from '@playwright/test' ;
2
2
import { expect } from '@playwright/test' ;
3
- import type { Contexts , Event as SentryEvent , Measurements , SpanJSON } from '@sentry/types' ;
3
+ import type { Contexts , Event as SentryEvent , SpanJSON } from '@sentry/types' ;
4
4
5
5
import { sentryTest } from '../../../../utils/fixtures' ;
6
6
import {
@@ -132,17 +132,21 @@ sentryTest('should capture an INP click event span. @firefox', async ({ browserN
132
132
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
133
133
134
134
await page . goto ( url ) ;
135
- await getFirstSentryEnvelopeRequest < SentryEvent > ( page ) ;
135
+ await getFirstSentryEnvelopeRequest < SentryEvent > ( page ) ; // waiting for page load
136
+
137
+ const spanEnvelopesPromise = getMultipleSentryEnvelopeRequests < SpanJSON > ( page , 1 , {
138
+ envelopeType : 'span' ,
139
+ } ) ;
136
140
137
141
await page . locator ( '[data-test-id=interaction-button]' ) . click ( ) ;
138
142
await page . locator ( '.clicked[data-test-id=interaction-button]' ) . isVisible ( ) ;
139
143
140
- // Wait for the interaction transaction from the enableInteractions experiment
144
+ // eslint-disable-next-line no-console
145
+ console . log ( 'buttons clicked' ) ;
146
+
147
+ // Wait for the interaction transaction from the experimental enableInteractions (in init.js)
141
148
await getMultipleSentryEnvelopeRequests < TransactionJSON > ( page , 1 ) ;
142
149
143
- const spanEnvelopesPromise = getMultipleSentryEnvelopeRequests < SpanJSON > ( page , 1 , {
144
- envelopeType : 'span' ,
145
- } ) ;
146
150
// Page hide to trigger INP
147
151
await page . evaluate ( ( ) => {
148
152
window . dispatchEvent ( new Event ( 'pagehide' ) ) ;
@@ -151,7 +155,9 @@ sentryTest('should capture an INP click event span. @firefox', async ({ browserN
151
155
// Get the INP span envelope
152
156
const spanEnvelopes = await spanEnvelopesPromise ;
153
157
154
- expect ( spanEnvelopes ) . toHaveLength ( 1 ) ;
158
+ // eslint-disable-next-line no-console
159
+ console . log ( 'spanevents' , spanEnvelopes ) ;
160
+
155
161
expect ( spanEnvelopes [ 0 ] . op ) . toBe ( 'ui.interaction.click' ) ;
156
162
expect ( spanEnvelopes [ 0 ] . description ) . toBe ( 'body > button.clicked' ) ;
157
163
expect ( spanEnvelopes [ 0 ] . exclusive_time ) . toBeGreaterThan ( 0 ) ;
0 commit comments