Skip to content

Commit eb9b51c

Browse files
committed
Skip runScriptInSandbox tests on webkit.
1 parent 094909f commit eb9b51c

File tree

9 files changed

+69
-23
lines changed

9 files changed

+69
-23
lines changed

dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/non-string-arg/test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../.
66

77
sentryTest(
88
'should catch onerror calls with non-string first argument gracefully',
9-
async ({ getLocalTestPath, page }) => {
9+
async ({ getLocalTestPath, page, browserName }) => {
10+
if (browserName === 'webkit') {
11+
// This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry
12+
sentryTest.skip();
13+
}
14+
1015
const url = await getLocalTestPath({ testDir: __dirname });
1116

1217
await page.goto(url);

dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/rethrown/test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ import { getMultipleSentryEnvelopeRequests, runScriptInSandbox } from '../../../
66

77
sentryTest(
88
'should NOT catch an exception already caught [but rethrown] via Sentry.captureException',
9-
async ({ getLocalTestPath, page }) => {
9+
async ({ getLocalTestPath, page, browserName }) => {
10+
if (browserName === 'webkit') {
11+
// This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry
12+
sentryTest.skip();
13+
}
14+
1015
const url = await getLocalTestPath({ testDir: __dirname });
1116

1217
await page.goto(url);

dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/syntax-errors/test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import type { Event } from '@sentry/types';
44
import { sentryTest } from '../../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers';
66

7-
sentryTest('should catch syntax errors', async ({ getLocalTestPath, page }) => {
7+
sentryTest('should catch syntax errors', async ({ getLocalTestPath, page, browserName }) => {
8+
if (browserName === 'webkit') {
9+
// This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry
10+
sentryTest.skip();
11+
}
12+
813
const url = await getLocalTestPath({ testDir: __dirname });
914

1015
await page.goto(url);

dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-errors/test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import type { Event } from '@sentry/types';
44
import { sentryTest } from '../../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers';
66

7-
sentryTest('should catch thrown errors', async ({ getLocalTestPath, page }) => {
7+
sentryTest('should catch thrown errors', async ({ getLocalTestPath, page, browserName }) => {
8+
if (browserName === 'webkit') {
9+
// This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry
10+
sentryTest.skip();
11+
}
12+
813
const url = await getLocalTestPath({ testDir: __dirname });
914

1015
await page.goto(url);

dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-objects/test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import type { Event } from '@sentry/types';
44
import { sentryTest } from '../../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers';
66

7-
sentryTest('should catch thrown objects', async ({ getLocalTestPath, page }) => {
7+
sentryTest('should catch thrown objects', async ({ getLocalTestPath, page, browserName }) => {
8+
if (browserName === 'webkit') {
9+
// This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry
10+
sentryTest.skip();
11+
}
12+
813
const url = await getLocalTestPath({ testDir: __dirname });
914

1015
await page.goto(url);

dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-strings/test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import type { Event } from '@sentry/types';
44
import { sentryTest } from '../../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers';
66

7-
sentryTest('should catch thrown strings', async ({ getLocalTestPath, page }) => {
7+
sentryTest('should catch thrown strings', async ({ getLocalTestPath, page, browserName }) => {
8+
if (browserName === 'webkit') {
9+
// This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry
10+
sentryTest.skip();
11+
}
12+
813
const url = await getLocalTestPath({ testDir: __dirname });
914

1015
await page.goto(url);

dev-packages/browser-integration-tests/suites/public-api/startSpan/error-sync/test.ts

+24-16
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,26 @@ import {
88
shouldSkipTracingTest,
99
} from '../../../../utils/helpers';
1010

11-
sentryTest('should capture an error within a sync startSpan callback', async ({ getLocalTestPath, page }) => {
12-
if (shouldSkipTracingTest()) {
13-
sentryTest.skip();
14-
}
11+
sentryTest(
12+
'should capture an error within a sync startSpan callback',
13+
async ({ getLocalTestPath, page, browserName }) => {
14+
if (browserName === 'webkit') {
15+
// This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry
16+
sentryTest.skip();
17+
}
1518

16-
const url = await getLocalTestPath({ testDir: __dirname });
19+
if (shouldSkipTracingTest()) {
20+
sentryTest.skip();
21+
}
1722

18-
await page.goto(url);
23+
const url = await getLocalTestPath({ testDir: __dirname });
1924

20-
const errorEventsPromise = getMultipleSentryEnvelopeRequests<Event>(page, 2);
25+
await page.goto(url);
2126

22-
runScriptInSandbox(page, {
23-
content: `
27+
const errorEventsPromise = getMultipleSentryEnvelopeRequests<Event>(page, 2);
28+
29+
runScriptInSandbox(page, {
30+
content: `
2431
function run() {
2532
Sentry.startSpan({ name: 'parent_span' }, () => {
2633
throw new Error('Sync Error');
@@ -29,13 +36,14 @@ sentryTest('should capture an error within a sync startSpan callback', async ({
2936
3037
setTimeout(run);
3138
`,
32-
});
39+
});
3340

34-
const events = await errorEventsPromise;
41+
const events = await errorEventsPromise;
3542

36-
const txn = events.find(event => event.type === 'transaction');
37-
const err = events.find(event => !event.type);
43+
const txn = events.find(event => event.type === 'transaction');
44+
const err = events.find(event => !event.type);
3845

39-
expect(txn).toMatchObject({ transaction: 'parent_span' });
40-
expect(err?.exception?.values?.[0]?.value).toBe('Sync Error');
41-
});
46+
expect(txn).toMatchObject({ transaction: 'parent_span' });
47+
expect(err?.exception?.values?.[0]?.value).toBe('Sync Error');
48+
},
49+
);

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/error/test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ import {
99

1010
sentryTest(
1111
'should put the pageload transaction name onto an error event caught during pageload',
12-
async ({ getLocalTestPath, page }) => {
12+
async ({ getLocalTestPath, page, browserName }) => {
13+
if (browserName === 'webkit') {
14+
// This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry
15+
sentryTest.skip();
16+
}
17+
1318
if (shouldSkipTracingTest()) {
1419
sentryTest.skip();
1520
}

dev-packages/browser-integration-tests/utils/helpers.ts

+3
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ export const countEnvelopes = async (
139139

140140
/**
141141
* Run script inside the test environment.
142+
* This is useful for throwing errors in the test environment.
143+
*
144+
* Errors thrown from this function are not guaranteed to be captured by Sentry, especially in Webkit.
142145
*
143146
* @param {Page} page
144147
* @param {{ path?: string; content?: string }} impl

0 commit comments

Comments
 (0)