Skip to content

Commit 9144ea4

Browse files
committed
Skip runScriptInSandbox tests on webkit.
1 parent c8a819f commit 9144ea4

File tree

10 files changed

+69
-24
lines changed

10 files changed

+69
-24
lines changed

dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/init.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ window.Sentry = Sentry;
44

55
Sentry.init({
66
dsn: 'https://[email protected]/1337',
7-
debug: true,
87
});

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

Lines changed: 6 additions & 1 deletion
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

Lines changed: 6 additions & 1 deletion
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

Lines changed: 6 additions & 1 deletion
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

Lines changed: 6 additions & 1 deletion
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

Lines changed: 6 additions & 1 deletion
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

Lines changed: 6 additions & 1 deletion
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

Lines changed: 24 additions & 16 deletions
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

Lines changed: 6 additions & 1 deletion
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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ export const countEnvelopes = async (
146146

147147
/**
148148
* Run script inside the test environment.
149+
* This is useful for throwing errors in the test environment.
150+
*
151+
* Errors thrown from this function are not guaranteed to be captured by Sentry, especially in Webkit.
149152
*
150153
* @param {Page} page
151154
* @param {{ path?: string; content?: string }} impl

0 commit comments

Comments
 (0)