-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
45 lines (37 loc) · 1.23 KB
/
test.ts
File metadata and controls
45 lines (37 loc) · 1.23 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
37
38
39
40
41
42
43
44
45
import { expect } from '@playwright/test';
import type { ClientReport } from '@sentry/core';
import { sentryTest } from '../../../utils/fixtures';
import {
envelopeRequestParser,
hidePage,
shouldSkipTracingTest,
testingCdnBundle,
waitForClientReportRequest,
} from '../../../utils/helpers';
sentryTest(
'records no_parent_span client report for fetch requests without an active span',
async ({ getLocalTestUrl, page }) => {
sentryTest.skip(shouldSkipTracingTest() || testingCdnBundle());
await page.route('http://sentry-test-site.example/api/test', route => {
route.fulfill({
status: 200,
body: 'ok',
headers: { 'Content-Type': 'text/plain' },
});
});
const url = await getLocalTestUrl({ testDir: __dirname });
const clientReportPromise = waitForClientReportRequest(page, report => {
return report.discarded_events.some(e => e.reason === 'no_parent_span');
});
await page.goto(url);
await hidePage(page);
const clientReport = envelopeRequestParser<ClientReport>(await clientReportPromise);
expect(clientReport.discarded_events).toEqual([
{
category: 'span',
quantity: 1,
reason: 'no_parent_span',
},
]);
},
);