Skip to content

Commit 78c09a4

Browse files
committed
use different helper
1 parent 92ae4ac commit 78c09a4

1 file changed

Lines changed: 8 additions & 10 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: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { expect } from '@playwright/test';
2-
import type { Event as SentryEvent } from '@sentry/core';
2+
import type { TransactionEvent } from '@sentry/core';
33
import { sentryTest } from '../../../../utils/fixtures';
44
import {
5-
getFirstSentryEnvelopeRequest,
6-
getMultipleSentryEnvelopeRequests,
5+
envelopeRequestParser,
76
shouldSkipCdnBundleTest,
87
shouldSkipTracingTest,
8+
waitForTransactionRequest,
99
} from '../../../../utils/helpers';
1010

1111
sentryTest(
@@ -20,27 +20,25 @@ sentryTest(
2020
await page.goto(url);
2121

2222
// Wait for the pageload transaction to complete
23-
await getFirstSentryEnvelopeRequest<SentryEvent>(page);
23+
await waitForTransactionRequest(page);
2424

2525
// Click on the spotlight element — interaction span should be filtered
26-
const spotlightEnvelopePromise = getMultipleSentryEnvelopeRequests<SentryEvent>(page, 1);
26+
const spotlightTxnPromise = waitForTransactionRequest(page, txn => txn.contexts?.trace?.op === 'ui.action.click');
2727
await page.locator('[data-test-id=spotlight-button]').click();
2828
await page.locator('.clicked[data-test-id=spotlight-button]').isVisible();
29-
const [spotlightTransaction] = await spotlightEnvelopePromise;
29+
const spotlightTransaction = envelopeRequestParser<TransactionEvent>(await spotlightTxnPromise);
3030

31-
expect(spotlightTransaction.type).toBe('transaction');
3231
expect(spotlightTransaction.contexts?.trace?.op).toBe('ui.action.click');
3332

3433
const spotlightInteractionSpans = spotlightTransaction.spans?.filter(span => span.op === 'ui.interaction.click');
3534
expect(spotlightInteractionSpans).toHaveLength(0);
3635

3736
// Click on the regular button — interaction span should be kept
38-
const regularEnvelopePromise = getMultipleSentryEnvelopeRequests<SentryEvent>(page, 1);
37+
const regularTxnPromise = waitForTransactionRequest(page, txn => txn.contexts?.trace?.op === 'ui.action.click');
3938
await page.locator('[data-test-id=regular-button]').click();
4039
await page.locator('.clicked[data-test-id=regular-button]').isVisible();
41-
const [regularTransaction] = await regularEnvelopePromise;
40+
const regularTransaction = envelopeRequestParser<TransactionEvent>(await regularTxnPromise);
4241

43-
expect(regularTransaction.type).toBe('transaction');
4442
expect(regularTransaction.contexts?.trace?.op).toBe('ui.action.click');
4543

4644
const regularInteractionSpans = regularTransaction.spans?.filter(span => span.op === 'ui.interaction.click');

0 commit comments

Comments
 (0)