|
1 | 1 | import { expect } from '@playwright/test'; |
2 | | -import type { Event, UserFeedback } from '@sentry/core'; |
| 2 | +import type { Event, FeedbackEvent } from '@sentry/core'; |
3 | 3 |
|
4 | 4 | import { sentryTest } from '../../../../utils/fixtures'; |
5 | 5 | import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; |
6 | 6 |
|
7 | 7 | sentryTest('capture user feedback when captureMessage is called', async ({ getLocalTestUrl, page }) => { |
8 | 8 | const url = await getLocalTestUrl({ testDir: __dirname }); |
9 | 9 |
|
10 | | - const data = (await getMultipleSentryEnvelopeRequests(page, 2, { url })) as (Event | UserFeedback)[]; |
| 10 | + const data = (await getMultipleSentryEnvelopeRequests(page, 2, { url })) as (Event | FeedbackEvent)[]; |
11 | 11 |
|
12 | 12 | expect(data).toHaveLength(2); |
13 | 13 |
|
14 | 14 | const errorEvent = ('exception' in data[0] ? data[0] : data[1]) as Event; |
15 | | - const feedback = ('exception' in data[0] ? data[1] : data[0]) as UserFeedback; |
| 15 | + const feedback = ('exception' in data[0] ? data[1] : data[0]) as FeedbackEvent; |
16 | 16 |
|
17 | | - expect(feedback).toEqual({ |
18 | | - comments: 'This feedback should be attached associated with the captured message', |
19 | | - |
20 | | - event_id: errorEvent.event_id, |
21 | | - name: 'John Doe', |
22 | | - }); |
| 17 | + expect(feedback.contexts).toEqual( |
| 18 | + expect.objectContaining({ |
| 19 | + feedback: { |
| 20 | + message: 'This feedback should be attached associated with the captured message', |
| 21 | + contact_email: '[email protected]', |
| 22 | + associated_event_id: errorEvent.event_id, |
| 23 | + name: 'John Doe', |
| 24 | + }, |
| 25 | + }), |
| 26 | + ); |
23 | 27 | }); |
0 commit comments