11import { expect , test } from '@playwright/test' ;
22import { waitForTransaction } from '@sentry-internal/test-utils' ;
33
4- test ( 'should not automatically create transactions for routes that were excluded from auto wrapping (string)' , async ( {
4+ test ( 'should not apply build-time instrumentation for routes that were excluded from auto wrapping (string)' , async ( {
55 request,
66} ) => {
77 const transactionPromise = waitForTransaction ( 'nextjs-13' , async transactionEvent => {
@@ -13,17 +13,13 @@ test('should not automatically create transactions for routes that were excluded
1313
1414 expect ( await ( await request . get ( `/api/endpoint-excluded-with-string` ) ) . text ( ) ) . toBe ( '{"success":true}' ) ;
1515
16- let transactionPromiseReceived = false ;
17- transactionPromise . then ( ( ) => {
18- transactionPromiseReceived = true ;
19- } ) ;
20-
21- await new Promise ( resolve => setTimeout ( resolve , 5_000 ) ) ;
16+ const transaction = await transactionPromise ;
2217
23- expect ( transactionPromiseReceived ) . toBe ( false ) ;
18+ expect ( transaction . contexts ?. trace ?. data ?. [ 'sentry.origin' ] ) . toBeDefined ( ) ;
19+ expect ( transaction . contexts ?. trace ?. data ?. [ 'sentry.origin' ] ) . not . toBe ( 'auto.http.nextjs' ) ; // This is the origin set by the build time instrumentation
2420} ) ;
2521
26- test ( 'should not automatically create transactions for routes that were excluded from auto wrapping (regex)' , async ( {
22+ test ( 'should not apply build-time instrumentation for routes that were excluded from auto wrapping (regex)' , async ( {
2723 request,
2824} ) => {
2925 const transactionPromise = waitForTransaction ( 'nextjs-13' , async transactionEvent => {
@@ -35,12 +31,8 @@ test('should not automatically create transactions for routes that were excluded
3531
3632 expect ( await ( await request . get ( `/api/endpoint-excluded-with-regex` ) ) . text ( ) ) . toBe ( '{"success":true}' ) ;
3733
38- let transactionPromiseReceived = false ;
39- transactionPromise . then ( ( ) => {
40- transactionPromiseReceived = true ;
41- } ) ;
42-
43- await new Promise ( resolve => setTimeout ( resolve , 5_000 ) ) ;
34+ const transaction = await transactionPromise ;
4435
45- expect ( transactionPromiseReceived ) . toBe ( false ) ;
36+ expect ( transaction . contexts ?. trace ?. data ?. [ 'sentry.origin' ] ) . toBeDefined ( ) ;
37+ expect ( transaction . contexts ?. trace ?. data ?. [ 'sentry.origin' ] ) . not . toBe ( 'auto.http.nextjs' ) ; // This is the origin set by the build time instrumentation
4638} ) ;
0 commit comments