Skip to content

Commit f62e2c3

Browse files
committed
Update integration tests.
1 parent 019d791 commit f62e2c3

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

packages/remix/test/integration/app/root.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import type { MetaFunction } from '@remix-run/node';
22
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react';
33
import { withSentry } from '@sentry/remix';
44

5-
export const meta: MetaFunction = () => ({
5+
export const meta: MetaFunction = ({ data }) => ({
66
charset: 'utf-8',
77
title: 'New Remix App',
88
viewport: 'width=device-width,initial-scale=1',
9+
'sentry-trace': data.sentryTrace,
10+
baggage: data.sentryBaggage,
911
});
1012

1113
function App() {

packages/remix/test/integration/test/client/meta-tags.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { test, expect } from '@playwright/test';
2+
import { getFirstSentryEnvelopeRequest } from './utils/helpers';
3+
import { Event } from '@sentry/types';
24

35
test('should inject `sentry-trace` and `baggage` meta tags inside the root page.', async ({ page }) => {
46
await page.goto('/');
@@ -27,3 +29,35 @@ test('should inject `sentry-trace` and `baggage` meta tags inside a parameterize
2729

2830
expect(sentryBaggageContent).toEqual(expect.any(String));
2931
});
32+
33+
test('should send transactions with corresponding `sentry-trace` and `baggage` inside root page', async ({ page }) => {
34+
const envelope = await getFirstSentryEnvelopeRequest<Event>(page, '/');
35+
36+
const sentryTraceTag = await page.$('meta[name="sentry-trace"]');
37+
const sentryTraceContent = await sentryTraceTag?.getAttribute('content');
38+
const sentryBaggageTag = await page.$('meta[name="baggage"]');
39+
const sentryBaggageContent = await sentryBaggageTag?.getAttribute('content');
40+
41+
expect(sentryTraceContent).toContain(
42+
`${envelope.contexts?.trace.trace_id}-${envelope.contexts?.trace.parent_span_id}-`,
43+
);
44+
45+
expect(sentryBaggageContent).toContain(envelope.contexts?.trace.trace_id);
46+
});
47+
48+
test('should send transactions with corresponding `sentry-trace` and `baggage` inside a parameterized route', async ({
49+
page,
50+
}) => {
51+
const envelope = await getFirstSentryEnvelopeRequest<Event>(page, '/loader-json-response/0');
52+
53+
const sentryTraceTag = await page.$('meta[name="sentry-trace"]');
54+
const sentryTraceContent = await sentryTraceTag?.getAttribute('content');
55+
const sentryBaggageTag = await page.$('meta[name="baggage"]');
56+
const sentryBaggageContent = await sentryBaggageTag?.getAttribute('content');
57+
58+
expect(sentryTraceContent).toContain(
59+
`${envelope.contexts?.trace.trace_id}-${envelope.contexts?.trace.parent_span_id}-`,
60+
);
61+
62+
expect(sentryBaggageContent).toContain(envelope.contexts?.trace.trace_id);
63+
});

0 commit comments

Comments
 (0)