Skip to content

Commit 2cf2b91

Browse files
committed
Add test for loader span http.server connection.
1 parent 5dd340f commit 2cf2b91

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/behaviour-server.test.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,10 @@ test('Sends two linked transactions (server & client) to Sentry', async ({ page
136136

137137
const httpServerTraceId = httpServerTransaction.contexts?.trace?.trace_id;
138138
const httpServerSpanId = httpServerTransaction.contexts?.trace?.span_id;
139-
const loaderSpanId = httpServerTransaction.spans.find(
140-
span => span.data && span.data['code.function'] === 'loader',
141-
)?.span_id;
139+
140+
const loaderSpan = httpServerTransaction?.spans?.find(span => span.data && span.data['code.function'] === 'loader');
141+
const loaderSpanId = loaderSpan?.span_id;
142+
const loaderParentSpanId = loaderSpan?.parent_span_id;
142143

143144
const pageLoadTraceId = pageloadTransaction.contexts?.trace?.trace_id;
144145
const pageLoadSpanId = pageloadTransaction.contexts?.trace?.span_id;
@@ -150,6 +151,7 @@ test('Sends two linked transactions (server & client) to Sentry', async ({ page
150151
expect(httpServerTraceId).toBeDefined();
151152
expect(httpServerSpanId).toBeDefined();
152153

154+
expect(loaderParentSpanId).toEqual(httpServerSpanId);
153155
expect(pageLoadTraceId).toEqual(httpServerTraceId);
154156
expect(pageLoadParentSpanId).toEqual(loaderSpanId);
155157
expect(pageLoadSpanId).not.toEqual(httpServerSpanId);

0 commit comments

Comments
 (0)