-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
31 lines (24 loc) · 1.01 KB
/
test.ts
File metadata and controls
31 lines (24 loc) · 1.01 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
import { expect } from '@playwright/test';
import type { Event } from '@sentry/browser';
import { sentryTest } from '../../../../../utils/fixtures';
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
// see: https://github.com/getsentry/sentry-javascript/issues/768
sentryTest(
'should record breadcrumb if accessing the target property of an event throws an exception',
async ({ getLocalTestUrl, page }) => {
const url = await getLocalTestUrl({ testDir: __dirname });
await page.goto(url);
const promise = getFirstSentryEnvelopeRequest<Event>(page);
await page.locator('#input1').pressSequentially('test', { delay: 1 });
await page.evaluate('Sentry.captureException("test exception")');
const eventData = await promise;
expect(eventData.breadcrumbs).toHaveLength(1);
expect(eventData.breadcrumbs).toEqual([
{
category: 'ui.input',
message: 'body > input#input1[type="text"]',
timestamp: expect.any(Number),
},
]);
},
);