@@ -2,18 +2,29 @@ import { expect } from '@playwright/test';
2
2
import type { Event } from '@sentry/types' ;
3
3
4
4
import { sentryTest } from '../../../utils/fixtures' ;
5
- import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers' ;
5
+ import { envelopeRequestParser , getFirstSentryEnvelopeRequest , waitForErrorRequestOnUrl } from '../../../utils/helpers' ;
6
6
7
7
sentryTest (
8
8
'should add source context lines around stack frames from errors in Html inline JS' ,
9
- async ( { getLocalTestPath, page } ) => {
9
+ async ( { getLocalTestPath, page, browserName } ) => {
10
+ if ( browserName === 'webkit' ) {
11
+ // The error we're throwing in this test is thrown as "Script error." in Webkit.
12
+ // We filter "Script error." out by default in `InboundFilters`.
13
+ // I don't think there's much value to disable InboundFilters defaults for this test,
14
+ // given that most of our users won't do that either.
15
+ // Let's skip it instead for Webkit.
16
+ sentryTest . skip ( ) ;
17
+ }
18
+
10
19
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
11
20
12
- const eventPromise = getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
21
+ const eventReqPromise = waitForErrorRequestOnUrl ( page , url ) ;
13
22
14
23
const clickPromise = page . click ( '#inline-error-btn' ) ;
15
24
16
- const [ eventData ] = await Promise . all ( [ eventPromise , clickPromise ] ) ;
25
+ const [ req ] = await Promise . all ( [ eventReqPromise , clickPromise ] ) ;
26
+
27
+ const eventData = envelopeRequestParser ( req ) ;
17
28
18
29
expect ( eventData . exception ?. values ) . toHaveLength ( 1 ) ;
19
30
@@ -41,11 +52,14 @@ sentryTest(
41
52
sentryTest ( 'should not add source context lines to errors from script files' , async ( { getLocalTestPath, page } ) => {
42
53
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
43
54
44
- const eventPromise = getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
55
+ const eventReqPromise = waitForErrorRequestOnUrl ( page , url ) ;
56
+
57
+ const clickPromise = page . click ( '#script-error-btn' ) ;
58
+
59
+ const [ req ] = await Promise . all ( [ eventReqPromise , clickPromise ] ) ;
45
60
46
- await page . click ( '#script-error-btn' ) ;
61
+ const eventData = envelopeRequestParser ( req ) ;
47
62
48
- const eventData = await eventPromise ;
49
63
const exception = eventData . exception ?. values ?. [ 0 ] ;
50
64
const frames = exception ?. stacktrace ?. frames ;
51
65
expect ( frames ) . toHaveLength ( 1 ) ;
0 commit comments