-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
44 lines (41 loc) · 1.3 KB
/
test.ts
File metadata and controls
44 lines (41 loc) · 1.3 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
import { expect } from '@playwright/test';
import type { Event } from '@sentry/browser';
import { sentryTest } from '../../../../../utils/fixtures';
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
sentryTest('should capture console breadcrumbs', async ({ getLocalTestUrl, page }) => {
const url = await getLocalTestUrl({ testDir: __dirname });
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
expect(eventData.breadcrumbs).toEqual([
{
category: 'console',
data: { arguments: ['One'], logger: 'console' },
level: 'log',
message: 'One',
timestamp: expect.any(Number),
},
{
category: 'console',
data: { arguments: ['Two', { a: 1 }], logger: 'console' },
level: 'warning',
message: 'Two [object Object]',
timestamp: expect.any(Number),
},
{
category: 'console',
data: { arguments: ['Error 2', { b: '[Object]' }], logger: 'console' },
level: 'error',
message: 'Error 2 [object Object]',
timestamp: expect.any(Number),
},
{
category: 'console',
data: {
arguments: ['math broke'],
logger: 'console',
},
level: 'log',
message: 'Assertion failed: math broke',
timestamp: expect.any(Number),
},
]);
});