|
1 | 1 | import { expect } from '@playwright/test';
|
2 |
| -import type { Event } from '@sentry/types'; |
3 | 2 |
|
4 | 3 | import { sentryTest } from '../../../utils/fixtures';
|
5 |
| -import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers'; |
| 4 | +import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../utils/helpers'; |
6 | 5 |
|
7 | 6 | sentryTest(
|
8 | 7 | 'should add source context lines around stack frames from errors in Html inline JS',
|
9 |
| - async ({ getLocalTestPath, page }) => { |
| 8 | + async ({ getLocalTestPath, page, browserName }) => { |
| 9 | + if (browserName === 'webkit') { |
| 10 | + // The error we're throwing in this test is thrown as "Script error." in Webkit. |
| 11 | + // We filter "Script error." out by default in `InboundFilters`. |
| 12 | + // I don't think there's much value to disable InboundFilters defaults for this test, |
| 13 | + // given that most of our users won't do that either. |
| 14 | + // Let's skip it instead for Webkit. |
| 15 | + sentryTest.skip(); |
| 16 | + } |
| 17 | + |
10 | 18 | const url = await getLocalTestPath({ testDir: __dirname });
|
11 | 19 |
|
12 |
| - const eventPromise = getFirstSentryEnvelopeRequest<Event>(page, url); |
| 20 | + const eventReqPromise = waitForErrorRequestOnUrl(page, url); |
13 | 21 |
|
14 | 22 | const clickPromise = page.click('#inline-error-btn');
|
15 | 23 |
|
16 |
| - const [eventData] = await Promise.all([eventPromise, clickPromise]); |
| 24 | + const [req] = await Promise.all([eventReqPromise, clickPromise]); |
| 25 | + |
| 26 | + const eventData = envelopeRequestParser(req); |
17 | 27 |
|
18 | 28 | expect(eventData.exception?.values).toHaveLength(1);
|
19 | 29 |
|
@@ -41,11 +51,14 @@ sentryTest(
|
41 | 51 | sentryTest('should not add source context lines to errors from script files', async ({ getLocalTestPath, page }) => {
|
42 | 52 | const url = await getLocalTestPath({ testDir: __dirname });
|
43 | 53 |
|
44 |
| - const eventPromise = getFirstSentryEnvelopeRequest<Event>(page, url); |
| 54 | + const eventReqPromise = waitForErrorRequestOnUrl(page, url); |
| 55 | + |
| 56 | + const clickPromise = page.click('#script-error-btn'); |
| 57 | + |
| 58 | + const [req] = await Promise.all([eventReqPromise, clickPromise]); |
45 | 59 |
|
46 |
| - await page.click('#script-error-btn'); |
| 60 | + const eventData = envelopeRequestParser(req); |
47 | 61 |
|
48 |
| - const eventData = await eventPromise; |
49 | 62 | const exception = eventData.exception?.values?.[0];
|
50 | 63 | const frames = exception?.stacktrace?.frames;
|
51 | 64 | expect(frames).toHaveLength(1);
|
|
0 commit comments