diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/.gitignore b/dev-packages/e2e-tests/test-applications/solid-solidrouter/.gitignore new file mode 100644 index 000000000000..84634c973eeb --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/.gitignore @@ -0,0 +1,29 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +/test-results/ +/playwright-report/ +/playwright/.cache/ + +!*.d.ts diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/.npmrc b/dev-packages/e2e-tests/test-applications/solid-solidrouter/.npmrc new file mode 100644 index 000000000000..070f80f05092 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/.npmrc @@ -0,0 +1,2 @@ +@sentry:registry=http://127.0.0.1:4873 +@sentry-internal:registry=http://127.0.0.1:4873 diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/README.md b/dev-packages/e2e-tests/test-applications/solid-solidrouter/README.md new file mode 100644 index 000000000000..81e5eb6c2d40 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/README.md @@ -0,0 +1,40 @@ +## Usage + +Those templates dependencies are maintained via [pnpm](https://pnpm.io) via `pnpm up -Lri`. + +This is the reason you see a `pnpm-lock.yaml`. That being said, any package manager will work. This file can be safely +be removed once you clone a template. + +```bash +$ npm install # or pnpm install or yarn install +``` + +## Exploring the template + +This template's goal is to showcase the routing features of Solid. It also showcase how the router and Suspense work +together to parallelize data fetching tied to a route via the `.data.ts` pattern. + +You can learn more about it on the [`@solidjs/router` repository](https://github.com/solidjs/solid-router) + +### Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs) + +## Available Scripts + +In the project directory, you can run: + +### `npm run dev` or `npm start` + +Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.
+ +### `npm run build` + +Builds the app for production to the `dist` folder.
It correctly bundles Solid in production mode and optimizes the +build for the best performance. + +The build is minified and the filenames include the hashes.
Your app is ready to be deployed! + +## Deployment + +You can deploy the `dist` folder to any static host provider (netlify, surge, now, etc.) diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/index.html b/dev-packages/e2e-tests/test-applications/solid-solidrouter/index.html new file mode 100644 index 000000000000..1905a0429019 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/index.html @@ -0,0 +1,15 @@ + + + + + + + Solid App + + + +
+ + + + diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/package.json b/dev-packages/e2e-tests/test-applications/solid-solidrouter/package.json new file mode 100644 index 000000000000..3f0d7ca13fce --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/package.json @@ -0,0 +1,33 @@ +{ + "name": "solid-solidrouter", + "version": "0.0.0", + "description": "", + "scripts": { + "build": "vite build", + "clean": "npx rimraf node_modules pnpm-lock.yaml dist", + "dev": "vite", + "preview": "vite preview", + "start": "vite", + "test:prod": "TEST_ENV=production playwright test", + "test:build": "pnpm install && npx playwright install && pnpm build", + "test:assert": "pnpm test:prod" + }, + "license": "MIT", + "devDependencies": { + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", + "@sentry/types": "latest || *", + "@sentry/utils": "latest || *", + "autoprefixer": "^10.4.17", + "postcss": "^8.4.33", + "solid-devtools": "^0.29.2", + "tailwindcss": "^3.4.1", + "vite": "^5.0.11", + "vite-plugin-solid": "^2.8.2" + }, + "dependencies": { + "@solidjs/router": "^0.13.5", + "solid-js": "^1.8.11", + "@sentry/solid": "latest || *" + } +} diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/solid-solidrouter/playwright.config.mjs new file mode 100644 index 000000000000..0c468af7d879 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/playwright.config.mjs @@ -0,0 +1,8 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: 'pnpm preview --port 3030', + port: 3030, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/postcss.config.js b/dev-packages/e2e-tests/test-applications/solid-solidrouter/postcss.config.js new file mode 100644 index 000000000000..12a703d900da --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/dev-packages/e2e-tests/test-applications/solid/src/errors/404.tsx b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/errors/404.tsx similarity index 100% rename from dev-packages/e2e-tests/test-applications/solid/src/errors/404.tsx rename to dev-packages/e2e-tests/test-applications/solid-solidrouter/src/errors/404.tsx diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/index.css b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/index.css new file mode 100644 index 000000000000..b5c61c956711 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/index.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/index.tsx b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/index.tsx new file mode 100644 index 000000000000..66773f009d1e --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/index.tsx @@ -0,0 +1,22 @@ +/* @refresh reload */ +import * as Sentry from '@sentry/solid'; +import { solidRouterBrowserTracingIntegration, withSentryRouterRouting } from '@sentry/solid/solidrouter'; +import { Router } from '@solidjs/router'; +import { render } from 'solid-js/web'; +import './index.css'; +import PageRoot from './pageroot'; +import { routes } from './routes'; + +Sentry.init({ + dsn: import.meta.env.PUBLIC_E2E_TEST_DSN, + debug: true, + environment: 'qa', // dynamic sampling bias to keep transactions + integrations: [solidRouterBrowserTracingIntegration()], + release: 'e2e-test', + tunnel: 'http://localhost:3031/', // proxy server + tracesSampleRate: 1.0, +}); + +const SentryRouter = withSentryRouterRouting(Router); + +render(() => {routes}, document.getElementById('root')); diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/pageroot.tsx b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/pageroot.tsx new file mode 100644 index 000000000000..0919c0e362db --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/pageroot.tsx @@ -0,0 +1,28 @@ +import { A } from '@solidjs/router'; + +export default function PageRoot(props) { + return ( + <> + +
{props.children}
+ + ); +} diff --git a/dev-packages/e2e-tests/test-applications/solid/src/pages/errorboundaryexample.tsx b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/pages/errorboundaryexample.tsx similarity index 100% rename from dev-packages/e2e-tests/test-applications/solid/src/pages/errorboundaryexample.tsx rename to dev-packages/e2e-tests/test-applications/solid-solidrouter/src/pages/errorboundaryexample.tsx diff --git a/dev-packages/e2e-tests/test-applications/solid/src/pages/home.tsx b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/pages/home.tsx similarity index 100% rename from dev-packages/e2e-tests/test-applications/solid/src/pages/home.tsx rename to dev-packages/e2e-tests/test-applications/solid-solidrouter/src/pages/home.tsx diff --git a/dev-packages/e2e-tests/test-applications/solid/src/pages/user.tsx b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/pages/user.tsx similarity index 100% rename from dev-packages/e2e-tests/test-applications/solid/src/pages/user.tsx rename to dev-packages/e2e-tests/test-applications/solid-solidrouter/src/pages/user.tsx diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/routes.ts b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/routes.ts new file mode 100644 index 000000000000..96b78e113ef5 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/src/routes.ts @@ -0,0 +1,23 @@ +import { lazy } from 'solid-js'; + +import ErrorBoundaryExample from './pages/errorboundaryexample'; +import Home from './pages/home'; + +export const routes = [ + { + path: '/', + component: Home, + }, + { + path: '/user/:id', + component: lazy(() => import('./pages/user')), + }, + { + path: '/error-boundary-example', + component: ErrorBoundaryExample, + }, + { + path: '**', + component: lazy(() => import('./errors/404')), + }, +]; diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/solid-solidrouter/start-event-proxy.mjs new file mode 100644 index 000000000000..075d4dcb5cf5 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/start-event-proxy.mjs @@ -0,0 +1,6 @@ +import { startEventProxyServer } from '@sentry-internal/test-utils'; + +startEventProxyServer({ + port: 3031, + proxyServerName: 'solid', +}); diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/tailwind.config.ts b/dev-packages/e2e-tests/test-applications/solid-solidrouter/tailwind.config.ts new file mode 100644 index 000000000000..f69a95185570 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/tailwind.config.ts @@ -0,0 +1,11 @@ +import type { Config } from 'tailwindcss'; + +const config: Config = { + content: ['./src/**/*.{js,jsx,ts,tsx}'], + theme: { + extend: {}, + }, + plugins: [], +}; + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/tests/errorboundary.test.ts b/dev-packages/e2e-tests/test-applications/solid-solidrouter/tests/errorboundary.test.ts new file mode 100644 index 000000000000..287642424850 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/tests/errorboundary.test.ts @@ -0,0 +1,75 @@ +import { expect, test } from '@playwright/test'; +import { waitForError } from '@sentry-internal/test-utils'; + +test('captures an exception', async ({ page }) => { + const errorEventPromise = waitForError('solid', errorEvent => { + return !errorEvent.type && errorEvent.transaction === '/error-boundary-example'; + }); + + const [, errorEvent] = await Promise.all([page.goto('/error-boundary-example'), errorEventPromise]); + + expect(errorEvent).toMatchObject({ + exception: { + values: [ + { + type: 'ReferenceError', + value: 'NonExistentComponent is not defined', + mechanism: { + type: 'generic', + handled: true, + }, + }, + ], + }, + transaction: '/error-boundary-example', + }); +}); + +test('captures a second exception after resetting the boundary', async ({ page }) => { + const firstErrorEventPromise = waitForError('solid', errorEvent => { + return !errorEvent.type && errorEvent.transaction === '/error-boundary-example'; + }); + + const [, firstErrorEvent] = await Promise.all([page.goto('/error-boundary-example'), firstErrorEventPromise]); + + expect(firstErrorEvent).toMatchObject({ + exception: { + values: [ + { + type: 'ReferenceError', + value: 'NonExistentComponent is not defined', + mechanism: { + type: 'generic', + handled: true, + }, + }, + ], + }, + transaction: '/error-boundary-example', + }); + + const secondErrorEventPromise = waitForError('solid', errorEvent => { + return !errorEvent.type && errorEvent.transaction === '/error-boundary-example'; + }); + + const [, secondErrorEvent] = await Promise.all([ + page.locator('#errorBoundaryResetBtn').click(), + await secondErrorEventPromise, + ]); + + expect(secondErrorEvent).toMatchObject({ + exception: { + values: [ + { + type: 'ReferenceError', + value: 'NonExistentComponent is not defined', + mechanism: { + type: 'generic', + handled: true, + }, + }, + ], + }, + transaction: '/error-boundary-example', + }); +}); diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/solid-solidrouter/tests/errors.test.ts new file mode 100644 index 000000000000..b8e2a759886a --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/tests/errors.test.ts @@ -0,0 +1,28 @@ +import { expect, test } from '@playwright/test'; +import { waitForError } from '@sentry-internal/test-utils'; + +test('sends an error', async ({ page }) => { + const errorPromise = waitForError('solid', async errorEvent => { + return !errorEvent.type && errorEvent.exception?.values?.[0]?.value === 'Error thrown from Solid E2E test app'; + }); + + await Promise.all([page.goto(`/`), page.locator('#errorBtn').click()]); + + const error = await errorPromise; + + expect(error).toMatchObject({ + exception: { + values: [ + { + type: 'Error', + value: 'Error thrown from Solid E2E test app', + mechanism: { + type: 'onerror', + handled: false, + }, + }, + ], + }, + transaction: '/', + }); +}); diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/solid-solidrouter/tests/performance.test.ts new file mode 100644 index 000000000000..f73ff4940527 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/tests/performance.test.ts @@ -0,0 +1,91 @@ +import { expect, test } from '@playwright/test'; +import { waitForTransaction } from '@sentry-internal/test-utils'; + +test('sends a pageload transaction', async ({ page }) => { + const transactionPromise = waitForTransaction('solid', async transactionEvent => { + return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload'; + }); + + const [, pageloadTransaction] = await Promise.all([page.goto('/'), transactionPromise]); + + expect(pageloadTransaction).toMatchObject({ + contexts: { + trace: { + op: 'pageload', + origin: 'auto.pageload.browser', + }, + }, + transaction: '/', + transaction_info: { + source: 'url', + }, + }); +}); + +test('sends a navigation transaction', async ({ page }) => { + const transactionPromise = waitForTransaction('solid', async transactionEvent => { + return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; + }); + + await page.goto(`/`); + + const [, navigationTransaction] = await Promise.all([page.locator('#navLink').click(), transactionPromise]); + + expect(navigationTransaction).toMatchObject({ + contexts: { + trace: { + op: 'navigation', + origin: 'auto.navigation.solid.solidrouter', + }, + }, + transaction: '/user/5', + transaction_info: { + source: 'url', + }, + }); +}); + +test('updates the transaction when using the back button', async ({ page }) => { + // Solid Router sends a `-1` navigation when using the back button. + // The sentry solidRouterBrowserTracingIntegration tries to update such + // transactions with the proper name once the `useLocation` hook triggers. + const navigationTxnPromise = waitForTransaction('solid', async transactionEvent => { + return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; + }); + + await page.goto(`/`); + + const [, navigationTxn] = await Promise.all([page.locator('#navLink').click(), navigationTxnPromise]); + + expect(navigationTxn).toMatchObject({ + contexts: { + trace: { + op: 'navigation', + origin: 'auto.navigation.solid.solidrouter', + }, + }, + transaction: '/user/5', + transaction_info: { + source: 'url', + }, + }); + + const backNavigationTxnPromise = waitForTransaction('solid', async transactionEvent => { + return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; + }); + + const [, backNavigationTxn] = await Promise.all([page.goBack(), backNavigationTxnPromise]); + + expect(backNavigationTxn).toMatchObject({ + contexts: { + trace: { + op: 'navigation', + origin: 'auto.navigation.solid.solidrouter', + }, + }, + transaction: '/', + transaction_info: { + source: 'url', + }, + }); +}); diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/tsconfig.json b/dev-packages/e2e-tests/test-applications/solid-solidrouter/tsconfig.json new file mode 100644 index 000000000000..ba12e96f069a --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "jsx": "preserve", + "jsxImportSource": "solid-js", + "types": ["vite/client"], + "noEmit": true, + "isolatedModules": true, + }, +} diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/vite.config.ts b/dev-packages/e2e-tests/test-applications/solid-solidrouter/vite.config.ts new file mode 100644 index 000000000000..d1835ee1b8ff --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/vite.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'vite'; +import solidPlugin from 'vite-plugin-solid'; + +export default defineConfig({ + plugins: [solidPlugin()], + build: { + target: 'esnext', + }, + envPrefix: 'PUBLIC_', +}); diff --git a/dev-packages/e2e-tests/test-applications/solid/package.json b/dev-packages/e2e-tests/test-applications/solid/package.json index c63d3080748f..ebfde066e6ef 100644 --- a/dev-packages/e2e-tests/test-applications/solid/package.json +++ b/dev-packages/e2e-tests/test-applications/solid/package.json @@ -26,7 +26,6 @@ "vite-plugin-solid": "^2.8.2" }, "dependencies": { - "@solidjs/router": "^0.13.5", "solid-js": "^1.8.11", "@sentry/solid": "latest || *" } diff --git a/dev-packages/e2e-tests/test-applications/solid/src/app.tsx b/dev-packages/e2e-tests/test-applications/solid/src/app.tsx new file mode 100644 index 000000000000..0b83d62ff655 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solid/src/app.tsx @@ -0,0 +1,72 @@ +import * as Sentry from '@sentry/solid'; +import { ErrorBoundary, createSignal, onMount } from 'solid-js'; + +const SentryErrorBoundary = Sentry.withSentryErrorBoundary(ErrorBoundary); + +const [count, setCount] = createSignal(1); +const [caughtError, setCaughtError] = createSignal(false); + +export default function App() { + return ( + + {caughtError() && } +
+
+ +
+
+ +
+
+
+ ); +} + +function Throw(props) { + onMount(() => { + throw new Error(props.error); + }); + return null; +} + +function SampleErrorBoundary(props) { + return ( + ( +
+

Error Boundary Fallback

+
+ {error.message} +
+ +
+ )} + > + {props.children} +
+ ); +} diff --git a/dev-packages/e2e-tests/test-applications/solid/src/index.tsx b/dev-packages/e2e-tests/test-applications/solid/src/index.tsx index 66773f009d1e..df121347daeb 100644 --- a/dev-packages/e2e-tests/test-applications/solid/src/index.tsx +++ b/dev-packages/e2e-tests/test-applications/solid/src/index.tsx @@ -1,22 +1,19 @@ /* @refresh reload */ import * as Sentry from '@sentry/solid'; -import { solidRouterBrowserTracingIntegration, withSentryRouterRouting } from '@sentry/solid/solidrouter'; -import { Router } from '@solidjs/router'; import { render } from 'solid-js/web'; +import App from './app'; import './index.css'; -import PageRoot from './pageroot'; -import { routes } from './routes'; Sentry.init({ - dsn: import.meta.env.PUBLIC_E2E_TEST_DSN, + dsn: + import.meta.env.PUBLIC_E2E_TEST_DSN || + 'https://3b6c388182fb435097f41d181be2b2ba@o4504321058471936.ingest.sentry.io/4504321066008576', debug: true, environment: 'qa', // dynamic sampling bias to keep transactions - integrations: [solidRouterBrowserTracingIntegration()], + integrations: [Sentry.browserTracingIntegration()], release: 'e2e-test', tunnel: 'http://localhost:3031/', // proxy server tracesSampleRate: 1.0, }); -const SentryRouter = withSentryRouterRouting(Router); - -render(() => {routes}, document.getElementById('root')); +render(() => , document.getElementById('root')); diff --git a/dev-packages/e2e-tests/test-applications/solid/tests/errorboundary.test.ts b/dev-packages/e2e-tests/test-applications/solid/tests/errorboundary.test.ts index 287642424850..d192ed9cfcfd 100644 --- a/dev-packages/e2e-tests/test-applications/solid/tests/errorboundary.test.ts +++ b/dev-packages/e2e-tests/test-applications/solid/tests/errorboundary.test.ts @@ -3,17 +3,24 @@ import { waitForError } from '@sentry-internal/test-utils'; test('captures an exception', async ({ page }) => { const errorEventPromise = waitForError('solid', errorEvent => { - return !errorEvent.type && errorEvent.transaction === '/error-boundary-example'; + return ( + !errorEvent.type && + errorEvent.exception?.values?.[0]?.value === 'Error 1 thrown from Sentry ErrorBoundary in Solid E2E test app' + ); }); - const [, errorEvent] = await Promise.all([page.goto('/error-boundary-example'), errorEventPromise]); + const [, , errorEvent] = await Promise.all([ + page.goto('/'), + page.locator('#caughtErrorBtn').click(), + errorEventPromise, + ]); expect(errorEvent).toMatchObject({ exception: { values: [ { - type: 'ReferenceError', - value: 'NonExistentComponent is not defined', + type: 'Error', + value: 'Error 1 thrown from Sentry ErrorBoundary in Solid E2E test app', mechanism: { type: 'generic', handled: true, @@ -21,23 +28,30 @@ test('captures an exception', async ({ page }) => { }, ], }, - transaction: '/error-boundary-example', + transaction: '/', }); }); test('captures a second exception after resetting the boundary', async ({ page }) => { const firstErrorEventPromise = waitForError('solid', errorEvent => { - return !errorEvent.type && errorEvent.transaction === '/error-boundary-example'; + return ( + !errorEvent.type && + errorEvent.exception?.values?.[0]?.value === 'Error 1 thrown from Sentry ErrorBoundary in Solid E2E test app' + ); }); - const [, firstErrorEvent] = await Promise.all([page.goto('/error-boundary-example'), firstErrorEventPromise]); + const [, , firstErrorEvent] = await Promise.all([ + page.goto('/'), + page.locator('#caughtErrorBtn').click(), + firstErrorEventPromise, + ]); expect(firstErrorEvent).toMatchObject({ exception: { values: [ { - type: 'ReferenceError', - value: 'NonExistentComponent is not defined', + type: 'Error', + value: 'Error 1 thrown from Sentry ErrorBoundary in Solid E2E test app', mechanism: { type: 'generic', handled: true, @@ -45,15 +59,19 @@ test('captures a second exception after resetting the boundary', async ({ page } }, ], }, - transaction: '/error-boundary-example', + transaction: '/', }); const secondErrorEventPromise = waitForError('solid', errorEvent => { - return !errorEvent.type && errorEvent.transaction === '/error-boundary-example'; + return ( + !errorEvent.type && + errorEvent.exception?.values?.[0]?.value === 'Error 2 thrown from Sentry ErrorBoundary in Solid E2E test app' + ); }); - const [, secondErrorEvent] = await Promise.all([ + const [, , secondErrorEvent] = await Promise.all([ page.locator('#errorBoundaryResetBtn').click(), + page.locator('#caughtErrorBtn').click(), await secondErrorEventPromise, ]); @@ -61,8 +79,8 @@ test('captures a second exception after resetting the boundary', async ({ page } exception: { values: [ { - type: 'ReferenceError', - value: 'NonExistentComponent is not defined', + type: 'Error', + value: 'Error 2 thrown from Sentry ErrorBoundary in Solid E2E test app', mechanism: { type: 'generic', handled: true, @@ -70,6 +88,6 @@ test('captures a second exception after resetting the boundary', async ({ page } }, ], }, - transaction: '/error-boundary-example', + transaction: '/', }); }); diff --git a/dev-packages/e2e-tests/test-applications/solid/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/solid/tests/errors.test.ts index 8fb9d3d2513a..b8e2a759886a 100644 --- a/dev-packages/e2e-tests/test-applications/solid/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/solid/tests/errors.test.ts @@ -3,7 +3,7 @@ import { waitForError } from '@sentry-internal/test-utils'; test('sends an error', async ({ page }) => { const errorPromise = waitForError('solid', async errorEvent => { - return !errorEvent.type && errorEvent.transaction === '/'; + return !errorEvent.type && errorEvent.exception?.values?.[0]?.value === 'Error thrown from Solid E2E test app'; }); await Promise.all([page.goto(`/`), page.locator('#errorBtn').click()]); diff --git a/dev-packages/e2e-tests/test-applications/solid/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/solid/tests/performance.test.ts index f73ff4940527..a9bfbea82fb2 100644 --- a/dev-packages/e2e-tests/test-applications/solid/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/solid/tests/performance.test.ts @@ -21,71 +21,3 @@ test('sends a pageload transaction', async ({ page }) => { }, }); }); - -test('sends a navigation transaction', async ({ page }) => { - const transactionPromise = waitForTransaction('solid', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - await page.goto(`/`); - - const [, navigationTransaction] = await Promise.all([page.locator('#navLink').click(), transactionPromise]); - - expect(navigationTransaction).toMatchObject({ - contexts: { - trace: { - op: 'navigation', - origin: 'auto.navigation.solid.solidrouter', - }, - }, - transaction: '/user/5', - transaction_info: { - source: 'url', - }, - }); -}); - -test('updates the transaction when using the back button', async ({ page }) => { - // Solid Router sends a `-1` navigation when using the back button. - // The sentry solidRouterBrowserTracingIntegration tries to update such - // transactions with the proper name once the `useLocation` hook triggers. - const navigationTxnPromise = waitForTransaction('solid', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - await page.goto(`/`); - - const [, navigationTxn] = await Promise.all([page.locator('#navLink').click(), navigationTxnPromise]); - - expect(navigationTxn).toMatchObject({ - contexts: { - trace: { - op: 'navigation', - origin: 'auto.navigation.solid.solidrouter', - }, - }, - transaction: '/user/5', - transaction_info: { - source: 'url', - }, - }); - - const backNavigationTxnPromise = waitForTransaction('solid', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - const [, backNavigationTxn] = await Promise.all([page.goBack(), backNavigationTxnPromise]); - - expect(backNavigationTxn).toMatchObject({ - contexts: { - trace: { - op: 'navigation', - origin: 'auto.navigation.solid.solidrouter', - }, - }, - transaction: '/', - transaction_info: { - source: 'url', - }, - }); -});