@@ -2,18 +2,29 @@ import { expect } from '@playwright/test';
22import type { Event } from '@sentry/types' ;
33
44import { sentryTest } from '../../../utils/fixtures' ;
5- import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers' ;
5+ import { envelopeRequestParser , getFirstSentryEnvelopeRequest , waitForErrorRequestOnUrl } from '../../../utils/helpers' ;
66
77sentryTest (
88 '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+
1019 const url = await getLocalTestPath ( { testDir : __dirname } ) ;
1120
12- const eventPromise = getFirstSentryEnvelopeRequest < Event > ( page , url ) ;
21+ const eventReqPromise = waitForErrorRequestOnUrl ( page , url ) ;
1322
1423 const clickPromise = page . click ( '#inline-error-btn' ) ;
1524
16- const [ eventData ] = await Promise . all ( [ eventPromise , clickPromise ] ) ;
25+ const [ req ] = await Promise . all ( [ eventReqPromise , clickPromise ] ) ;
26+
27+ const eventData = envelopeRequestParser ( req ) ;
1728
1829 expect ( eventData . exception ?. values ) . toHaveLength ( 1 ) ;
1930
@@ -41,11 +52,14 @@ sentryTest(
4152sentryTest ( 'should not add source context lines to errors from script files' , async ( { getLocalTestPath, page } ) => {
4253 const url = await getLocalTestPath ( { testDir : __dirname } ) ;
4354
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 ] ) ;
4560
46- await page . click ( '#script-error-btn' ) ;
61+ const eventData = envelopeRequestParser ( req ) ;
4762
48- const eventData = await eventPromise ;
4963 const exception = eventData . exception ?. values ?. [ 0 ] ;
5064 const frames = exception ?. stacktrace ?. frames ;
5165 expect ( frames ) . toHaveLength ( 1 ) ;
0 commit comments