Skip to content

Commit 8937484

Browse files
committed
change waitforfunction to await envelopereq
1 parent 42e57dd commit 8937484

File tree

1 file changed

+4
-7
lines changed
  • dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/async-spans

1 file changed

+4
-7
lines changed

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/async-spans/test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/types';
23
import { sentryTest } from '../../../../utils/fixtures';
4+
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
35

46
type WindowWithSpan = Window & {
57
firstWaitingSpan: any;
@@ -13,13 +15,8 @@ sentryTest(
1315
const url = await getLocalTestPath({ testDir: __dirname });
1416
await page.goto(url);
1517

16-
await page.waitForFunction(
17-
() =>
18-
typeof window !== 'undefined' &&
19-
(window as unknown as WindowWithSpan).firstWaitingSpan &&
20-
(window as unknown as WindowWithSpan).secondWaitingSpan &&
21-
(window as unknown as WindowWithSpan).thirdWaitingSpan,
22-
);
18+
const envelope = await getFirstSentryEnvelopeRequest<Event>(page);
19+
expect(envelope).toBeDefined();
2320

2421
const firstWaitingSpanValue = await page.evaluate(
2522
() => (window as unknown as WindowWithSpan).firstWaitingSpan._name,

0 commit comments

Comments
 (0)