diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/non-string-arg/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/non-string-arg/test.ts index 92a18febd3ac..ee7e5193d477 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/non-string-arg/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/non-string-arg/test.ts @@ -6,7 +6,12 @@ import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../. sentryTest( 'should catch onerror calls with non-string first argument gracefully', - async ({ getLocalTestPath, page }) => { + async ({ getLocalTestPath, page, browserName }) => { + if (browserName === 'webkit') { + // This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry + sentryTest.skip(); + } + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/rethrown/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/rethrown/test.ts index a6d96dbc935f..8058aa77d6c9 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/rethrown/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/rethrown/test.ts @@ -6,7 +6,12 @@ import { getMultipleSentryEnvelopeRequests, runScriptInSandbox } from '../../../ sentryTest( 'should NOT catch an exception already caught [but rethrown] via Sentry.captureException', - async ({ getLocalTestPath, page }) => { + async ({ getLocalTestPath, page, browserName }) => { + if (browserName === 'webkit') { + // This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry + sentryTest.skip(); + } + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/syntax-errors/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/syntax-errors/test.ts index 313a9eeebfcb..d218deecc27f 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/syntax-errors/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/syntax-errors/test.ts @@ -4,7 +4,12 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers'; -sentryTest('should catch syntax errors', async ({ getLocalTestPath, page }) => { +sentryTest('should catch syntax errors', async ({ getLocalTestPath, page, browserName }) => { + if (browserName === 'webkit') { + // This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry + sentryTest.skip(); + } + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-errors/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-errors/test.ts index 3da379c9b6c0..413de04d3587 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-errors/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-errors/test.ts @@ -4,7 +4,12 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers'; -sentryTest('should catch thrown errors', async ({ getLocalTestPath, page }) => { +sentryTest('should catch thrown errors', async ({ getLocalTestPath, page, browserName }) => { + if (browserName === 'webkit') { + // This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry + sentryTest.skip(); + } + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-objects/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-objects/test.ts index fdb52a6dac20..4ed03991ff58 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-objects/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-objects/test.ts @@ -4,7 +4,12 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers'; -sentryTest('should catch thrown objects', async ({ getLocalTestPath, page }) => { +sentryTest('should catch thrown objects', async ({ getLocalTestPath, page, browserName }) => { + if (browserName === 'webkit') { + // This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry + sentryTest.skip(); + } + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-strings/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-strings/test.ts index 7e27a25df23d..a391cfa02b05 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-strings/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-strings/test.ts @@ -4,7 +4,12 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers'; -sentryTest('should catch thrown strings', async ({ getLocalTestPath, page }) => { +sentryTest('should catch thrown strings', async ({ getLocalTestPath, page, browserName }) => { + if (browserName === 'webkit') { + // This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry + sentryTest.skip(); + } + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-sync/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-sync/test.ts index 8518b2bb8df1..0d4a1576f12e 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-sync/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-sync/test.ts @@ -8,19 +8,26 @@ import { shouldSkipTracingTest, } from '../../../../utils/helpers'; -sentryTest('should capture an error within a sync startSpan callback', async ({ getLocalTestPath, page }) => { - if (shouldSkipTracingTest()) { - sentryTest.skip(); - } +sentryTest( + 'should capture an error within a sync startSpan callback', + async ({ getLocalTestPath, page, browserName }) => { + if (browserName === 'webkit') { + // This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry + sentryTest.skip(); + } - const url = await getLocalTestPath({ testDir: __dirname }); + if (shouldSkipTracingTest()) { + sentryTest.skip(); + } - await page.goto(url); + const url = await getLocalTestPath({ testDir: __dirname }); - const errorEventsPromise = getMultipleSentryEnvelopeRequests(page, 2); + await page.goto(url); - runScriptInSandbox(page, { - content: ` + const errorEventsPromise = getMultipleSentryEnvelopeRequests(page, 2); + + runScriptInSandbox(page, { + content: ` function run() { Sentry.startSpan({ name: 'parent_span' }, () => { throw new Error('Sync Error'); @@ -29,13 +36,14 @@ sentryTest('should capture an error within a sync startSpan callback', async ({ setTimeout(run); `, - }); + }); - const events = await errorEventsPromise; + const events = await errorEventsPromise; - const txn = events.find(event => event.type === 'transaction'); - const err = events.find(event => !event.type); + const txn = events.find(event => event.type === 'transaction'); + const err = events.find(event => !event.type); - expect(txn).toMatchObject({ transaction: 'parent_span' }); - expect(err?.exception?.values?.[0]?.value).toBe('Sync Error'); -}); + expect(txn).toMatchObject({ transaction: 'parent_span' }); + expect(err?.exception?.values?.[0]?.value).toBe('Sync Error'); + }, +); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/error/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/error/test.ts index 7e6eabd920a9..3f44cc8f069c 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/error/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/error/test.ts @@ -9,7 +9,12 @@ import { sentryTest( 'should put the pageload transaction name onto an error event caught during pageload', - async ({ getLocalTestPath, page }) => { + async ({ getLocalTestPath, page, browserName }) => { + if (browserName === 'webkit') { + // This test fails on Webkit as erros thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry + sentryTest.skip(); + } + if (shouldSkipTracingTest()) { sentryTest.skip(); } diff --git a/dev-packages/browser-integration-tests/utils/helpers.ts b/dev-packages/browser-integration-tests/utils/helpers.ts index cfc3721b8158..5fc2e7a5a7db 100644 --- a/dev-packages/browser-integration-tests/utils/helpers.ts +++ b/dev-packages/browser-integration-tests/utils/helpers.ts @@ -139,6 +139,9 @@ export const countEnvelopes = async ( /** * Run script inside the test environment. + * This is useful for throwing errors in the test environment. + * + * Errors thrown from this function are not guaranteed to be captured by Sentry, especially in Webkit. * * @param {Page} page * @param {{ path?: string; content?: string }} impl