File tree Expand file tree Collapse file tree
dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/spotlight-interaction-filter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,14 +33,22 @@ sentryTest(
3333 const spotlightInteractionSpans = spotlightTransaction . spans ?. filter ( span => span . op === 'ui.interaction.click' ) ;
3434 expect ( spotlightInteractionSpans ) . toHaveLength ( 0 ) ;
3535
36- // Click on the regular button — interaction span should be kept
37- const regularTxnPromise = waitForTransactionRequest ( page , txn => txn . contexts ?. trace ?. op === 'ui.action.click' ) ;
36+ // Let the first idle span fully settle before clicking again
37+ await page . waitForTimeout ( 1000 ) ;
38+
39+ // Click on the regular button — wait specifically for a transaction that contains
40+ // a ui.interaction.click child span, since the PerformanceObserver may deliver
41+ // the event entry asynchronously
42+ const regularTxnPromise = waitForTransactionRequest (
43+ page ,
44+ txn =>
45+ txn . contexts ?. trace ?. op === 'ui.action.click' &&
46+ ( txn . spans ?. some ( span => span . op === 'ui.interaction.click' ) ?? false ) ,
47+ ) ;
3848 await page . locator ( '[data-test-id=regular-button]' ) . click ( ) ;
3949 await page . locator ( '.clicked[data-test-id=regular-button]' ) . isVisible ( ) ;
4050 const regularTransaction = envelopeRequestParser < TransactionEvent > ( await regularTxnPromise ) ;
4151
42- expect ( regularTransaction . contexts ?. trace ?. op ) . toBe ( 'ui.action.click' ) ;
43-
4452 const regularInteractionSpans = regularTransaction . spans ?. filter ( span => span . op === 'ui.interaction.click' ) ;
4553 expect ( regularInteractionSpans ?. length ) . toBeGreaterThanOrEqual ( 1 ) ;
4654 expect ( regularInteractionSpans ! [ 0 ] ! . description ) . toContain ( 'button' ) ;
You can’t perform that action at this time.
0 commit comments