@@ -31,33 +31,20 @@ sentryTest('should capture an INP click event span.', async ({ browserName, getL
31
31
await getFirstSentryEnvelopeRequest < SentryEvent > ( page ) ; // wait for page load
32
32
33
33
const spanEnvelopesPromise = getMultipleSentryEnvelopeRequests < SpanJSON > ( page , 1 , {
34
- // envelopeType: 'span', // todo: does not work with envelopType
34
+ // envelopeType: 'span', // todo: does not work with envelopeType
35
35
} ) ;
36
36
37
- await page . locator ( '[data-test-id=interaction-button]' ) . click ( ) ;
38
- await page . locator ( '.clicked[data-test-id=interaction-button]' ) . isVisible ( ) ;
39
-
40
- // eslint-disable-next-line no-console
41
- console . log ( 'buttons clicked' ) ;
37
+ await page . locator ( '[data-test-id=normal-button]' ) . click ( ) ;
38
+ await page . locator ( '.clicked[data-test-id=normal-button]' ) . isVisible ( ) ;
42
39
43
40
// Page hide to trigger INP
44
41
await page . evaluate ( ( ) => {
45
- // eslint-disable-next-line no-console
46
- console . log ( 'dispatching event' ) ;
47
42
window . dispatchEvent ( new Event ( 'pagehide' ) ) ;
48
43
} ) ;
49
44
50
- // eslint-disable-next-line no-console
51
- console . log ( 'event dispatched' ) ;
52
-
53
45
// Get the INP span envelope
54
46
const spanEnvelopes = await spanEnvelopesPromise ;
55
47
56
- // eslint-disable-next-line no-console
57
- console . log ( 'waited for envelope' ) ;
58
-
59
- // expect(spanEnvelopes).toBe(1);
60
-
61
48
expect ( spanEnvelopes ) . toHaveLength ( 1 ) ;
62
49
expect ( spanEnvelopes [ 0 ] . op ) . toBe ( 'ui.interaction.click' ) ;
63
50
expect ( spanEnvelopes [ 0 ] . description ) . toBe ( 'body > button.clicked' ) ;
@@ -92,38 +79,28 @@ sentryTest(
92
79
await getFirstSentryEnvelopeRequest < SentryEvent > ( page ) ;
93
80
94
81
const spanEnvelopesPromise = getMultipleSentryEnvelopeRequests < SpanJSON > ( page , 1 , {
95
- // envelopeType: 'span',
82
+ // envelopeType: 'span', // todo: does not work with envelopeType
96
83
} ) ;
97
84
98
- await page . locator ( '[data-test-id=interaction -button]' ) . click ( ) ;
99
- await page . locator ( '.clicked[data-test-id=interaction -button]' ) . isVisible ( ) ;
85
+ await page . locator ( '[data-test-id=normal -button]' ) . click ( ) ;
86
+ await page . locator ( '.clicked[data-test-id=normal -button]' ) . isVisible ( ) ;
100
87
101
- // eslint-disable-next-line no-console
102
- console . log ( '2 - clicked first time' ) ;
103
-
104
- await page . locator ( '[data-test-id=slow-interaction-button]' ) . click ( ) ;
105
- await page . locator ( '.clicked[data-test-id=slow-interaction-button]' ) . isVisible ( ) ;
106
-
107
- // eslint-disable-next-line no-console
108
- console . log ( '2 - clicked second time' ) ;
88
+ await page . locator ( '[data-test-id=slow-button]' ) . click ( ) ;
89
+ await page . locator ( '.clicked[data-test-id=slow-button]' ) . isVisible ( ) ;
109
90
110
91
// Page hide to trigger INP
111
92
await page . evaluate ( ( ) => {
112
93
window . dispatchEvent ( new Event ( 'pagehide' ) ) ;
113
94
} ) ;
114
95
115
- // eslint-disable-next-line no-console
116
- console . log ( '2 - dispatched event' ) ;
117
-
118
96
// Get the INP span envelope
119
97
const spanEnvelopes = await spanEnvelopesPromise ;
120
98
121
- // expect(spanEnvelopes).toBe(2);
122
99
expect ( spanEnvelopes ) . toHaveLength ( 1 ) ;
123
100
expect ( spanEnvelopes [ 0 ] . op ) . toBe ( 'ui.interaction.click' ) ;
124
101
expect ( spanEnvelopes [ 0 ] . description ) . toBe ( 'body > button.clicked' ) ;
125
- expect ( spanEnvelopes [ 0 ] . exclusive_time ) . toBeGreaterThan ( 150 ) ;
126
- expect ( spanEnvelopes [ 0 ] . measurements ?. inp . value ) . toBeGreaterThan ( 150 ) ;
102
+ expect ( spanEnvelopes [ 0 ] . exclusive_time ) . toBeGreaterThan ( 400 ) ;
103
+ expect ( spanEnvelopes [ 0 ] . measurements ?. inp . value ) . toBeGreaterThan ( 400 ) ;
127
104
expect ( spanEnvelopes [ 0 ] . measurements ?. inp . unit ) . toBe ( 'millisecond' ) ;
128
105
} ,
129
106
) ;
0 commit comments