-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathrequest-instrumentation.test.ts
More file actions
36 lines (30 loc) · 1.11 KB
/
request-instrumentation.test.ts
File metadata and controls
36 lines (30 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { expect, test } from '@playwright/test';
import { waitForTransaction } from '@sentry-internal/test-utils';
test('Should send a transaction with a fetch span', async ({ page }) => {
const transactionPromise = waitForTransaction('nextjs-14', async transactionEvent => {
return transactionEvent?.transaction === 'GET /request-instrumentation';
});
await page.goto(`/request-instrumentation`);
await expect(transactionPromise).resolves.toBeDefined();
const transactionEvent = await transactionPromise;
expect(transactionEvent.spans).toContainEqual(
expect.objectContaining({
data: expect.objectContaining({
'http.request.method': 'GET',
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.otel.node_fetch',
}),
description: 'GET https://github.com/',
}),
);
expect(transactionEvent.spans).toContainEqual(
expect.objectContaining({
data: expect.objectContaining({
'http.method': 'GET',
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.client',
}),
description: 'GET https://github.com/',
}),
);
});