Skip to content

Commit 5522112

Browse files
committed
fix serialized event
1 parent 6aa5ccf commit 5522112

File tree

8 files changed

+20
-28
lines changed
  • dev-packages/browser-integration-tests/suites/tracing

8 files changed

+20
-28
lines changed

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-disabled/test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Route } from '@playwright/test';
22
import { expect } from '@playwright/test';
3-
import type { Event } from '@sentry/types';
3+
import type { SerializedEvent } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
66
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -15,8 +15,7 @@ sentryTest('should not capture long task when flag is disabled.', async ({ brows
1515

1616
const url = await getLocalTestPath({ testDir: __dirname });
1717

18-
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
19-
// eslint-disable-next-line deprecation/deprecation
18+
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
2019
const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui'));
2120

2221
expect(uiSpans?.length).toBe(0);

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-enabled/test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Route } from '@playwright/test';
22
import { expect } from '@playwright/test';
3-
import type { Event } from '@sentry/types';
3+
import type { SerializedEvent } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
66
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -15,8 +15,7 @@ sentryTest('should capture long task.', async ({ browserName, getLocalTestPath,
1515

1616
const url = await getLocalTestPath({ testDir: __dirname });
1717

18-
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
19-
// eslint-disable-next-line deprecation/deprecation
18+
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
2019
const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui'));
2120

2221
expect(uiSpans?.length).toBeGreaterThan(0);
@@ -29,8 +28,8 @@ sentryTest('should capture long task.', async ({ browserName, getLocalTestPath,
2928
parent_span_id: eventData.contexts?.trace?.span_id,
3029
}),
3130
);
32-
const start = (firstUISpan as Event)['start_timestamp'] ?? 0;
33-
const end = (firstUISpan as Event)['timestamp'] ?? 0;
31+
const start = firstUISpan.start_timestamp ?? 0;
32+
const end = firstUISpan.timestamp ?? 0;
3433
const duration = end - start;
3534

3635
expect(duration).toBeGreaterThanOrEqual(0.1);

dev-packages/browser-integration-tests/suites/tracing/browsertracing/long-tasks-disabled/test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Route } from '@playwright/test';
22
import { expect } from '@playwright/test';
3-
import type { Event } from '@sentry/types';
3+
import type { SerializedEvent } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
66
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -15,8 +15,7 @@ sentryTest('should not capture long task when flag is disabled.', async ({ brows
1515

1616
const url = await getLocalTestPath({ testDir: __dirname });
1717

18-
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
19-
// eslint-disable-next-line deprecation/deprecation
18+
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
2019
const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui'));
2120

2221
expect(uiSpans?.length).toBe(0);

dev-packages/browser-integration-tests/suites/tracing/browsertracing/long-tasks-enabled/test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Route } from '@playwright/test';
22
import { expect } from '@playwright/test';
3-
import type { Event } from '@sentry/types';
3+
import type { SerializedEvent } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
66
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -15,8 +15,7 @@ sentryTest('should capture long task.', async ({ browserName, getLocalTestPath,
1515

1616
const url = await getLocalTestPath({ testDir: __dirname });
1717

18-
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
19-
// eslint-disable-next-line deprecation/deprecation
18+
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
2019
const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui'));
2120

2221
expect(uiSpans?.length).toBeGreaterThan(0);
@@ -29,8 +28,8 @@ sentryTest('should capture long task.', async ({ browserName, getLocalTestPath,
2928
parent_span_id: eventData.contexts?.trace?.span_id,
3029
}),
3130
);
32-
const start = (firstUISpan as Event)['start_timestamp'] ?? 0;
33-
const end = (firstUISpan as Event)['timestamp'] ?? 0;
31+
const start = firstUISpan.start_timestamp ?? 0;
32+
const end = firstUISpan.timestamp ?? 0;
3433
const duration = end - start;
3534

3635
expect(duration).toBeGreaterThanOrEqual(0.1);

dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-browser-spans/test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import type { Event } from '@sentry/types';
2+
import type { SerializedEvent } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -11,8 +11,7 @@ sentryTest('should add browser-related spans to pageload transaction', async ({
1111

1212
const url = await getLocalTestPath({ testDir: __dirname });
1313

14-
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
15-
// eslint-disable-next-line deprecation/deprecation
14+
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
1615
const browserSpans = eventData.spans?.filter(({ op }) => op === 'browser');
1716

1817
// Spans `connect`, `cache` and `DNS` are not always inside `pageload` transaction.

dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Route } from '@playwright/test';
22
import { expect } from '@playwright/test';
3-
import type { Event } from '@sentry/types';
3+
import type { SerializedEvent } from '@sentry/types';
44

55
import { sentryTest } from '../../../../utils/fixtures';
66
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -17,8 +17,7 @@ sentryTest('should add resource spans to pageload transaction', async ({ getLoca
1717

1818
const url = await getLocalTestPath({ testDir: __dirname });
1919

20-
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
21-
// eslint-disable-next-line deprecation/deprecation
20+
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
2221
const resourceSpans = eventData.spans?.filter(({ op }) => op?.startsWith('resource'));
2322

2423
// Webkit 16.0 (which is linked to Playwright 1.27.1) consistently creates 2 consectutive spans for `css`,

dev-packages/browser-integration-tests/suites/tracing/request/fetch/test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import type { Event } from '@sentry/types';
2+
import type { SerializedEvent } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
55
import { getMultipleSentryEnvelopeRequests, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -21,10 +21,9 @@ sentryTest('should create spans for multiple fetch requests', async ({ getLocalT
2121
// If we are on FF or webkit:
2222
// 1st envelope contains CORS error
2323
// 2nd envelope contains the tracing data we want to check here
24-
const envelopes = await getMultipleSentryEnvelopeRequests<Event>(page, 2, { url, timeout: 10000 });
24+
const envelopes = await getMultipleSentryEnvelopeRequests<SerializedEvent>(page, 2, { url, timeout: 10000 });
2525
const tracingEvent = envelopes[envelopes.length - 1]; // last envelope contains tracing data on all browsers
2626

27-
// eslint-disable-next-line deprecation/deprecation
2827
const requestSpans = tracingEvent.spans?.filter(({ op }) => op === 'http.client');
2928

3029
expect(requestSpans).toHaveLength(3);

dev-packages/browser-integration-tests/suites/tracing/request/xhr/test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import type { Event } from '@sentry/types';
2+
import type { SerializedEvent } from '@sentry/types';
33

44
import { sentryTest } from '../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers';
@@ -11,8 +11,7 @@ sentryTest('should create spans for multiple XHR requests', async ({ getLocalTes
1111

1212
const url = await getLocalTestPath({ testDir: __dirname });
1313

14-
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
15-
// eslint-disable-next-line deprecation/deprecation
14+
const eventData = await getFirstSentryEnvelopeRequest<SerializedEvent>(page, url);
1615
const requestSpans = eventData.spans?.filter(({ op }) => op === 'http.client');
1716

1817
expect(requestSpans).toHaveLength(3);

0 commit comments

Comments
 (0)