Skip to content

Commit 40c056f

Browse files
committed
only run in tracing tests
1 parent a7037ae commit 40c056f

File tree

2 files changed

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

2 files changed

+12
-8
lines changed

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/async-spans/subject.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import { getActiveSpan, startSpan } from '@sentry/browser';
1+
import { getActiveSpan, spanToJSON, startSpan } from '@sentry/browser';
22

33
const waitForSeconds = seconds => new Promise(res => setTimeout(res, seconds * 1000));
44

55
startSpan({ name: 'span 1' }, async () => {
66
await waitForSeconds(1);
7-
window.firstWaitingSpan = getActiveSpan();
7+
window.firstWaitingSpan = spanToJSON(getActiveSpan());
88
});
99

1010
startSpan({ name: 'span 2' }, async () => {
1111
await waitForSeconds(2);
12-
window.secondWaitingSpan = getActiveSpan();
12+
window.secondWaitingSpan = spanToJSON(getActiveSpan());
1313
});
1414

1515
startSpan({ name: 'span 3' }, async () => {
1616
await waitForSeconds(0.5);
17-
window.thirdWaitingSpan = getActiveSpan();
17+
window.thirdWaitingSpan = spanToJSON(getActiveSpan());
1818
});
1919

2020
/**

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

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

66
type WindowWithSpan = Window & {
77
firstWaitingSpan: any;
@@ -12,20 +12,24 @@ type WindowWithSpan = Window & {
1212
sentryTest(
1313
'async spans with different durations lead to unexpected behavior in browser (no "asynchronous context tracking")',
1414
async ({ getLocalTestPath, page }) => {
15+
if (shouldSkipTracingTest()) {
16+
sentryTest.skip();
17+
}
18+
1519
const url = await getLocalTestPath({ testDir: __dirname });
1620
await page.goto(url);
1721

1822
const envelope = await getFirstSentryEnvelopeRequest<Event>(page);
1923
expect(envelope).toBeDefined();
2024

2125
const firstWaitingSpanValue = await page.evaluate(
22-
() => (window as unknown as WindowWithSpan).firstWaitingSpan._name,
26+
() => (window as unknown as WindowWithSpan).firstWaitingSpan.description,
2327
);
2428
const secondWaitingSpanName = await page.evaluate(
25-
() => (window as unknown as WindowWithSpan).secondWaitingSpan._name,
29+
() => (window as unknown as WindowWithSpan).secondWaitingSpan.description,
2630
);
2731
const thirdWaitingSpanName = await page.evaluate(
28-
() => (window as unknown as WindowWithSpan).thirdWaitingSpan._name,
32+
() => (window as unknown as WindowWithSpan).thirdWaitingSpan.description,
2933
);
3034

3135
expect(firstWaitingSpanValue).toBe('span 2');

0 commit comments

Comments
 (0)