@@ -4,57 +4,62 @@ import type { Event } from '@sentry/types';
4
4
import { sentryTest } from '../../../../../utils/fixtures' ;
5
5
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers' ;
6
6
7
- sentryTest ( 'captures Breadcrumb for clicks & debounces them for a second' , async ( { getLocalTestUrl, page } ) => {
8
- const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
9
-
10
- await page . route ( '**/foo' , route => {
11
- return route . fulfill ( {
12
- status : 200 ,
13
- body : JSON . stringify ( {
14
- userNames : [ 'John' , 'Jane' ] ,
15
- } ) ,
16
- headers : {
17
- 'Content-Type' : 'application/json' ,
18
- } ,
7
+ sentryTest (
8
+ 'captures Breadcrumb for clicks & debounces them for a second' ,
9
+ async ( { getLocalTestUrl, page, browserName } ) => {
10
+ sentryTest . skip ( browserName === 'chromium' , 'This consistently flakes on chrome.' ) ;
11
+
12
+ const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
13
+
14
+ await page . route ( '**/foo' , route => {
15
+ return route . fulfill ( {
16
+ status : 200 ,
17
+ body : JSON . stringify ( {
18
+ userNames : [ 'John' , 'Jane' ] ,
19
+ } ) ,
20
+ headers : {
21
+ 'Content-Type' : 'application/json' ,
22
+ } ,
23
+ } ) ;
19
24
} ) ;
20
- } ) ;
21
-
22
- const promise = getFirstSentryEnvelopeRequest < Event > ( page ) ;
23
-
24
- await page . goto ( url ) ;
25
-
26
- await page . click ( '#button1' ) ;
27
- // not debounced because other target
28
- await page . click ( '#button2' ) ;
29
- // This should be debounced
30
- await page . click ( '#button2' ) ;
31
-
32
- // Wait a second for the debounce to finish
33
- await page . waitForTimeout ( 1000 ) ;
34
- await page . click ( '#button2' ) ;
35
-
36
- const [ eventData ] = await Promise . all ( [ promise , page . evaluate ( 'Sentry.captureException("test exception")' ) ] ) ;
37
-
38
- expect ( eventData . exception ?. values ) . toHaveLength ( 1 ) ;
39
-
40
- expect ( eventData . breadcrumbs ) . toEqual ( [
41
- {
42
- timestamp : expect . any ( Number ) ,
43
- category : 'ui.click ' ,
44
- message : 'body > button#button1[type="button"]' ,
45
- } ,
46
- {
47
- timestamp : expect . any ( Number ) ,
48
- category : 'ui.click ' ,
49
- message : 'body > button#button2[type="button"]' ,
50
- } ,
51
- {
52
- timestamp : expect . any ( Number ) ,
53
- category : 'ui.click ' ,
54
- message : 'body > button#button2[type="button"]' ,
55
- } ,
56
- ] ) ;
57
- } ) ;
25
+
26
+ const promise = getFirstSentryEnvelopeRequest < Event > ( page ) ;
27
+
28
+ await page . goto ( url ) ;
29
+
30
+ await page . click ( '#button1' ) ;
31
+ // not debounced because other target
32
+ await page . click ( '#button2' ) ;
33
+ // This should be debounced
34
+ await page . click ( '#button2' ) ;
35
+
36
+ // Wait a second for the debounce to finish
37
+ await page . waitForTimeout ( 1000 ) ;
38
+ await page . click ( '#button2' ) ;
39
+
40
+ const [ eventData ] = await Promise . all ( [ promise , page . evaluate ( 'Sentry.captureException("test exception")' ) ] ) ;
41
+
42
+ expect ( eventData . exception ?. values ) . toHaveLength ( 1 ) ;
43
+
44
+ expect ( eventData . breadcrumbs ) . toEqual ( [
45
+ {
46
+ timestamp : expect . any ( Number ) ,
47
+ category : 'ui.click' ,
48
+ message : 'body > button#button1[type="button"] ' ,
49
+ } ,
50
+ {
51
+ timestamp : expect . any ( Number ) ,
52
+ category : 'ui.click' ,
53
+ message : 'body > button#button2[type="button"] ' ,
54
+ } ,
55
+ {
56
+ timestamp : expect . any ( Number ) ,
57
+ category : 'ui.click' ,
58
+ message : 'body > button#button2[type="button"] ' ,
59
+ } ,
60
+ ] ) ;
61
+ } ,
62
+ ) ;
58
63
59
64
sentryTest (
60
65
'uses the annotated component name in the breadcrumb messages and adds it to the data object' ,
0 commit comments