Skip to content

Commit 8015ae2

Browse files
committed
fix
1 parent 78c09a4 commit 8015ae2

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

  • dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/spotlight-interaction-filter

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/spotlight-interaction-filter/test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff 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');

0 commit comments

Comments
 (0)