-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
35 lines (27 loc) · 1.21 KB
/
test.ts
File metadata and controls
35 lines (27 loc) · 1.21 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
import { expect } from '@playwright/test';
import type { ClientReport } from '@sentry/core';
import { sentryTest } from '../../../../utils/fixtures';
import {
envelopeRequestParser,
hidePage,
shouldSkipTracingTest,
waitForClientReportRequest,
} from '../../../../utils/helpers';
import { observeStreamedSpan, waitForStreamedSpans } from '../../../../utils/spanUtils';
sentryTest('attribute-matching ignoreSpans drops the trace', async ({ getLocalTestUrl, page }) => {
sentryTest.skip(shouldSkipTracingTest());
const url = await getLocalTestUrl({ testDir: __dirname });
observeStreamedSpan(page, span => {
if (span.name === 'health-check' || span.name === 'child-of-ignored') {
throw new Error('Ignored span found');
}
return false;
});
const spansPromise = waitForStreamedSpans(page, spans => !!spans?.find(s => s.name === 'normal-segment'));
const clientReportPromise = waitForClientReportRequest(page);
await page.goto(url);
expect((await spansPromise)?.length).toBe(2);
await hidePage(page);
const clientReport = envelopeRequestParser<ClientReport>(await clientReportPromise);
expect(clientReport.discarded_events).toEqual([{ category: 'span', quantity: 2, reason: 'ignored' }]);
});