-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
26 lines (21 loc) · 950 Bytes
/
test.ts
File metadata and controls
26 lines (21 loc) · 950 Bytes
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
import { expect } from '@playwright/test';
import type { Event } from '@sentry/core';
import { sentryTest } from '../../../../utils/fixtures';
import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers';
sentryTest('capture user feedback when captureException is called', async ({ getLocalTestUrl, page }) => {
const url = await getLocalTestUrl({ testDir: __dirname });
const data = await getMultipleSentryEnvelopeRequests<Event>(page, 2, { url });
expect(data).toHaveLength(2);
const errorEvent = 'exception' in data[0] ? data[0] : data[1];
const feedback = 'exception' in data[0] ? data[1] : data[0];
expect(feedback.contexts).toEqual(
expect.objectContaining({
feedback: {
associated_event_id: errorEvent.event_id,
message: 'This feedback should be attached associated with the captured error',
contact_email: 'john@doe.com',
name: 'John Doe',
},
}),
);
});