From 3eafd31e676c833fe8cf7255af848c139c2a56ee Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 29 May 2024 15:22:13 +0200 Subject: [PATCH 1/8] ref: Refactor utils into `@sentry-internal/test-utils` Re-use this for playwright config in E2E tests. --- .github/workflows/canary.yml | 2 +- .../browser-integration-tests/package.json | 2 +- .../test-applications/angular-17/package.json | 7 +- .../angular-17/playwright.config.mjs | 8 ++ .../angular-17/playwright.config.ts | 72 -------------- .../test-applications/angular-17/src/main.ts | 2 +- .../angular-17/start-event-proxy.mjs | 2 +- .../angular-17/tests/errors.test.ts | 2 +- .../angular-17/tests/performance.test.ts | 2 +- .../test-applications/angular-18/package.json | 7 +- .../angular-18/playwright.config.mjs | 8 ++ .../angular-18/playwright.config.ts | 72 -------------- .../test-applications/angular-18/src/main.ts | 2 +- .../angular-18/start-event-proxy.mjs | 2 +- .../angular-18/tests/errors.test.ts | 2 +- .../angular-18/tests/performance.test.ts | 2 +- .../create-next-app/package.json | 2 +- .../package.json | 4 +- .../playwright.config.mjs | 7 ++ .../playwright.config.ts | 66 ------------- .../start-event-proxy.mjs | 2 +- .../tests/behaviour-server.test.ts | 2 +- .../create-remix-app-express/package.json | 4 +- .../playwright.config.mjs | 7 ++ .../playwright.config.ts | 65 ------------- .../start-event-proxy.mjs | 2 +- .../tests/behaviour-server.test.ts | 2 +- .../create-remix-app-v2/package.json | 4 +- .../create-remix-app-v2/playwright.config.mjs | 7 ++ .../create-remix-app-v2/playwright.config.ts | 66 ------------- .../create-remix-app-v2/start-event-proxy.mjs | 2 +- .../tests/behaviour-server.test.ts | 2 +- .../create-remix-app/package.json | 4 +- .../create-remix-app/playwright.config.mjs | 7 ++ .../create-remix-app/playwright.config.ts | 66 ------------- .../create-remix-app/start-event-proxy.mjs | 2 +- .../tests/behaviour-server.test.ts | 2 +- .../test-applications/nextjs-14/package.json | 4 +- .../nextjs-14/playwright.config.ts | 74 +-------------- .../nextjs-14/start-event-proxy.mjs | 2 +- .../tests/generation-functions.test.ts | 2 +- .../nextjs-14/tests/propagation.test.ts | 2 +- .../tests/request-instrumentation.test.ts | 2 +- .../test-applications/nextjs-15/package.json | 4 +- .../nextjs-15/playwright.config.mjs | 13 +++ .../nextjs-15/playwright.config.ts | 75 --------------- .../nextjs-15/start-event-proxy.mjs | 2 +- .../nextjs-15/tests/pageload-tracing.test.ts | 2 +- .../nextjs-15/tests/ppr-error.test.ts | 2 +- .../nextjs-15/tests/suspense-error.test.ts | 2 +- .../nextjs-app-dir/package.json | 7 +- .../nextjs-app-dir/playwright.config.mjs | 13 +++ .../nextjs-app-dir/playwright.config.ts | 77 --------------- .../nextjs-app-dir/start-event-proxy.mjs | 2 +- .../tests/async-context-edge.test.ts | 2 +- ...client-app-routing-instrumentation.test.ts | 2 +- .../connected-servercomponent-trace.test.ts | 2 +- .../tests/devErrorSymbolification.test.ts | 2 +- .../nextjs-app-dir/tests/edge-route.test.ts | 2 +- .../nextjs-app-dir/tests/edge.test.ts | 2 +- .../nextjs-app-dir/tests/exceptions.test.ts | 2 +- .../nextjs-app-dir/tests/middleware.test.ts | 2 +- .../tests/pages-ssr-errors.test.ts | 2 +- .../tests/request-instrumentation.test.ts | 2 +- .../tests/route-handlers.test.ts | 2 +- .../tests/server-components.test.ts | 2 +- .../nextjs-app-dir/tests/transactions.test.ts | 2 +- .../node-connect/package.json | 4 +- .../node-connect/playwright.config.mjs | 62 +----------- .../node-connect/start-event-proxy.mjs | 2 +- .../node-connect/tests/errors.test.ts | 2 +- .../node-connect/tests/transactions.test.ts | 2 +- .../node-express-cjs-preload/package.json | 4 +- .../playwright.config.mjs | 65 +------------ .../start-event-proxy.mjs | 2 +- .../tests/server.test.ts | 2 +- .../node-express-esm-loader/package.json | 4 +- .../playwright.config.mjs | 7 ++ .../playwright.config.ts | 65 ------------- .../start-event-proxy.mjs | 2 +- .../tests/server.test.ts | 2 +- .../node-express-esm-preload/package.json | 4 +- .../playwright.config.mjs | 65 +------------ .../start-event-proxy.mjs | 2 +- .../tests/server.test.ts | 2 +- .../package.json | 4 +- .../playwright.config.mjs | 7 ++ .../playwright.config.ts | 65 ------------- .../start-event-proxy.mjs | 2 +- .../tests/server.test.ts | 2 +- .../node-express-send-to-sentry/package.json | 2 +- .../node-express/package.json | 4 +- .../node-express/playwright.config.mjs | 7 ++ .../node-express/playwright.config.ts | 77 --------------- .../test-applications/node-express/src/app.ts | 2 +- .../node-express/start-event-proxy.mjs | 2 +- .../node-express/tests/errors.test.ts | 2 +- .../node-express/tests/transactions.test.ts | 2 +- .../node-express/tests/trpc.test.ts | 2 +- .../node-fastify/package.json | 4 +- .../node-fastify/playwright.config.mjs | 62 +----------- .../node-fastify/start-event-proxy.mjs | 2 +- .../node-fastify/tests/errors.test.ts | 2 +- .../node-fastify/tests/propagation.test.ts | 2 +- .../node-fastify/tests/transactions.test.ts | 2 +- .../test-applications/node-hapi/package.json | 8 +- .../node-hapi/playwright.config.mjs | 7 ++ .../node-hapi/playwright.config.ts | 77 --------------- .../test-applications/node-hapi/src/app.js | 2 +- .../node-hapi/start-event-proxy.mjs | 2 +- .../node-hapi/tests/errors.test.ts | 2 +- .../node-hapi/tests/transactions.test.ts | 2 +- .../test-applications/node-hapi/tsconfig.json | 10 -- .../test-applications/node-koa/index.js | 2 +- .../test-applications/node-koa/package.json | 4 +- .../node-koa/playwright.config.mjs | 7 ++ .../node-koa/playwright.config.ts | 77 --------------- .../node-koa/start-event-proxy.mjs | 2 +- .../node-koa/tests/errors.test.ts | 2 +- .../node-koa/tests/propagation.test.ts | 2 +- .../node-koa/tests/transactions.test.ts | 2 +- .../node-nestjs/package.json | 4 +- .../node-nestjs/playwright.config.mjs | 7 ++ .../node-nestjs/playwright.config.ts | 77 --------------- .../node-nestjs/start-event-proxy.mjs | 2 +- .../node-nestjs/tests/errors.test.ts | 2 +- .../node-nestjs/tests/propagation.test.ts | 2 +- .../node-nestjs/tests/transactions.test.ts | 2 +- .../test-applications/react-19/package.json | 4 +- .../react-19/playwright.config.mjs | 7 ++ .../react-19/playwright.config.ts | 82 ---------------- .../react-19/start-event-proxy.mjs | 2 +- .../react-19/tests/errors.test.ts | 2 +- .../react-create-hash-router/package.json | 7 +- .../playwright.config.mjs | 82 +--------------- .../react-create-hash-router/src/index.tsx | 2 +- .../start-event-proxy.mjs | 2 +- .../tests/errors.test.ts | 2 +- .../tests/transactions.test.ts | 2 +- .../react-router-5/package.json | 4 +- .../react-router-5/playwright.config.mjs | 7 ++ .../react-router-5/playwright.config.ts | 82 ---------------- .../react-router-5/start-event-proxy.mjs | 2 +- .../react-router-5/tests/errors.test.ts | 2 +- .../react-router-5/tests/transactions.test.ts | 2 +- .../react-router-6-use-routes/package.json | 4 +- .../playwright.config.mjs | 7 ++ .../playwright.config.ts | 82 ---------------- .../start-event-proxy.mjs | 2 +- .../tests/errors.test.ts | 2 +- .../tests/transactions.test.ts | 2 +- .../react-send-to-sentry/package.json | 2 +- .../playwright.config.mjs | 69 -------------- .../tests/fixtures/ReplayRecordingData.ts | 1 + .../standard-frontend-react/package.json | 2 +- .../test-applications/svelte-5/package.json | 7 +- .../svelte-5/playwright.config.mjs | 8 ++ .../svelte-5/playwright.config.ts | 72 -------------- .../test-applications/svelte-5/src/main.ts | 2 +- .../svelte-5/start-event-proxy.mjs | 2 +- .../svelte-5/{test => tests}/errors.test.ts | 2 +- .../{test => tests}/performance.test.ts | 2 +- .../sveltekit-2-svelte-5/package.json | 7 +- .../playwright.config.mjs | 8 ++ .../sveltekit-2-svelte-5/playwright.config.ts | 74 --------------- .../sveltekit-2-svelte-5/src/hooks.client.ts | 2 +- .../sveltekit-2-svelte-5/src/hooks.server.ts | 2 +- .../start-event-proxy.mjs | 2 +- .../test/errors.client.test.ts | 2 +- .../test/errors.server.test.ts | 2 +- .../test/performance.client.test.ts | 2 +- .../test/performance.server.test.ts | 2 +- .../test/performance.test.ts | 2 +- .../sveltekit-2-svelte-5/test/utils.ts | 2 +- .../sveltekit-2/package.json | 7 +- .../sveltekit-2/playwright.config.mjs | 13 +++ .../sveltekit-2/playwright.config.ts | 75 --------------- .../sveltekit-2/src/hooks.client.ts | 2 +- .../sveltekit-2/src/hooks.server.ts | 2 +- .../sveltekit-2/start-event-proxy.mjs | 2 +- .../{test => tests}/errors.client.test.ts | 2 +- .../{test => tests}/errors.server.test.ts | 2 +- .../performance.client.test.ts | 2 +- .../performance.server.test.ts | 2 +- .../{test => tests}/performance.test.ts | 2 +- .../sveltekit-2/{test => tests}/utils.ts | 2 +- .../test-applications/sveltekit/package.json | 4 +- .../sveltekit/playwright.config.mjs | 14 +++ .../sveltekit/playwright.config.ts | 73 -------------- .../sveltekit/src/hooks.client.ts | 2 +- .../sveltekit/src/hooks.server.ts | 2 +- .../sveltekit/start-event-proxy.mjs | 2 +- .../{test => tests}/errors.client.test.ts | 2 +- .../{test => tests}/errors.server.test.ts | 2 +- .../performance.client.test.ts | 2 +- .../performance.server.test.ts | 2 +- .../{test => tests}/performance.test.ts | 2 +- .../test-applications/sveltekit/utils.ts | 2 +- .../test-applications/vue-3/package.json | 4 +- .../vue-3/playwright.config.mjs | 8 ++ .../vue-3/playwright.config.ts | 69 -------------- .../test-applications/vue-3/src/main.ts | 2 +- .../vue-3/start-event-proxy.mjs | 2 +- .../vue-3/tests/errors.test.ts | 2 +- .../vue-3/tests/performance.test.ts | 2 +- .../vue-3/tsconfig.node.json | 2 +- .../test-applications/webpack-4/package.json | 2 +- .../test-applications/webpack-5/package.json | 2 +- dev-packages/event-proxy-server/tsconfig.json | 5 - .../.eslintrc.js | 0 .../package.json | 5 +- .../rollup.npm.config.mjs | 0 .../src/event-proxy-server.ts | 0 .../src/index.ts | 2 + .../test-utils/src/playwright-config.ts | 94 +++++++++++++++++++ dev-packages/test-utils/tsconfig.json | 8 ++ .../tsconfig.types.json | 0 package.json | 2 +- yarn.lock | 28 +++--- 219 files changed, 524 insertions(+), 2291 deletions(-) create mode 100644 dev-packages/e2e-tests/test-applications/angular-17/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/angular-17/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/angular-18/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/angular-18/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/create-remix-app-express/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/create-remix-app-express/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/create-remix-app-v2/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/create-remix-app-v2/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/create-remix-app/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/create-remix-app/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/nextjs-15/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/nextjs-15/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/node-express-esm-loader/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/node-express-esm-loader/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/node-express/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/node-express/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/node-hapi/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/node-hapi/playwright.config.ts delete mode 100644 dev-packages/e2e-tests/test-applications/node-hapi/tsconfig.json create mode 100644 dev-packages/e2e-tests/test-applications/node-koa/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/node-koa/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/node-nestjs/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/node-nestjs/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/react-19/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/react-19/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/react-router-5/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/react-router-5/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/react-router-6-use-routes/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/react-router-6-use-routes/playwright.config.ts delete mode 100644 dev-packages/e2e-tests/test-applications/react-send-to-sentry/playwright.config.mjs create mode 100644 dev-packages/e2e-tests/test-applications/svelte-5/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/svelte-5/playwright.config.ts rename dev-packages/e2e-tests/test-applications/svelte-5/{test => tests}/errors.test.ts (90%) rename dev-packages/e2e-tests/test-applications/svelte-5/{test => tests}/performance.test.ts (94%) create mode 100644 dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/playwright.config.ts create mode 100644 dev-packages/e2e-tests/test-applications/sveltekit-2/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/sveltekit-2/playwright.config.ts rename dev-packages/e2e-tests/test-applications/sveltekit-2/{test => tests}/errors.client.test.ts (96%) rename dev-packages/e2e-tests/test-applications/sveltekit-2/{test => tests}/errors.server.test.ts (96%) rename dev-packages/e2e-tests/test-applications/sveltekit-2/{test => tests}/performance.client.test.ts (98%) rename dev-packages/e2e-tests/test-applications/sveltekit-2/{test => tests}/performance.server.test.ts (93%) rename dev-packages/e2e-tests/test-applications/sveltekit-2/{test => tests}/performance.test.ts (99%) rename dev-packages/e2e-tests/test-applications/sveltekit-2/{test => tests}/utils.ts (95%) create mode 100644 dev-packages/e2e-tests/test-applications/sveltekit/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/sveltekit/playwright.config.ts rename dev-packages/e2e-tests/test-applications/sveltekit/{test => tests}/errors.client.test.ts (96%) rename dev-packages/e2e-tests/test-applications/sveltekit/{test => tests}/errors.server.test.ts (97%) rename dev-packages/e2e-tests/test-applications/sveltekit/{test => tests}/performance.client.test.ts (97%) rename dev-packages/e2e-tests/test-applications/sveltekit/{test => tests}/performance.server.test.ts (94%) rename dev-packages/e2e-tests/test-applications/sveltekit/{test => tests}/performance.test.ts (97%) create mode 100644 dev-packages/e2e-tests/test-applications/vue-3/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/vue-3/playwright.config.ts delete mode 100644 dev-packages/event-proxy-server/tsconfig.json rename dev-packages/{event-proxy-server => test-utils}/.eslintrc.js (100%) rename dev-packages/{event-proxy-server => test-utils}/package.json (91%) rename dev-packages/{event-proxy-server => test-utils}/rollup.npm.config.mjs (100%) rename dev-packages/{event-proxy-server => test-utils}/src/event-proxy-server.ts (100%) rename dev-packages/{event-proxy-server => test-utils}/src/index.ts (70%) create mode 100644 dev-packages/test-utils/src/playwright-config.ts create mode 100644 dev-packages/test-utils/tsconfig.json rename dev-packages/{event-proxy-server => test-utils}/tsconfig.types.json (100%) diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index 2cc7361374cd..152cb275ad13 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -14,7 +14,7 @@ env: CACHED_BUILD_PATHS: | ${{ github.workspace }}/packages/*/*.tgz - ${{ github.workspace }}/dev-packages/event-proxy-server/build + ${{ github.workspace }}/dev-packages/test-utils/build ${{ github.workspace }}/node_modules ${{ github.workspace }}/packages/*/node_modules ${{ github.workspace }}/dev-packages/*/node_modules diff --git a/dev-packages/browser-integration-tests/package.json b/dev-packages/browser-integration-tests/package.json index d64c2b2d1da8..ad80def32d0f 100644 --- a/dev-packages/browser-integration-tests/package.json +++ b/dev-packages/browser-integration-tests/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "@babel/preset-typescript": "^7.16.7", - "@playwright/test": "^1.43.1", + "@playwright/test": "^1.44.1", "@sentry-internal/rrweb": "2.11.0", "@sentry/browser": "8.7.0", "axios": "1.6.7", diff --git a/dev-packages/e2e-tests/test-applications/angular-17/package.json b/dev-packages/e2e-tests/test-applications/angular-17/package.json index 83450dc26987..b7e9b40c2a01 100644 --- a/dev-packages/e2e-tests/test-applications/angular-17/package.json +++ b/dev-packages/e2e-tests/test-applications/angular-17/package.json @@ -29,11 +29,11 @@ "zone.js": "~0.14.3" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@angular-devkit/build-angular": "^17.1.1", "@angular/cli": "^17.1.1", "@angular/compiler-cli": "^17.1.0", - "@playwright/test": "^1.41.1", "@types/jasmine": "~5.1.0", "http-server": "^14.1.1", "jasmine-core": "~5.1.0", @@ -42,8 +42,7 @@ "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", - "typescript": "~5.3.2", - "wait-port": "1.0.4" + "typescript": "~5.3.2" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/angular-17/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/angular-17/playwright.config.mjs new file mode 100644 index 000000000000..0845325879c9 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/angular-17/playwright.config.mjs @@ -0,0 +1,8 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm preview`, + port: 8080, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/angular-17/playwright.config.ts b/dev-packages/e2e-tests/test-applications/angular-17/playwright.config.ts deleted file mode 100644 index b2ee35fdc4c7..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-17/playwright.config.ts +++ /dev/null @@ -1,72 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const testEnv = process.env['TEST_ENV'] || 'production'; - -if (!testEnv) { - throw new Error('No test env defined'); -} - -const angularPort = 8080; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - fullyParallel: false, - workers: 1, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* `next dev` is incredibly buggy with the app dir */ - retries: testEnv === 'development' ? 3 : 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${angularPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: - testEnv === 'development' - ? `pnpm wait-port ${eventProxyPort} && pnpm preview -p ${angularPort}` - : `pnpm wait-port ${eventProxyPort} && pnpm preview -p ${angularPort}`, - port: angularPort, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/angular-17/src/main.ts b/dev-packages/e2e-tests/test-applications/angular-17/src/main.ts index 947f40691b05..2bccc92d0d91 100644 --- a/dev-packages/e2e-tests/test-applications/angular-17/src/main.ts +++ b/dev-packages/e2e-tests/test-applications/angular-17/src/main.ts @@ -9,7 +9,7 @@ Sentry.init({ tracesSampleRate: 1.0, integrations: [Sentry.browserTracingIntegration({})], tunnel: `http://localhost:3031/`, // proxy server - debug: true, + debug: !!process.env.DEBUG, }); bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err)); diff --git a/dev-packages/e2e-tests/test-applications/angular-17/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/angular-17/start-event-proxy.mjs index 7bf4c4417f3c..d757918ea495 100644 --- a/dev-packages/e2e-tests/test-applications/angular-17/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/angular-17/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/angular-17/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/angular-17/tests/errors.test.ts index 28e07284b435..e6bd5ad180a9 100644 --- a/dev-packages/e2e-tests/test-applications/angular-17/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/angular-17/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('sends an error', async ({ page }) => { const errorPromise = waitForError('angular-17', async errorEvent => { diff --git a/dev-packages/e2e-tests/test-applications/angular-17/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/angular-17/tests/performance.test.ts index 7873af286315..29c88a6108e2 100644 --- a/dev-packages/e2e-tests/test-applications/angular-17/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/angular-17/tests/performance.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { diff --git a/dev-packages/e2e-tests/test-applications/angular-18/package.json b/dev-packages/e2e-tests/test-applications/angular-18/package.json index 1c2bf8b723cb..9b632d69f834 100644 --- a/dev-packages/e2e-tests/test-applications/angular-18/package.json +++ b/dev-packages/e2e-tests/test-applications/angular-18/package.json @@ -29,11 +29,11 @@ "zone.js": "~0.14.3" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@angular-devkit/build-angular": "^18.0.0", "@angular/cli": "^18.0.0", "@angular/compiler-cli": "^18.0.0", - "@playwright/test": "^1.41.1", "@types/jasmine": "~5.1.0", "http-server": "^14.1.1", "jasmine-core": "~5.1.0", @@ -42,8 +42,7 @@ "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", - "typescript": "~5.4.5", - "wait-port": "1.0.4" + "typescript": "~5.4.5" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/angular-18/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/angular-18/playwright.config.mjs new file mode 100644 index 000000000000..0845325879c9 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/angular-18/playwright.config.mjs @@ -0,0 +1,8 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm preview`, + port: 8080, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/angular-18/playwright.config.ts b/dev-packages/e2e-tests/test-applications/angular-18/playwright.config.ts deleted file mode 100644 index b2ee35fdc4c7..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-18/playwright.config.ts +++ /dev/null @@ -1,72 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const testEnv = process.env['TEST_ENV'] || 'production'; - -if (!testEnv) { - throw new Error('No test env defined'); -} - -const angularPort = 8080; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - fullyParallel: false, - workers: 1, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* `next dev` is incredibly buggy with the app dir */ - retries: testEnv === 'development' ? 3 : 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${angularPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: - testEnv === 'development' - ? `pnpm wait-port ${eventProxyPort} && pnpm preview -p ${angularPort}` - : `pnpm wait-port ${eventProxyPort} && pnpm preview -p ${angularPort}`, - port: angularPort, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/angular-18/src/main.ts b/dev-packages/e2e-tests/test-applications/angular-18/src/main.ts index 947f40691b05..2bccc92d0d91 100644 --- a/dev-packages/e2e-tests/test-applications/angular-18/src/main.ts +++ b/dev-packages/e2e-tests/test-applications/angular-18/src/main.ts @@ -9,7 +9,7 @@ Sentry.init({ tracesSampleRate: 1.0, integrations: [Sentry.browserTracingIntegration({})], tunnel: `http://localhost:3031/`, // proxy server - debug: true, + debug: !!process.env.DEBUG, }); bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err)); diff --git a/dev-packages/e2e-tests/test-applications/angular-18/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/angular-18/start-event-proxy.mjs index 696f1807d8f1..b1b4620866bd 100644 --- a/dev-packages/e2e-tests/test-applications/angular-18/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/angular-18/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/angular-18/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/angular-18/tests/errors.test.ts index a255d2130dda..36d23bd077a5 100644 --- a/dev-packages/e2e-tests/test-applications/angular-18/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/angular-18/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('sends an error', async ({ page }) => { const errorPromise = waitForError('angular-18', async errorEvent => { diff --git a/dev-packages/e2e-tests/test-applications/angular-18/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/angular-18/tests/performance.test.ts index 12f0fbd41133..af85b8ffc405 100644 --- a/dev-packages/e2e-tests/test-applications/angular-18/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/angular-18/tests/performance.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { diff --git a/dev-packages/e2e-tests/test-applications/create-next-app/package.json b/dev-packages/e2e-tests/test-applications/create-next-app/package.json index 74c257558846..330e8b4097ee 100644 --- a/dev-packages/e2e-tests/test-applications/create-next-app/package.json +++ b/dev-packages/e2e-tests/test-applications/create-next-app/package.json @@ -23,7 +23,7 @@ "typescript": "4.9.5" }, "devDependencies": { - "@playwright/test": "^1.27.1" + "@playwright/test": "^1.44.1" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/package.json index 7fc1d1492746..5ba4b54d8e8f 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/package.json @@ -25,8 +25,8 @@ "react-dom": "^18.2.0" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.36.2", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@remix-run/dev": "^2.7.2", "@sentry/types": "latest || *", "@sentry/utils": "latest || *", diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/playwright.config.mjs new file mode 100644 index 000000000000..e8fa4cd769f5 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm dev`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/playwright.config.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/playwright.config.ts deleted file mode 100644 index 98a4990f1a0a..000000000000 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/playwright.config.ts +++ /dev/null @@ -1,66 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const port = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Opt out of parallel tests on CI. */ - workers: 1, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${port}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: `PORT=${port} pnpm dev`, - port: port, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/start-event-proxy.mjs index b5d188ee00e1..68de708d14e2 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/behaviour-server.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/behaviour-server.test.ts index 428dcb6d8668..c2e2873f60c6 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/behaviour-server.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/behaviour-server.test.ts @@ -1,7 +1,7 @@ import { expect, test } from '@playwright/test'; import { uuid4 } from '@sentry/utils'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Sends two linked transactions (server & client) to Sentry', async ({ page }) => { // We use this to identify the transactions diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json index abad042bed58..c66fc8ace66e 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json @@ -28,8 +28,8 @@ "source-map-support": "^0.5.21" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.36.2", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@remix-run/dev": "^2.7.2", "@sentry/types": "latest || *", "@sentry/utils": "latest || *", diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/create-remix-app-express/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express/playwright.config.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-express/playwright.config.ts deleted file mode 100644 index 2e6c8f7ed757..000000000000 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express/playwright.config.ts +++ /dev/null @@ -1,65 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const remixPort = 3030; -const eventProxyPort = 3031; -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Opt out of parallel tests on CI. */ - workers: 1, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - baseURL: `http://localhost:${remixPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - // For now we only test Chrome! - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: `PORT=${remixPort} pnpm start`, - port: remixPort, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/create-remix-app-express/start-event-proxy.mjs index 523be8956871..58e992f8efb6 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/behaviour-server.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/behaviour-server.test.ts index 83582d68bf39..18825fb95e7b 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/behaviour-server.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/behaviour-server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; import { uuid4 } from '@sentry/utils'; test('Sends a loader error to Sentry', async ({ page }) => { diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/package.json index c3c98bd34ab4..a5f932f7cab4 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/package.json @@ -21,8 +21,8 @@ "react-dom": "^18.2.0" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.36.2", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@remix-run/dev": "2.7.2", "@remix-run/eslint-config": "2.7.2", "@sentry/types": "latest || *", diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/playwright.config.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/playwright.config.ts deleted file mode 100644 index d74250f31694..000000000000 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/playwright.config.ts +++ /dev/null @@ -1,66 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const port = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Opt out of parallel tests on CI. */ - workers: 1, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${port}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: `PORT=${port} pnpm start`, - port: port, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/start-event-proxy.mjs index 1a25f48c1e07..f48c36f3a495 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/behaviour-server.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/behaviour-server.test.ts index 42a5344c5e79..9387cec33752 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/behaviour-server.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/behaviour-server.test.ts @@ -1,7 +1,7 @@ import { expect, test } from '@playwright/test'; import { uuid4 } from '@sentry/utils'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Sends two linked transactions (server & client) to Sentry', async ({ page }) => { // We use this to identify the transactions diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app/package.json index f794844afe9e..d70c8f824dbc 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app/package.json @@ -21,8 +21,8 @@ "react-dom": "^18.2.0" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.36.2", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@remix-run/dev": "^1.19.3", "@remix-run/eslint-config": "^1.19.3", "@types/react": "^18.0.35", diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/create-remix-app/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/create-remix-app/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app/playwright.config.ts b/dev-packages/e2e-tests/test-applications/create-remix-app/playwright.config.ts deleted file mode 100644 index d74250f31694..000000000000 --- a/dev-packages/e2e-tests/test-applications/create-remix-app/playwright.config.ts +++ /dev/null @@ -1,66 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const port = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Opt out of parallel tests on CI. */ - workers: 1, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${port}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: `PORT=${port} pnpm start`, - port: port, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/create-remix-app/start-event-proxy.mjs index b8502df2e077..de34c7e196b6 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/create-remix-app/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app/tests/behaviour-server.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app/tests/behaviour-server.test.ts index 3001f3c559ff..5107990507e4 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app/tests/behaviour-server.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app/tests/behaviour-server.test.ts @@ -1,7 +1,7 @@ import { expect, test } from '@playwright/test'; import { uuid4 } from '@sentry/utils'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Sends two linked transactions (server & client) to Sentry', async ({ page }) => { // We use this to identify the transactions diff --git a/dev-packages/e2e-tests/test-applications/nextjs-14/package.json b/dev-packages/e2e-tests/test-applications/nextjs-14/package.json index b5025e7b1232..4e14d6f1819a 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-14/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-14/package.json @@ -13,7 +13,6 @@ "test:assert": "pnpm test:prod && pnpm test:dev" }, "dependencies": { - "@playwright/test": "^1.27.1", "@sentry/nextjs": "latest || *", "@types/node": "18.11.17", "@types/react": "18.0.26", @@ -25,7 +24,8 @@ "wait-port": "1.0.4" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry-internal/feedback": "latest || *", "@sentry-internal/replay-canvas": "latest || *", "@sentry-internal/browser-utils": "latest || *", diff --git a/dev-packages/e2e-tests/test-applications/nextjs-14/playwright.config.ts b/dev-packages/e2e-tests/test-applications/nextjs-14/playwright.config.ts index bf1fc94f4292..c675d003853a 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-14/playwright.config.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-14/playwright.config.ts @@ -1,77 +1,13 @@ -import os from 'os'; -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; const testEnv = process.env.TEST_ENV; if (!testEnv) { throw new Error('No test env defined'); } -const nextPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 30_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Defaults to half the number of CPUs. The tests are not really CPU-bound but rather I/O-bound with all the polling we do so we increase the concurrency to the CPU count. */ - workers: os.cpus().length, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* `next dev` is incredibly buggy with the app dir */ - retries: testEnv === 'development' ? 3 : 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${nextPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: - testEnv === 'development' - ? `pnpm wait-port ${eventProxyPort} && pnpm next dev -p ${nextPort}` - : `pnpm wait-port ${eventProxyPort} && pnpm next start -p ${nextPort}`, - port: nextPort, - stdout: 'pipe', - stderr: 'pipe', - }, - ], -}; +const config = getPlaywrightConfig({ + startCommand: testEnv === 'development' ? 'pnpm next dev -p 3030' : 'pnpm next start -p 3030', + port: 3030, +}); export default config; diff --git a/dev-packages/e2e-tests/test-applications/nextjs-14/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/nextjs-14/start-event-proxy.mjs index 476672c34359..39babfb19b2a 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-14/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/nextjs-14/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-14/tests/generation-functions.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-14/tests/generation-functions.test.ts index 93eba1fb7537..7739e9ac17de 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-14/tests/generation-functions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-14/tests/generation-functions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Should send a transaction event for a generateMetadata() function invokation', async ({ page }) => { const testTitle = 'foobarasdf'; diff --git a/dev-packages/e2e-tests/test-applications/nextjs-14/tests/propagation.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-14/tests/propagation.test.ts index 2653d57ca179..26395d6e0145 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-14/tests/propagation.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-14/tests/propagation.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Propagates trace for outgoing http requests', async ({ baseURL, request }) => { const inboundTransactionPromise = waitForTransaction('nextjs-14', transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-14/tests/request-instrumentation.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-14/tests/request-instrumentation.test.ts index 6beb6f531d11..be6bfab11b84 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-14/tests/request-instrumentation.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-14/tests/request-instrumentation.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Should send a transaction with a fetch span', async ({ page }) => { const transactionPromise = waitForTransaction('nextjs-14', async transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/package.json b/dev-packages/e2e-tests/test-applications/nextjs-15/package.json index dc1d111ee393..e1c1a84d14b2 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/package.json @@ -13,7 +13,6 @@ "test:assert": "pnpm test:prod && pnpm test:dev" }, "dependencies": { - "@playwright/test": "^1.27.1", "@sentry/nextjs": "latest || *", "@types/node": "18.11.17", "@types/react": "18.0.26", @@ -25,7 +24,8 @@ "wait-port": "1.0.4" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry-internal/feedback": "latest || *", "@sentry-internal/replay-canvas": "latest || *", "@sentry-internal/browser-utils": "latest || *", diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/nextjs-15/playwright.config.mjs new file mode 100644 index 000000000000..c675d003853a --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/playwright.config.mjs @@ -0,0 +1,13 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; +const testEnv = process.env.TEST_ENV; + +if (!testEnv) { + throw new Error('No test env defined'); +} + +const config = getPlaywrightConfig({ + startCommand: testEnv === 'development' ? 'pnpm next dev -p 3030' : 'pnpm next start -p 3030', + port: 3030, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/playwright.config.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/playwright.config.ts deleted file mode 100644 index ab02599b8f4f..000000000000 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/playwright.config.ts +++ /dev/null @@ -1,75 +0,0 @@ -import os from 'os'; -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const testEnv = process.env.TEST_ENV; - -if (!testEnv) { - throw new Error('No test env defined'); -} - -const nextPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 30_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Defaults to half the number of CPUs. The tests are not really CPU-bound but rather I/O-bound with all the polling we do so we increase the concurrency to the CPU count. */ - workers: os.cpus().length, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* `next dev` is incredibly buggy with the app dir */ - retries: testEnv === 'development' ? 3 : 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${nextPort}`, - trace: 'retain-on-failure', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: - testEnv === 'development' - ? `pnpm wait-port ${eventProxyPort} && pnpm next dev -p ${nextPort}` - : `pnpm wait-port ${eventProxyPort} && pnpm next start -p ${nextPort}`, - port: nextPort, - stdout: 'pipe', - stderr: 'pipe', - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/nextjs-15/start-event-proxy.mjs index 56744b35c7e6..90d736790faa 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/pageload-tracing.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/pageload-tracing.test.ts index 7893633d3b48..38325fa6a0e0 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/pageload-tracing.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/pageload-tracing.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('all server component transactions should be attached to the pageload request span', async ({ page }) => { const pageServerComponentTransactionPromise = waitForTransaction('nextjs-15', async transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/ppr-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/ppr-error.test.ts index 1e266fa02541..6fc1a6716127 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/ppr-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/ppr-error.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('should not capture React-internal errors for PPR rendering', async ({ page }) => { const pageServerComponentTransactionPromise = waitForTransaction('nextjs-15', async transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/suspense-error.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/suspense-error.test.ts index ddbc4a9edee3..6c9a58dab4f3 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/tests/suspense-error.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/tests/suspense-error.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('should not capture serverside suspense errors', async ({ page }) => { const pageServerComponentTransactionPromise = waitForTransaction('nextjs-15', async transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/package.json b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/package.json index 925ee97e79f7..4e47e84efc8b 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/package.json @@ -23,12 +23,11 @@ "next": "14.0.2", "react": "18.2.0", "react-dom": "18.2.0", - "typescript": "4.9.5", - "wait-port": "1.0.4", - "@playwright/test": "^1.27.1" + "typescript": "4.9.5" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry-internal/feedback": "latest || *", "@sentry-internal/replay-canvas": "latest || *", "@sentry-internal/browser-utils": "latest || *", diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.mjs new file mode 100644 index 000000000000..c675d003853a --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.mjs @@ -0,0 +1,13 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; +const testEnv = process.env.TEST_ENV; + +if (!testEnv) { + throw new Error('No test env defined'); +} + +const config = getPlaywrightConfig({ + startCommand: testEnv === 'development' ? 'pnpm next dev -p 3030' : 'pnpm next start -p 3030', + port: 3030, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.ts deleted file mode 100644 index a6fbfdc882cf..000000000000 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.ts +++ /dev/null @@ -1,77 +0,0 @@ -import os from 'os'; -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const testEnv = process.env.TEST_ENV; - -if (!testEnv) { - throw new Error('No test env defined'); -} - -const nextPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - /* Defaults to half the number of CPUs. The tests are not really CPU-bound but rather I/O-bound with all the polling we do so we increase the concurrency to the CPU count. */ - workers: os.cpus().length, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* `next dev` is incredibly buggy with the app dir */ - retries: testEnv === 'development' ? 3 : 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${nextPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: - testEnv === 'development' - ? `pnpm wait-port ${eventProxyPort} && pnpm next dev -p ${nextPort}` - : `pnpm wait-port ${eventProxyPort} && pnpm next start -p ${nextPort}`, - port: nextPort, - stdout: 'pipe', - stderr: 'pipe', - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/start-event-proxy.mjs index d908b1d1c737..4d029c3b87be 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/async-context-edge.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/async-context-edge.test.ts index 4696534e1733..e5fea269e322 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/async-context-edge.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/async-context-edge.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Should allow for async context isolation in the edge SDK', async ({ request }) => { // test.skip(process.env.TEST_ENV === 'development', "Doesn't work in dev mode."); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-app-routing-instrumentation.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-app-routing-instrumentation.test.ts index 6fd69315b264..5e8e89eec3d8 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-app-routing-instrumentation.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/client-app-routing-instrumentation.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Creates a pageload transaction for app router routes', async ({ page }) => { const randomRoute = String(Math.random()); diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/connected-servercomponent-trace.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/connected-servercomponent-trace.test.ts index c63348304cda..09a18791db1f 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/connected-servercomponent-trace.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/connected-servercomponent-trace.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Will capture a connected trace for all server components and generation functions when visiting a page', async ({ page, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/devErrorSymbolification.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/devErrorSymbolification.test.ts index cb2612c09403..e4b122521c2d 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/devErrorSymbolification.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/devErrorSymbolification.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test.describe('dev mode error symbolification', () => { if (process.env.TEST_ENV !== 'development') { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge-route.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge-route.test.ts index 4b9c807f082c..df0dda64c4ba 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge-route.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge-route.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Should create a transaction for edge routes', async ({ request }) => { const edgerouteTransactionPromise = waitForTransaction('nextjs-13-app-dir', async transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts index e8070ea64b20..f6c0e7f5bad4 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/edge.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Should record exceptions for faulty edge server components', async ({ page }) => { const errorEventPromise = waitForError('nextjs-13-app-dir', errorEvent => { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/exceptions.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/exceptions.test.ts index 17262be631c2..4f0f4a6abfce 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/exceptions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/exceptions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; const authToken = process.env.E2E_TEST_AUTH_TOKEN; const sentryTestOrgSlug = process.env.E2E_TEST_SENTRY_ORG_SLUG; diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/middleware.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/middleware.test.ts index b457b4bcbdee..2a7b2deab27c 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/middleware.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/middleware.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Should create a transaction for middleware', async ({ request }) => { const middlewareTransactionPromise = waitForTransaction('nextjs-13-app-dir', async transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/pages-ssr-errors.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/pages-ssr-errors.test.ts index 3e6396c4a618..9cd49e58990f 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/pages-ssr-errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/pages-ssr-errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Will capture error for SSR rendering error with a connected trace (Class Component)', async ({ page }) => { const errorEventPromise = waitForError('nextjs-13-app-dir', errorEvent => { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/request-instrumentation.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/request-instrumentation.test.ts index bd6a27cecced..8d07d0192f44 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/request-instrumentation.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/request-instrumentation.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; // Note(lforst): I officially declare bancruptcy on this test. I tried a million ways to make it work but it kept flaking. // Sometimes the request span was included in the handler span, more often it wasn't. I have no idea why. Maybe one day we will diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/route-handlers.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/route-handlers.test.ts index d47d0adaea74..d10f402c0c17 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/route-handlers.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/route-handlers.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Should create a transaction for route handlers', async ({ request }) => { const routehandlerTransactionPromise = waitForTransaction('nextjs-13-app-dir', async transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts index d33a5b535508..9c28f78510da 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; const authToken = process.env.E2E_TEST_AUTH_TOKEN; const sentryTestOrgSlug = process.env.E2E_TEST_SENTRY_ORG_SLUG; diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts index 4e5415db657d..4d0f71ac9d97 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; const packageJson = require('../package.json'); diff --git a/dev-packages/e2e-tests/test-applications/node-connect/package.json b/dev-packages/e2e-tests/test-applications/node-connect/package.json index 24ecbcea1b02..e13c082ef646 100644 --- a/dev-packages/e2e-tests/test-applications/node-connect/package.json +++ b/dev-packages/e2e-tests/test-applications/node-connect/package.json @@ -22,8 +22,8 @@ "ts-node": "10.9.1" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.38.1" + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/node-connect/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/node-connect/playwright.config.mjs index ba0e0c6eb001..31f2b913b58b 100644 --- a/dev-packages/e2e-tests/test-applications/node-connect/playwright.config.mjs +++ b/dev-packages/e2e-tests/test-applications/node-connect/playwright.config.mjs @@ -1,61 +1,7 @@ -import { devices } from '@playwright/test'; +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; -const connectPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - retries: 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${connectPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: 'pnpm start', - port: connectPort, - }, - ], -}; +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-connect/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/node-connect/start-event-proxy.mjs index cac2f8db1f82..9ae7c07950d4 100644 --- a/dev-packages/e2e-tests/test-applications/node-connect/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/node-connect/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/node-connect/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/node-connect/tests/errors.test.ts index 0ae0b8c017e2..e0b39ed16bc5 100644 --- a/dev-packages/e2e-tests/test-applications/node-connect/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-connect/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test('Sends correct error event', async ({ baseURL }) => { const errorEventPromise = waitForError('node-connect', event => { diff --git a/dev-packages/e2e-tests/test-applications/node-connect/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-connect/tests/transactions.test.ts index 8a95f4b12c6f..aa868ceab291 100644 --- a/dev-packages/e2e-tests/test-applications/node-connect/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-connect/tests/transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; const authToken = process.env.E2E_TEST_AUTH_TOKEN; const sentryTestOrgSlug = process.env.E2E_TEST_SENTRY_ORG_SLUG; diff --git a/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/package.json b/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/package.json index 660d5147bb27..5a3074df94eb 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/package.json +++ b/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/package.json @@ -14,8 +14,8 @@ "express": "4.19.2" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.27.1" + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/playwright.config.mjs index 847f270e5f32..31f2b913b58b 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/playwright.config.mjs +++ b/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/playwright.config.mjs @@ -1,64 +1,7 @@ -import { devices } from '@playwright/test'; +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; -const eventProxyPort = 3031; -const expressPort = 3030; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${expressPort}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - stdout: 'pipe', - stderr: 'pipe', - }, - { - command: 'pnpm start', - port: expressPort, - stdout: 'pipe', - stderr: 'pipe', - }, - ], -}; +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/start-event-proxy.mjs index e2b0f5436f3d..ae2ce096fdba 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/tests/server.test.ts b/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/tests/server.test.ts index 3ca97ad0b207..5b8fd26f1647 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/tests/server.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-express-cjs-preload/tests/server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Should record exceptions captured inside handlers', async ({ request }) => { const errorEventPromise = waitForError('node-express-cjs-preload', errorEvent => { diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-loader/package.json b/dev-packages/e2e-tests/test-applications/node-express-esm-loader/package.json index e05d8711ff33..61fc40619560 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-loader/package.json +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-loader/package.json @@ -14,8 +14,8 @@ "express": "4.19.2" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.27.1" + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-loader/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/node-express-esm-loader/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-loader/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-loader/playwright.config.ts b/dev-packages/e2e-tests/test-applications/node-express-esm-loader/playwright.config.ts deleted file mode 100644 index c13cac26ba9a..000000000000 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-loader/playwright.config.ts +++ /dev/null @@ -1,65 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const eventProxyPort = 3031; -const expressPort = 3030; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${expressPort}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - stdout: 'pipe', - stderr: 'pipe', - }, - { - command: 'pnpm start', - port: expressPort, - stdout: 'pipe', - stderr: 'pipe', - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-loader/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/node-express-esm-loader/start-event-proxy.mjs index ae508f6ea13c..fae085c1cc86 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-loader/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-loader/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-loader/tests/server.test.ts b/dev-packages/e2e-tests/test-applications/node-express-esm-loader/tests/server.test.ts index 410ff414f908..3b65819e2c29 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-loader/tests/server.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-loader/tests/server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Should record exceptions captured inside handlers', async ({ request }) => { const errorEventPromise = waitForError('node-express-esm-loader', errorEvent => { diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-preload/package.json b/dev-packages/e2e-tests/test-applications/node-express-esm-preload/package.json index 3f2310549513..df6fcaf29adc 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-preload/package.json +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-preload/package.json @@ -14,8 +14,8 @@ "express": "4.19.2" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.27.1" + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-preload/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/node-express-esm-preload/playwright.config.mjs index 847f270e5f32..31f2b913b58b 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-preload/playwright.config.mjs +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-preload/playwright.config.mjs @@ -1,64 +1,7 @@ -import { devices } from '@playwright/test'; +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; -const eventProxyPort = 3031; -const expressPort = 3030; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${expressPort}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - stdout: 'pipe', - stderr: 'pipe', - }, - { - command: 'pnpm start', - port: expressPort, - stdout: 'pipe', - stderr: 'pipe', - }, - ], -}; +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-preload/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/node-express-esm-preload/start-event-proxy.mjs index 6b5d011dcb03..152218840a7a 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-preload/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-preload/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-preload/tests/server.test.ts b/dev-packages/e2e-tests/test-applications/node-express-esm-preload/tests/server.test.ts index 19803d7b3a7f..f1b06f9d0304 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-preload/tests/server.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-preload/tests/server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Should record exceptions captured inside handlers', async ({ request }) => { const errorEventPromise = waitForError('node-express-esm-preload', errorEvent => { diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/package.json b/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/package.json index 8b8a34966174..7939cf85a7ca 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/package.json +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/package.json @@ -14,8 +14,8 @@ "express": "4.19.2" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.27.1" + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/playwright.config.ts b/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/playwright.config.ts deleted file mode 100644 index c13cac26ba9a..000000000000 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/playwright.config.ts +++ /dev/null @@ -1,65 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const eventProxyPort = 3031; -const expressPort = 3030; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${expressPort}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - stdout: 'pipe', - stderr: 'pipe', - }, - { - command: 'pnpm start', - port: expressPort, - stdout: 'pipe', - stderr: 'pipe', - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/start-event-proxy.mjs index df0fdb65c929..b36c9d280735 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/tests/server.test.ts b/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/tests/server.test.ts index eeeb033a42df..377015070b45 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/tests/server.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-express-esm-without-loader/tests/server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test('Should record exceptions captured inside handlers', async ({ request }) => { const errorEventPromise = waitForError('node-express-esm-without-loader', errorEvent => { diff --git a/dev-packages/e2e-tests/test-applications/node-express-send-to-sentry/package.json b/dev-packages/e2e-tests/test-applications/node-express-send-to-sentry/package.json index 1a10d88b0bb8..96f61837c597 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-send-to-sentry/package.json +++ b/dev-packages/e2e-tests/test-applications/node-express-send-to-sentry/package.json @@ -20,7 +20,7 @@ "typescript": "4.9.5" }, "devDependencies": { - "@playwright/test": "^1.27.1" + "@playwright/test": "^1.44.1" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/node-express/package.json b/dev-packages/e2e-tests/test-applications/node-express/package.json index c59865a69266..34643b63553e 100644 --- a/dev-packages/e2e-tests/test-applications/node-express/package.json +++ b/dev-packages/e2e-tests/test-applications/node-express/package.json @@ -23,8 +23,8 @@ "zod": "~3.22.4" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.27.1" + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/node-express/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/node-express/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/node-express/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-express/playwright.config.ts b/dev-packages/e2e-tests/test-applications/node-express/playwright.config.ts deleted file mode 100644 index 5edd64b3c768..000000000000 --- a/dev-packages/e2e-tests/test-applications/node-express/playwright.config.ts +++ /dev/null @@ -1,77 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const eventProxyPort = 3031; -const expressPort = 3030; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${expressPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - // For now we only test Chrome! - // { - // name: 'firefox', - // use: { - // ...devices['Desktop Firefox'], - // }, - // }, - // { - // name: 'webkit', - // use: { - // ...devices['Desktop Safari'], - // }, - // }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: 'pnpm start', - port: expressPort, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-express/src/app.ts b/dev-packages/e2e-tests/test-applications/node-express/src/app.ts index 45cf88c5f212..de240b761df0 100644 --- a/dev-packages/e2e-tests/test-applications/node-express/src/app.ts +++ b/dev-packages/e2e-tests/test-applications/node-express/src/app.ts @@ -10,7 +10,7 @@ Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: process.env.E2E_TEST_DSN, includeLocalVariables: true, - debug: true, + debug: !!process.env.DEBUG, tunnel: `http://localhost:3031/`, // proxy server tracesSampleRate: 1, }); diff --git a/dev-packages/e2e-tests/test-applications/node-express/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/node-express/start-event-proxy.mjs index a31586dd09fc..3276781a442a 100644 --- a/dev-packages/e2e-tests/test-applications/node-express/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/node-express/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/node-express/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/node-express/tests/errors.test.ts index 4b7c3c71edc6..0a61c8665e30 100644 --- a/dev-packages/e2e-tests/test-applications/node-express/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-express/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test('Sends correct error event', async ({ baseURL }) => { const errorEventPromise = waitForError('node-express', event => { diff --git a/dev-packages/e2e-tests/test-applications/node-express/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-express/tests/transactions.test.ts index ec28035f0d38..8e7fb9fce515 100644 --- a/dev-packages/e2e-tests/test-applications/node-express/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-express/tests/transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Sends an API route transaction', async ({ baseURL }) => { const pageloadTransactionEventPromise = waitForTransaction('node-express', transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/node-express/tests/trpc.test.ts b/dev-packages/e2e-tests/test-applications/node-express/tests/trpc.test.ts index 368f14bd43ee..4f274fdc16ae 100644 --- a/dev-packages/e2e-tests/test-applications/node-express/tests/trpc.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-express/tests/trpc.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; import { createTRPCProxyClient, httpBatchLink } from '@trpc/client'; import type { AppRouter } from '../src/app'; diff --git a/dev-packages/e2e-tests/test-applications/node-fastify/package.json b/dev-packages/e2e-tests/test-applications/node-fastify/package.json index 1a35474e1bba..c862a9b7037b 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify/package.json +++ b/dev-packages/e2e-tests/test-applications/node-fastify/package.json @@ -22,8 +22,8 @@ "ts-node": "10.9.1" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.44.0" + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/node-fastify/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/node-fastify/playwright.config.mjs index 858e6aec7ef2..31f2b913b58b 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify/playwright.config.mjs +++ b/dev-packages/e2e-tests/test-applications/node-fastify/playwright.config.mjs @@ -1,61 +1,7 @@ -import { devices } from '@playwright/test'; +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; -const fastifyPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - retries: 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${fastifyPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: 'pnpm start', - port: fastifyPort, - }, - ], -}; +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-fastify/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/node-fastify/start-event-proxy.mjs index e627ce9a8bef..814357a4d413 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/node-fastify/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/node-fastify/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/node-fastify/tests/errors.test.ts index 3bd2584c6b22..eb1a9eb869e0 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-fastify/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test('Sends correct error event', async ({ baseURL }) => { const errorEventPromise = waitForError('node-fastify', event => { diff --git a/dev-packages/e2e-tests/test-applications/node-fastify/tests/propagation.test.ts b/dev-packages/e2e-tests/test-applications/node-fastify/tests/propagation.test.ts index 6900e4d09cd2..d2e9a188da9f 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify/tests/propagation.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-fastify/tests/propagation.test.ts @@ -1,6 +1,6 @@ import crypto from 'crypto'; import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; import { SpanJSON } from '@sentry/types'; test('Propagates trace for outgoing http requests', async ({ baseURL }) => { diff --git a/dev-packages/e2e-tests/test-applications/node-fastify/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-fastify/tests/transactions.test.ts index ee1e6effbc71..aa4704a1d950 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-fastify/tests/transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Sends an API route transaction', async ({ baseURL }) => { const pageloadTransactionEventPromise = waitForTransaction('node-fastify', transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/node-hapi/package.json b/dev-packages/e2e-tests/test-applications/node-hapi/package.json index 017d55438ab1..a6092edbc5ce 100644 --- a/dev-packages/e2e-tests/test-applications/node-hapi/package.json +++ b/dev-packages/e2e-tests/test-applications/node-hapi/package.json @@ -13,13 +13,11 @@ "dependencies": { "@hapi/hapi": "21.3.2", "@sentry/node": "latest || *", - "@sentry/types": "latest || *", - "@types/node": "18.15.1", - "typescript": "4.9.5" + "@sentry/types": "latest || *" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.27.1" + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/node-hapi/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/node-hapi/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/node-hapi/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-hapi/playwright.config.ts b/dev-packages/e2e-tests/test-applications/node-hapi/playwright.config.ts deleted file mode 100644 index 79d19e845ab0..000000000000 --- a/dev-packages/e2e-tests/test-applications/node-hapi/playwright.config.ts +++ /dev/null @@ -1,77 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const hapiPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${hapiPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - // For now we only test Chrome! - // { - // name: 'firefox', - // use: { - // ...devices['Desktop Firefox'], - // }, - // }, - // { - // name: 'webkit', - // use: { - // ...devices['Desktop Safari'], - // }, - // }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: 'pnpm start', - port: hapiPort, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-hapi/src/app.js b/dev-packages/e2e-tests/test-applications/node-hapi/src/app.js index 772847392e43..273cb2f09471 100644 --- a/dev-packages/e2e-tests/test-applications/node-hapi/src/app.js +++ b/dev-packages/e2e-tests/test-applications/node-hapi/src/app.js @@ -4,7 +4,7 @@ Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: process.env.E2E_TEST_DSN, includeLocalVariables: true, - debug: true, + debug: !!process.env.DEBUG, tunnel: `http://localhost:3031/`, // proxy server tracesSampleRate: 1, }); diff --git a/dev-packages/e2e-tests/test-applications/node-hapi/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/node-hapi/start-event-proxy.mjs index 25464165b311..0677757f657f 100644 --- a/dev-packages/e2e-tests/test-applications/node-hapi/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/node-hapi/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/node-hapi/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/node-hapi/tests/errors.test.ts index c46265579a99..6afcc015e21f 100644 --- a/dev-packages/e2e-tests/test-applications/node-hapi/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-hapi/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test('Sends thrown error to Sentry', async ({ baseURL }) => { const errorEventPromise = waitForError('node-hapi', errorEvent => { diff --git a/dev-packages/e2e-tests/test-applications/node-hapi/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-hapi/tests/transactions.test.ts index 936861ce8f18..64e98f8e75d8 100644 --- a/dev-packages/e2e-tests/test-applications/node-hapi/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-hapi/tests/transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Sends successful transaction', async ({ baseURL }) => { const pageloadTransactionEventPromise = waitForTransaction('node-hapi', transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/node-hapi/tsconfig.json b/dev-packages/e2e-tests/test-applications/node-hapi/tsconfig.json deleted file mode 100644 index 17bd2c1f4c00..000000000000 --- a/dev-packages/e2e-tests/test-applications/node-hapi/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compilerOptions": { - "types": ["node"], - "esModuleInterop": true, - "lib": ["dom", "dom.iterable", "esnext"], - "strict": true, - "outDir": "dist" - }, - "include": ["*.ts"] -} diff --git a/dev-packages/e2e-tests/test-applications/node-koa/index.js b/dev-packages/e2e-tests/test-applications/node-koa/index.js index 9d58bd6ca3b6..08ddc231ffb3 100644 --- a/dev-packages/e2e-tests/test-applications/node-koa/index.js +++ b/dev-packages/e2e-tests/test-applications/node-koa/index.js @@ -4,7 +4,7 @@ Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: process.env.E2E_TEST_DSN, includeLocalVariables: true, - debug: true, + debug: !!process.env.DEBUG, tunnel: `http://localhost:3031/`, // proxy server tracesSampleRate: 1, tracePropagationTargets: ['http://localhost:3030', 'external-allowed'], diff --git a/dev-packages/e2e-tests/test-applications/node-koa/package.json b/dev-packages/e2e-tests/test-applications/node-koa/package.json index 8050820d28ea..79a4e540c089 100644 --- a/dev-packages/e2e-tests/test-applications/node-koa/package.json +++ b/dev-packages/e2e-tests/test-applications/node-koa/package.json @@ -18,8 +18,8 @@ "typescript": "4.9.5" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.27.1" + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/node-koa/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/node-koa/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/node-koa/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-koa/playwright.config.ts b/dev-packages/e2e-tests/test-applications/node-koa/playwright.config.ts deleted file mode 100644 index 9ebe391bb0bd..000000000000 --- a/dev-packages/e2e-tests/test-applications/node-koa/playwright.config.ts +++ /dev/null @@ -1,77 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const koaPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${koaPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - // For now we only test Chrome! - // { - // name: 'firefox', - // use: { - // ...devices['Desktop Firefox'], - // }, - // }, - // { - // name: 'webkit', - // use: { - // ...devices['Desktop Safari'], - // }, - // }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: 'pnpm start', - port: koaPort, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-koa/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/node-koa/start-event-proxy.mjs index 969f745f2d7a..75bd72e8c7d3 100644 --- a/dev-packages/e2e-tests/test-applications/node-koa/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/node-koa/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/node-koa/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/node-koa/tests/errors.test.ts index 1838d66580e6..aca04522f8fc 100644 --- a/dev-packages/e2e-tests/test-applications/node-koa/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-koa/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test('Sends correct error event', async ({ baseURL }) => { const errorEventPromise = waitForError('node-koa', event => { diff --git a/dev-packages/e2e-tests/test-applications/node-koa/tests/propagation.test.ts b/dev-packages/e2e-tests/test-applications/node-koa/tests/propagation.test.ts index 6e3abf414ba3..1f5413af0cbe 100644 --- a/dev-packages/e2e-tests/test-applications/node-koa/tests/propagation.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-koa/tests/propagation.test.ts @@ -1,6 +1,6 @@ import crypto from 'crypto'; import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; import { SpanJSON } from '@sentry/types'; test('Propagates trace for outgoing http requests', async ({ baseURL }) => { diff --git a/dev-packages/e2e-tests/test-applications/node-koa/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-koa/tests/transactions.test.ts index d2db2aa54ae6..fd57b23cb8bb 100644 --- a/dev-packages/e2e-tests/test-applications/node-koa/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-koa/tests/transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Sends an API route transaction', async ({ baseURL }) => { const pageloadTransactionEventPromise = waitForTransaction('node-koa', transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/package.json b/dev-packages/e2e-tests/test-applications/node-nestjs/package.json index 51fb770cbb83..c21b312d1c13 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/package.json +++ b/dev-packages/e2e-tests/test-applications/node-nestjs/package.json @@ -24,11 +24,11 @@ "rxjs": "^7.8.1" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@nestjs/cli": "^10.0.0", "@nestjs/schematics": "^10.0.0", "@nestjs/testing": "^10.0.0", - "@playwright/test": "^1.27.1", "@types/express": "^4.17.17", "@types/node": "18.15.1", "@types/supertest": "^6.0.0", diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/node-nestjs/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/node-nestjs/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/playwright.config.ts b/dev-packages/e2e-tests/test-applications/node-nestjs/playwright.config.ts deleted file mode 100644 index 141dc4baf830..000000000000 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/playwright.config.ts +++ /dev/null @@ -1,77 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const nestjsPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${nestjsPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - // For now we only test Chrome! - // { - // name: 'firefox', - // use: { - // ...devices['Desktop Firefox'], - // }, - // }, - // { - // name: 'webkit', - // use: { - // ...devices['Desktop Safari'], - // }, - // }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: 'pnpm start', - port: nestjsPort, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/node-nestjs/start-event-proxy.mjs index 583769c59a92..3714932358a5 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/node-nestjs/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/node-nestjs/tests/errors.test.ts index f57d656068df..40ed8e49718a 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-nestjs/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test('Sends exception to Sentry', async ({ baseURL }) => { const errorEventPromise = waitForError('node-nestjs', event => { diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/propagation.test.ts b/dev-packages/e2e-tests/test-applications/node-nestjs/tests/propagation.test.ts index b1a80710a4df..d100b725283f 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/propagation.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-nestjs/tests/propagation.test.ts @@ -1,6 +1,6 @@ import crypto from 'crypto'; import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; import { SpanJSON } from '@sentry/types'; test('Propagates trace for outgoing http requests', async ({ baseURL }) => { diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-nestjs/tests/transactions.test.ts index 5b48b1854afa..593c5e383f2b 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-nestjs/tests/transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Sends an API route transaction', async ({ baseURL }) => { const pageloadTransactionEventPromise = waitForTransaction('node-nestjs', transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/react-19/package.json b/dev-packages/e2e-tests/test-applications/react-19/package.json index 4c2f7d0df36e..d83bd81d6c3e 100644 --- a/dev-packages/e2e-tests/test-applications/react-19/package.json +++ b/dev-packages/e2e-tests/test-applications/react-19/package.json @@ -47,8 +47,8 @@ ] }, "devDependencies": { - "@playwright/test": "^1.43.1", - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "serve": "14.0.1" }, "volta": { diff --git a/dev-packages/e2e-tests/test-applications/react-19/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/react-19/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/react-19/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/react-19/playwright.config.ts b/dev-packages/e2e-tests/test-applications/react-19/playwright.config.ts deleted file mode 100644 index 3d7268ce5dc1..000000000000 --- a/dev-packages/e2e-tests/test-applications/react-19/playwright.config.ts +++ /dev/null @@ -1,82 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const reactPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Opt out of parallel tests on CI. */ - workers: 1, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - - baseURL: `http://localhost:${reactPort}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - // For now we only test Chrome! - // { - // name: 'firefox', - // use: { - // ...devices['Desktop Firefox'], - // }, - // }, - // { - // name: 'webkit', - // use: { - // ...devices['Desktop Safari'], - // }, - // }, - ], - - /* Run your local dev server before starting the tests */ - - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: 'pnpm start', - port: reactPort, - env: { - PORT: `${reactPort}`, - }, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/react-19/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/react-19/start-event-proxy.mjs index e0102436fdd0..bf80522a3d7e 100644 --- a/dev-packages/e2e-tests/test-applications/react-19/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/react-19/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/react-19/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/react-19/tests/errors.test.ts index 9040d217d1bb..46e19b11a2ac 100644 --- a/dev-packages/e2e-tests/test-applications/react-19/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-19/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test('Catches errors caught by error boundary', async ({ page }) => { page.on('console', message => { diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/package.json b/dev-packages/e2e-tests/test-applications/react-create-hash-router/package.json index f028794e9830..c289c76af506 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/package.json +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/package.json @@ -15,8 +15,7 @@ "react-dom": "18.2.0", "react-router-dom": "^6.4.1", "react-scripts": "5.0.1", - "typescript": "4.4.2", - "web-vitals": "2.1.0" + "typescript": "4.4.2" }, "scripts": { "build": "react-scripts build", @@ -46,8 +45,8 @@ ] }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "1.26.1", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "serve": "14.0.1" }, "volta": { diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/react-create-hash-router/playwright.config.mjs index 4ac124380c0d..31f2b913b58b 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/playwright.config.mjs +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/playwright.config.mjs @@ -1,81 +1,7 @@ -import { devices } from '@playwright/test'; +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; -const serverPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Opt out of parallel tests on CI. */ - workers: 1, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${serverPort}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - // For now we only test Chrome! - // { - // name: 'firefox', - // use: { - // ...devices['Desktop Firefox'], - // }, - // }, - // { - // name: 'webkit', - // use: { - // ...devices['Desktop Safari'], - // }, - // }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: 'pnpm start', - port: serverPort, - env: { - PORT: '3030', - }, - }, - ], -}; +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); export default config; diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx b/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx index dc27c8fb9ac1..638f38e2a3c4 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx @@ -38,7 +38,7 @@ Sentry.init({ replaysSessionSampleRate: 1.0, replaysOnErrorSampleRate: 0.0, - debug: true, + debug: !!process.env.DEBUG, }); const sentryCreateHashRouter = Sentry.wrapCreateBrowserRouter(createHashRouter); diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/react-create-hash-router/start-event-proxy.mjs index 0a802ff33b16..f99a31fa19cf 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/errors.test.ts index 80dab4ba949c..1602f10c3e3e 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test('Captures exception correctly', async ({ page }) => { const errorEventPromise = waitForError('react-create-hash-router', event => { diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts index 24548324985a..3dc9907e8ff0 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('Captures a pageload transaction', async ({ page }) => { const transactionEventPromise = waitForTransaction('react-create-hash-router', event => { diff --git a/dev-packages/e2e-tests/test-applications/react-router-5/package.json b/dev-packages/e2e-tests/test-applications/react-router-5/package.json index 93f13f25ae6f..e60c3e7f346b 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-5/package.json +++ b/dev-packages/e2e-tests/test-applications/react-router-5/package.json @@ -49,8 +49,8 @@ ] }, "devDependencies": { - "@playwright/test": "^1.43.1", - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "serve": "14.0.1" }, "volta": { diff --git a/dev-packages/e2e-tests/test-applications/react-router-5/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/react-router-5/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/react-router-5/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/react-router-5/playwright.config.ts b/dev-packages/e2e-tests/test-applications/react-router-5/playwright.config.ts deleted file mode 100644 index 3d7268ce5dc1..000000000000 --- a/dev-packages/e2e-tests/test-applications/react-router-5/playwright.config.ts +++ /dev/null @@ -1,82 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const reactPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Opt out of parallel tests on CI. */ - workers: 1, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - - baseURL: `http://localhost:${reactPort}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - // For now we only test Chrome! - // { - // name: 'firefox', - // use: { - // ...devices['Desktop Firefox'], - // }, - // }, - // { - // name: 'webkit', - // use: { - // ...devices['Desktop Safari'], - // }, - // }, - ], - - /* Run your local dev server before starting the tests */ - - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: 'pnpm start', - port: reactPort, - env: { - PORT: `${reactPort}`, - }, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/react-router-5/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/react-router-5/start-event-proxy.mjs index 4b18df9aacaf..1866a59e318d 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-5/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/react-router-5/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/react-router-5/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/react-router-5/tests/errors.test.ts index bcfafe8b6624..11ba3f8df5d5 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-5/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-5/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Sends correct error event', async ({ page }) => { const errorEventPromise = waitForError('react-router-5', event => { diff --git a/dev-packages/e2e-tests/test-applications/react-router-5/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-router-5/tests/transactions.test.ts index e13c4702dc55..71808851a290 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-5/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-5/tests/transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { const transactionPromise = waitForTransaction('react-router-5', async transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/package.json b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/package.json index 88ebe78043ba..3ce8af8b1d59 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/package.json +++ b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/package.json @@ -47,8 +47,8 @@ ] }, "devDependencies": { - "@playwright/test": "^1.43.1", - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "serve": "14.0.1" }, "volta": { diff --git a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/playwright.config.ts b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/playwright.config.ts deleted file mode 100644 index 3d7268ce5dc1..000000000000 --- a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/playwright.config.ts +++ /dev/null @@ -1,82 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const reactPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Opt out of parallel tests on CI. */ - workers: 1, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - - baseURL: `http://localhost:${reactPort}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - // For now we only test Chrome! - // { - // name: 'firefox', - // use: { - // ...devices['Desktop Firefox'], - // }, - // }, - // { - // name: 'webkit', - // use: { - // ...devices['Desktop Safari'], - // }, - // }, - ], - - /* Run your local dev server before starting the tests */ - - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: 'pnpm start', - port: reactPort, - env: { - PORT: `${reactPort}`, - }, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/start-event-proxy.mjs index a836ebb7baa6..1265777dc613 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/errors.test.ts index baecddb9b96d..10fea8625a51 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Sends correct error event', async ({ page }) => { const errorEventPromise = waitForError('react-router-6-use-routes', event => { diff --git a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/transactions.test.ts index 75b42ebe6c0a..b8d2c9865e25 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/tests/transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { const transactionPromise = waitForTransaction('react-router-6-use-routes', async transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/react-send-to-sentry/package.json b/dev-packages/e2e-tests/test-applications/react-send-to-sentry/package.json index 092a5c0ac221..1e8b4a36607d 100644 --- a/dev-packages/e2e-tests/test-applications/react-send-to-sentry/package.json +++ b/dev-packages/e2e-tests/test-applications/react-send-to-sentry/package.json @@ -47,7 +47,7 @@ ] }, "devDependencies": { - "@playwright/test": "1.26.1", + "@playwright/test": "^1.44.1", "axios": "1.6.0", "serve": "14.0.1" }, diff --git a/dev-packages/e2e-tests/test-applications/react-send-to-sentry/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/react-send-to-sentry/playwright.config.mjs deleted file mode 100644 index 7d04e3b6dd4b..000000000000 --- a/dev-packages/e2e-tests/test-applications/react-send-to-sentry/playwright.config.mjs +++ /dev/null @@ -1,69 +0,0 @@ -import { devices } from '@playwright/test'; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Opt out of parallel tests on CI. */ - workers: 1, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - // For now we only test Chrome! - // { - // name: 'firefox', - // use: { - // ...devices['Desktop Firefox'], - // }, - // }, - // { - // name: 'webkit', - // use: { - // ...devices['Desktop Safari'], - // }, - // }, - ], - - /* Run your local dev server before starting the tests */ - webServer: { - command: 'pnpm start', - port: 3030, - env: { - PORT: '3030', - }, - }, -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/react-send-to-sentry/tests/fixtures/ReplayRecordingData.ts b/dev-packages/e2e-tests/test-applications/react-send-to-sentry/tests/fixtures/ReplayRecordingData.ts index 0b454ba12214..554fac59f88e 100644 --- a/dev-packages/e2e-tests/test-applications/react-send-to-sentry/tests/fixtures/ReplayRecordingData.ts +++ b/dev-packages/e2e-tests/test-applications/react-send-to-sentry/tests/fixtures/ReplayRecordingData.ts @@ -175,6 +175,7 @@ export const ReplayRecordingData = [ decodedBodySize: expect.any(Number), encodedBodySize: expect.any(Number), size: expect.any(Number), + statusCode: 200, }, }, }, diff --git a/dev-packages/e2e-tests/test-applications/standard-frontend-react/package.json b/dev-packages/e2e-tests/test-applications/standard-frontend-react/package.json index 072a856a29da..bf1cd59a0a77 100644 --- a/dev-packages/e2e-tests/test-applications/standard-frontend-react/package.json +++ b/dev-packages/e2e-tests/test-applications/standard-frontend-react/package.json @@ -47,7 +47,7 @@ ] }, "devDependencies": { - "@playwright/test": "1.26.1", + "@playwright/test": "^1.44.1", "serve": "14.0.1" }, "volta": { diff --git a/dev-packages/e2e-tests/test-applications/svelte-5/package.json b/dev-packages/e2e-tests/test-applications/svelte-5/package.json index d95aa579e9a6..82c256519a36 100644 --- a/dev-packages/e2e-tests/test-applications/svelte-5/package.json +++ b/dev-packages/e2e-tests/test-applications/svelte-5/package.json @@ -13,8 +13,8 @@ "test:assert": "pnpm test:prod" }, "devDependencies": { - "@playwright/test": "^1.43.1", - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry/types": "latest || *", "@sentry/utils": "latest || *", "@sveltejs/vite-plugin-svelte": "^3.0.2", @@ -23,8 +23,7 @@ "svelte-check": "^3.6.7", "tslib": "^2.6.2", "typescript": "^5.2.2", - "vite": "^5.2.0", - "wait-port": "1.0.4" + "vite": "^5.2.0" }, "dependencies": { "@sentry/svelte": "latest || *" diff --git a/dev-packages/e2e-tests/test-applications/svelte-5/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/svelte-5/playwright.config.mjs new file mode 100644 index 000000000000..0c468af7d879 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/svelte-5/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/svelte-5/playwright.config.ts b/dev-packages/e2e-tests/test-applications/svelte-5/playwright.config.ts deleted file mode 100644 index 37a5c8726a36..000000000000 --- a/dev-packages/e2e-tests/test-applications/svelte-5/playwright.config.ts +++ /dev/null @@ -1,72 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const testEnv = process.env.TEST_ENV; - -if (!testEnv) { - throw new Error('No test env defined'); -} - -const sveltePort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './test', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - /* Run tests in files in parallel */ - fullyParallel: false, - workers: 1, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* `next dev` is incredibly buggy with the app dir */ - retries: testEnv === 'development' ? 3 : 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${sveltePort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node ./start-event-proxy.mjs', - port: eventProxyPort, - reuseExistingServer: false, - }, - { - command: `pnpm wait-port ${eventProxyPort} && pnpm preview --port ${sveltePort}`, - port: sveltePort, - reuseExistingServer: false, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/svelte-5/src/main.ts b/dev-packages/e2e-tests/test-applications/svelte-5/src/main.ts index e42063fb9183..9f5fb70cea94 100644 --- a/dev-packages/e2e-tests/test-applications/svelte-5/src/main.ts +++ b/dev-packages/e2e-tests/test-applications/svelte-5/src/main.ts @@ -10,7 +10,7 @@ Sentry.init({ tracesSampleRate: 1.0, integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()], tunnel: 'http://localhost:3031/', // proxy server - debug: true, + debug: !!process.env.DEBUG, }); const target = document.getElementById('app'); diff --git a/dev-packages/e2e-tests/test-applications/svelte-5/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/svelte-5/start-event-proxy.mjs index 51f34487945c..cd37498da887 100644 --- a/dev-packages/e2e-tests/test-applications/svelte-5/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/svelte-5/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/svelte-5/test/errors.test.ts b/dev-packages/e2e-tests/test-applications/svelte-5/tests/errors.test.ts similarity index 90% rename from dev-packages/e2e-tests/test-applications/svelte-5/test/errors.test.ts rename to dev-packages/e2e-tests/test-applications/svelte-5/tests/errors.test.ts index 803e49e24fd0..6e3267eab2ed 100644 --- a/dev-packages/e2e-tests/test-applications/svelte-5/test/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/svelte-5/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test('sends an error', async ({ page }) => { const errorPromise = waitForError('svelte-5', async errorEvent => { diff --git a/dev-packages/e2e-tests/test-applications/svelte-5/test/performance.test.ts b/dev-packages/e2e-tests/test-applications/svelte-5/tests/performance.test.ts similarity index 94% rename from dev-packages/e2e-tests/test-applications/svelte-5/test/performance.test.ts rename to dev-packages/e2e-tests/test-applications/svelte-5/tests/performance.test.ts index 5e4e52d597b4..05391ed88042 100644 --- a/dev-packages/e2e-tests/test-applications/svelte-5/test/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/svelte-5/tests/performance.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('sends a pageload transaction with component tracking init spans', async ({ page }) => { const transactionPromise = waitForTransaction('svelte-5', async transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/package.json b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/package.json index 1e3b02d5d4b1..ef59fc456b5f 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/package.json +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/package.json @@ -19,8 +19,8 @@ "@spotlightjs/spotlight": "2.0.0-alpha.1" }, "devDependencies": { - "@playwright/test": "^1.36.2", - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry/types": "latest || *", "@sentry/utils": "latest || *", "@sveltejs/adapter-auto": "^3.0.0", @@ -30,8 +30,7 @@ "svelte-check": "^3.6.0", "tslib": "^2.4.1", "typescript": "^5.0.0", - "vite": "^5.0.3", - "wait-port": "1.0.4" + "vite": "^5.0.3" }, "type": "module" } diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/playwright.config.mjs new file mode 100644 index 000000000000..0c468af7d879 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/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/sveltekit-2-svelte-5/playwright.config.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/playwright.config.ts deleted file mode 100644 index 87f7ec8bbe32..000000000000 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/playwright.config.ts +++ /dev/null @@ -1,74 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const testEnv = process.env.TEST_ENV; - -if (!testEnv) { - throw new Error('No test env defined'); -} - -const svelteKitPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './test', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - /* Run tests in files in parallel */ - fullyParallel: false, - workers: 1, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* `next dev` is incredibly buggy with the app dir */ - retries: testEnv === 'development' ? 3 : 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${svelteKitPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - reuseExistingServer: false, - }, - { - command: `pnpm wait-port ${eventProxyPort} && pnpm preview --port ${svelteKitPort}`, - port: svelteKitPort, - reuseExistingServer: false, - }, - ], -}; - -export default config; - -`node --require @sentry/node/require my-app.js`; diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/src/hooks.client.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/src/hooks.client.ts index 606379b59760..91592e7ab932 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/src/hooks.client.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/src/hooks.client.ts @@ -5,7 +5,7 @@ import * as Spotlight from '@spotlightjs/spotlight'; Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: env.PUBLIC_E2E_TEST_DSN, - debug: true, + debug: !!env.PUBLIC_DEBUG, tunnel: `http://localhost:3031/`, // proxy server tracesSampleRate: 1.0, }); diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/src/hooks.server.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/src/hooks.server.ts index 3fedded42858..99bf4a17aa96 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/src/hooks.server.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/src/hooks.server.ts @@ -5,7 +5,7 @@ import { setupSidecar } from '@spotlightjs/spotlight/sidecar'; Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: E2E_TEST_DSN, - debug: true, + debug: !!process.env.DEBUG, tunnel: `http://localhost:3031/`, // proxy server tracesSampleRate: 1.0, spotlight: import.meta.env.DEV, diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/start-event-proxy.mjs index 537e4f60abe2..087080644ebb 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.client.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.client.test.ts index c70b9a93dbbb..1984a0db9603 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.client.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; import { waitForInitialPageload } from './utils'; test.describe('client-side errors', () => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.server.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.server.test.ts index bbd87a5366a6..0764d26e05a5 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test.describe('server-side errors', () => { test('captures universal load error', async ({ page }) => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.client.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.client.test.ts index 324b83977ba1..c31e51bf9e99 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.client.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; import { waitForInitialPageload } from './utils'; test.describe('client-specific performance events', () => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.server.test.ts index 10d0690e70b8..8c23996c9a37 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('server pageload request span has nested request span for sub request', async ({ page }) => { const serverTxnEventPromise = waitForTransaction('sveltekit-2-svelte-5', txnEvent => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.test.ts index 83932a4ac362..2e5c4eb63e48 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; import { waitForInitialPageload } from './utils'; test.describe('performance events', () => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/utils.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/utils.ts index 5dcc01bbe7f8..e77e2eb742e2 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/utils.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/utils.ts @@ -1,5 +1,5 @@ import { Page } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; /** * Helper function that waits for the initial pageload to complete. diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/package.json b/dev-packages/e2e-tests/test-applications/sveltekit-2/package.json index ae18e7e34017..738f4a51bb3d 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/package.json +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/package.json @@ -18,8 +18,8 @@ "@sentry/sveltekit": "latest || *" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.36.2", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry/types": "latest || *", "@sentry/utils": "latest || *", "@sveltejs/adapter-auto": "^3.0.0", @@ -29,8 +29,7 @@ "svelte": "^4.2.8", "svelte-check": "^3.6.0", "typescript": "^5.0.0", - "vite": "^5.0.3", - "wait-port": "1.0.4" + "vite": "^5.0.3" }, "type": "module" } diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/sveltekit-2/playwright.config.mjs new file mode 100644 index 000000000000..71d97e4da2fd --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/playwright.config.mjs @@ -0,0 +1,13 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const testEnv = process.env.TEST_ENV; + +if (!testEnv) { + throw new Error('No test env defined'); +} + +const config = getPlaywrightConfig({ + startCommand: testEnv === 'development' ? `pnpm dev --port 3030` : `node build`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/playwright.config.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2/playwright.config.ts deleted file mode 100644 index fe5a219c8e3d..000000000000 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/playwright.config.ts +++ /dev/null @@ -1,75 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const testEnv = process.env.TEST_ENV; - -if (!testEnv) { - throw new Error('No test env defined'); -} - -const svelteKitPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './test', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - /* Run tests in files in parallel */ - fullyParallel: false, - workers: 1, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* `next dev` is incredibly buggy with the app dir */ - retries: testEnv === 'development' ? 3 : 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${svelteKitPort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - reuseExistingServer: false, - }, - { - command: - testEnv === 'development' - ? `pnpm wait-port ${eventProxyPort} && pnpm dev --port ${svelteKitPort}` - : `pnpm wait-port ${eventProxyPort} && PORT=${svelteKitPort} node build`, - port: svelteKitPort, - reuseExistingServer: false, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/src/hooks.client.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2/src/hooks.client.ts index bfe90b150886..b174e9671b8d 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/src/hooks.client.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/src/hooks.client.ts @@ -4,7 +4,7 @@ import * as Sentry from '@sentry/sveltekit'; Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: env.PUBLIC_E2E_TEST_DSN, - debug: true, + debug: !!env.PUBLIC_DEBUG, tunnel: `http://localhost:3031/`, // proxy server tracesSampleRate: 1.0, }); diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/src/hooks.server.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2/src/hooks.server.ts index 2a2abbb870dd..92909c53a24c 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/src/hooks.server.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/src/hooks.server.ts @@ -4,7 +4,7 @@ import * as Sentry from '@sentry/sveltekit'; Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: E2E_TEST_DSN, - debug: true, + debug: !!process.env.DEBUG, tunnel: `http://localhost:3031/`, // proxy server tracesSampleRate: 1.0, }); diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/sveltekit-2/start-event-proxy.mjs index fcf2c0b9addc..7ebb1c1d4d68 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/errors.client.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/errors.client.test.ts similarity index 96% rename from dev-packages/e2e-tests/test-applications/sveltekit-2/test/errors.client.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2/tests/errors.client.test.ts index eb83566a475d..eecd5e00fae0 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/errors.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/errors.client.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; import { waitForInitialPageload } from './utils'; test.describe('client-side errors', () => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/errors.server.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/errors.server.test.ts similarity index 96% rename from dev-packages/e2e-tests/test-applications/sveltekit-2/test/errors.server.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2/tests/errors.server.test.ts index 51488b103107..64a0b2e3c855 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/errors.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/errors.server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test.describe('server-side errors', () => { test('captures universal load error', async ({ page }) => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/performance.client.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.client.test.ts similarity index 98% rename from dev-packages/e2e-tests/test-applications/sveltekit-2/test/performance.client.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.client.test.ts index 403701a075be..b53a881252a0 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/performance.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.client.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; import { waitForInitialPageload } from './utils'; test.describe('client-specific performance events', () => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.server.test.ts similarity index 93% rename from dev-packages/e2e-tests/test-applications/sveltekit-2/test/performance.server.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.server.test.ts index e04a056ca875..6f11fd17cd5b 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('server pageload request span has nested request span for sub request', async ({ page }) => { const serverTxnEventPromise = waitForTransaction('sveltekit-2', txnEvent => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/performance.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.test.ts similarity index 99% rename from dev-packages/e2e-tests/test-applications/sveltekit-2/test/performance.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.test.ts index e2966f23fb8b..44d9dbdf5f01 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/performance.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; import { waitForInitialPageload } from './utils'; test.describe('performance events', () => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/utils.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/utils.ts similarity index 95% rename from dev-packages/e2e-tests/test-applications/sveltekit-2/test/utils.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2/tests/utils.ts index 2fa35d9ae874..84a7e5605a1d 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/test/utils.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/tests/utils.ts @@ -1,5 +1,5 @@ import { Page } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; /** * Helper function that waits for the initial pageload to complete. diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/package.json b/dev-packages/e2e-tests/test-applications/sveltekit/package.json index 84fef7db3923..b4015eb94577 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/package.json +++ b/dev-packages/e2e-tests/test-applications/sveltekit/package.json @@ -17,8 +17,8 @@ "@sentry/sveltekit": "latest || *" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.41.1", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry/types": "latest || *", "@sentry/utils": "latest || *", "@sveltejs/adapter-auto": "^2.0.0", diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/sveltekit/playwright.config.mjs new file mode 100644 index 000000000000..222c54f87389 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/sveltekit/playwright.config.mjs @@ -0,0 +1,14 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const testEnv = process.env.TEST_ENV; + +if (!testEnv) { + throw new Error('No test env defined'); +} + +const config = getPlaywrightConfig({ + startCommand: testEnv === 'development' ? `pnpm dev --port 3030` : `pnpm preview --port 3030`, + port: 3030, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/playwright.config.ts b/dev-packages/e2e-tests/test-applications/sveltekit/playwright.config.ts deleted file mode 100644 index 18d60ca75ba3..000000000000 --- a/dev-packages/e2e-tests/test-applications/sveltekit/playwright.config.ts +++ /dev/null @@ -1,73 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const testEnv = process.env.TEST_ENV; - -if (!testEnv) { - throw new Error('No test env defined'); -} - -const port = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './test', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - workers: 1, - /* Run tests in files in parallel */ - fullyParallel: false, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* `next dev` is incredibly buggy with the app dir */ - retries: testEnv === 'development' ? 3 : 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${port}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: 3031, - }, - { - command: - testEnv === 'development' - ? `pnpm wait-port ${eventProxyPort} && pnpm dev --port ${port}` - : `pnpm wait-port ${eventProxyPort} && pnpm preview --port ${port}`, - port, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/src/hooks.client.ts b/dev-packages/e2e-tests/test-applications/sveltekit/src/hooks.client.ts index bfe90b150886..b174e9671b8d 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/src/hooks.client.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit/src/hooks.client.ts @@ -4,7 +4,7 @@ import * as Sentry from '@sentry/sveltekit'; Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: env.PUBLIC_E2E_TEST_DSN, - debug: true, + debug: !!env.PUBLIC_DEBUG, tunnel: `http://localhost:3031/`, // proxy server tracesSampleRate: 1.0, }); diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/src/hooks.server.ts b/dev-packages/e2e-tests/test-applications/sveltekit/src/hooks.server.ts index 375b8d2c170a..aca7e1b75139 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/src/hooks.server.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit/src/hooks.server.ts @@ -4,7 +4,7 @@ import * as Sentry from '@sentry/sveltekit'; Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: env.E2E_TEST_DSN, - debug: true, + debug: !!process.env.DEBUG, tunnel: `http://localhost:3031/`, // proxy server tracesSampleRate: 1.0, }); diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/sveltekit/start-event-proxy.mjs index cb0fd75c1530..db60ac582eb7 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/sveltekit/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/test/errors.client.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit/tests/errors.client.test.ts similarity index 96% rename from dev-packages/e2e-tests/test-applications/sveltekit/test/errors.client.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit/tests/errors.client.test.ts index 7f0a5c50faa0..b149496514c4 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/test/errors.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit/tests/errors.client.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; import { waitForInitialPageload } from '../utils'; test.describe('client-side errors', () => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/test/errors.server.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit/tests/errors.server.test.ts similarity index 97% rename from dev-packages/e2e-tests/test-applications/sveltekit/test/errors.server.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit/tests/errors.server.test.ts index 5a3940a213b5..22b6bb9d340c 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/test/errors.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit/tests/errors.server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test.describe('server-side errors', () => { test('captures universal load error', async ({ page }) => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/test/performance.client.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit/tests/performance.client.test.ts similarity index 97% rename from dev-packages/e2e-tests/test-applications/sveltekit/test/performance.client.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit/tests/performance.client.test.ts index d7107d5e7744..33515a950d3c 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/test/performance.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit/tests/performance.client.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; import { waitForInitialPageload } from '../utils.js'; test('records manually added component tracking spans', async ({ page }) => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/test/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit/tests/performance.server.test.ts similarity index 94% rename from dev-packages/e2e-tests/test-applications/sveltekit/test/performance.server.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit/tests/performance.server.test.ts index e462d08ddeeb..42ad638676f7 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/test/performance.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit/tests/performance.server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('server pageload request span has nested request span for sub request', async ({ page }) => { const serverTxnEventPromise = waitForTransaction('sveltekit', txnEvent => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/test/performance.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit/tests/performance.test.ts similarity index 97% rename from dev-packages/e2e-tests/test-applications/sveltekit/test/performance.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit/tests/performance.test.ts index cb2ac4446a49..42d4ef82a589 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/test/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit/tests/performance.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; import { waitForInitialPageload } from '../utils.js'; test('sends a pageload transaction', async ({ page }) => { diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/utils.ts b/dev-packages/e2e-tests/test-applications/sveltekit/utils.ts index c919c1d72e95..320d41aba389 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/utils.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit/utils.ts @@ -1,5 +1,5 @@ import { Page } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; /** * Helper function that waits for the initial pageload to complete. diff --git a/dev-packages/e2e-tests/test-applications/vue-3/package.json b/dev-packages/e2e-tests/test-applications/vue-3/package.json index 95288dc0e52f..577de338cff5 100644 --- a/dev-packages/e2e-tests/test-applications/vue-3/package.json +++ b/dev-packages/e2e-tests/test-applications/vue-3/package.json @@ -20,8 +20,8 @@ "vue-router": "^4.2.5" }, "devDependencies": { - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server", - "@playwright/test": "^1.41.1", + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry/types": "latest || *", "@sentry/utils": "latest || *", "@tsconfig/node20": "^20.1.2", diff --git a/dev-packages/e2e-tests/test-applications/vue-3/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/vue-3/playwright.config.mjs new file mode 100644 index 000000000000..94f38d88ad70 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/vue-3/playwright.config.mjs @@ -0,0 +1,8 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: 'pnpm preview --port 4173', + port: 4173, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/vue-3/playwright.config.ts b/dev-packages/e2e-tests/test-applications/vue-3/playwright.config.ts deleted file mode 100644 index 63c2b137a9d7..000000000000 --- a/dev-packages/e2e-tests/test-applications/vue-3/playwright.config.ts +++ /dev/null @@ -1,69 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const testEnv = process.env['TEST_ENV'] || 'production'; - -if (!testEnv) { - throw new Error('No test env defined'); -} - -const vuePort = 4173; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 10000, - }, - fullyParallel: false, - workers: 1, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* `next dev` is incredibly buggy with the app dir */ - retries: testEnv === 'development' ? 3 : 0, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: `http://localhost:${vuePort}`, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: `pnpm wait-port ${eventProxyPort} && pnpm preview --port ${vuePort}`, - port: vuePort, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/vue-3/src/main.ts b/dev-packages/e2e-tests/test-applications/vue-3/src/main.ts index 997c74fa0740..ee34e939a488 100644 --- a/dev-packages/e2e-tests/test-applications/vue-3/src/main.ts +++ b/dev-packages/e2e-tests/test-applications/vue-3/src/main.ts @@ -19,7 +19,7 @@ Sentry.init({ }), ], tunnel: `http://localhost:3031/`, // proxy server - debug: true, + debug: !!process.env.DEBUG, }); app.use(router); diff --git a/dev-packages/e2e-tests/test-applications/vue-3/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/vue-3/start-event-proxy.mjs index e8c8fdf3cd46..75992f4b5206 100644 --- a/dev-packages/e2e-tests/test-applications/vue-3/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/vue-3/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/vue-3/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/vue-3/tests/errors.test.ts index 14ab59ad7570..262cda11b366 100644 --- a/dev-packages/e2e-tests/test-applications/vue-3/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/vue-3/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/event-proxy-server'; +import { waitForError } from '@sentry-internal/test-utils'; test('sends an error', async ({ page }) => { const errorPromise = waitForError('vue-3', async errorEvent => { diff --git a/dev-packages/e2e-tests/test-applications/vue-3/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/vue-3/tests/performance.test.ts index aded68211784..bdf7b5b8e1fe 100644 --- a/dev-packages/e2e-tests/test-applications/vue-3/tests/performance.test.ts +++ b/dev-packages/e2e-tests/test-applications/vue-3/tests/performance.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { const transactionPromise = waitForTransaction('vue-3', async transactionEvent => { diff --git a/dev-packages/e2e-tests/test-applications/vue-3/tsconfig.node.json b/dev-packages/e2e-tests/test-applications/vue-3/tsconfig.node.json index 2c669eeb8e8a..280d8ca857df 100644 --- a/dev-packages/e2e-tests/test-applications/vue-3/tsconfig.node.json +++ b/dev-packages/e2e-tests/test-applications/vue-3/tsconfig.node.json @@ -1,6 +1,6 @@ { "extends": "@tsconfig/node20/tsconfig.json", - "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "nightwatch.conf.*", "playwright.config.*"], + "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "nightwatch.conf.*"], "compilerOptions": { "composite": true, "noEmit": true, diff --git a/dev-packages/e2e-tests/test-applications/webpack-4/package.json b/dev-packages/e2e-tests/test-applications/webpack-4/package.json index ee99ff43128e..8787fccf253c 100644 --- a/dev-packages/e2e-tests/test-applications/webpack-4/package.json +++ b/dev-packages/e2e-tests/test-applications/webpack-4/package.json @@ -8,7 +8,7 @@ "test:assert": "playwright test" }, "devDependencies": { - "@playwright/test": "^1.42.1", + "@playwright/test": "^1.44.1", "@sentry/browser": "latest || *", "webpack": "^4.47.0", "terser-webpack-plugin": "^4.2.3", diff --git a/dev-packages/e2e-tests/test-applications/webpack-5/package.json b/dev-packages/e2e-tests/test-applications/webpack-5/package.json index 871e43589971..bae94797b9bb 100644 --- a/dev-packages/e2e-tests/test-applications/webpack-5/package.json +++ b/dev-packages/e2e-tests/test-applications/webpack-5/package.json @@ -8,7 +8,7 @@ "test:assert": "playwright test" }, "devDependencies": { - "@playwright/test": "^1.42.1", + "@playwright/test": "^1.44.1", "@sentry/browser": "latest || *", "webpack": "^5.91.0", "terser-webpack-plugin": "^5.3.10", diff --git a/dev-packages/event-proxy-server/tsconfig.json b/dev-packages/event-proxy-server/tsconfig.json deleted file mode 100644 index 825380109ceb..000000000000 --- a/dev-packages/event-proxy-server/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": {}, - "include": ["src/**/*.ts"] -} diff --git a/dev-packages/event-proxy-server/.eslintrc.js b/dev-packages/test-utils/.eslintrc.js similarity index 100% rename from dev-packages/event-proxy-server/.eslintrc.js rename to dev-packages/test-utils/.eslintrc.js diff --git a/dev-packages/event-proxy-server/package.json b/dev-packages/test-utils/package.json similarity index 91% rename from dev-packages/event-proxy-server/package.json rename to dev-packages/test-utils/package.json index 2823c007e717..b8b7030de67f 100644 --- a/dev-packages/event-proxy-server/package.json +++ b/dev-packages/test-utils/package.json @@ -1,7 +1,7 @@ { "private": true, "version": "8.7.0", - "name": "@sentry-internal/event-proxy-server", + "name": "@sentry-internal/test-utils", "author": "Sentry", "license": "MIT", "main": "build/cjs/index.js", @@ -40,6 +40,9 @@ "build:types": "tsc -p tsconfig.types.json", "clean": "rimraf -g ./node_modules ./build" }, + "peerDependencies": { + "@playwright/test": "^1.44.1" + }, "devDependencies": { "@sentry/types": "8.7.0", "@sentry/utils": "8.7.0" diff --git a/dev-packages/event-proxy-server/rollup.npm.config.mjs b/dev-packages/test-utils/rollup.npm.config.mjs similarity index 100% rename from dev-packages/event-proxy-server/rollup.npm.config.mjs rename to dev-packages/test-utils/rollup.npm.config.mjs diff --git a/dev-packages/event-proxy-server/src/event-proxy-server.ts b/dev-packages/test-utils/src/event-proxy-server.ts similarity index 100% rename from dev-packages/event-proxy-server/src/event-proxy-server.ts rename to dev-packages/test-utils/src/event-proxy-server.ts diff --git a/dev-packages/event-proxy-server/src/index.ts b/dev-packages/test-utils/src/index.ts similarity index 70% rename from dev-packages/event-proxy-server/src/index.ts rename to dev-packages/test-utils/src/index.ts index 9ee4dfc54520..4425d2688800 100644 --- a/dev-packages/event-proxy-server/src/index.ts +++ b/dev-packages/test-utils/src/index.ts @@ -5,3 +5,5 @@ export { waitForRequest, waitForTransaction, } from './event-proxy-server'; + +export { getPlaywrightConfig } from './playwright-config'; diff --git a/dev-packages/test-utils/src/playwright-config.ts b/dev-packages/test-utils/src/playwright-config.ts new file mode 100644 index 000000000000..d51b2f374b5e --- /dev/null +++ b/dev-packages/test-utils/src/playwright-config.ts @@ -0,0 +1,94 @@ +import type { PlaywrightTestConfig } from '@playwright/test'; + +/** Get a playwright config to use in an E2E test app. */ +export function getPlaywrightConfig( + options: { + startCommand: string; + port?: number; + eventProxyPort?: number; + eventProxyFile?: string; + }, + overwriteConfig?: Partial, +): PlaywrightTestConfig { + const testEnv = process.env['TEST_ENV'] || 'production'; + const appPort = options.port || 3030; + const eventProxyPort = options.eventProxyPort || 3031; + const eventProxyFile = options.eventProxyFile || 'start-event-proxy.mjs'; + const { startCommand } = options; + + /** + * See https://playwright.dev/docs/test-configuration. + */ + const config: PlaywrightTestConfig = { + testDir: './tests', + /* Maximum time one test can run for. */ + timeout: 150_000, + expect: { + /** + * Maximum time expect() should wait for the condition to be met. + * For example in `await expect(locator).toHaveText();` + */ + timeout: 10000, + }, + fullyParallel: false, + workers: 1, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* In dev mode some apps are flaky, so we allow retry there... */ + retries: testEnv === 'development' ? 3 : 0, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: 'list', + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ + actionTimeout: 0, + /* Base URL to use in actions like `await page.goto('/')`. */ + baseURL: `http://localhost:${appPort}`, + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'chromium', + use: { + // This comes from `devices["Desktop Chrome"] + userAgent: + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.6422.26 Safari/537.36', + viewport: { width: 1280, height: 720 }, + screen: { width: 1920, height: 1080 }, + deviceScaleFactor: 1, + isMobile: false, + hasTouch: false, + defaultBrowserType: 'chromium', + }, + }, + ], + + /* Run your local dev server before starting the tests */ + webServer: [ + { + command: `node ${eventProxyFile}`, + port: eventProxyPort, + stdout: 'pipe', + stderr: 'pipe', + }, + { + command: startCommand, + port: appPort, + stdout: 'pipe', + stderr: 'pipe', + env: { + PORT: appPort.toString(), + }, + }, + ], + }; + + return { + ...config, + ...overwriteConfig, + }; +} diff --git a/dev-packages/test-utils/tsconfig.json b/dev-packages/test-utils/tsconfig.json new file mode 100644 index 000000000000..7b0fa87fc45b --- /dev/null +++ b/dev-packages/test-utils/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "target": "ES2022", + "module": "ES2022" + }, + "include": ["src/**/*.ts"] +} diff --git a/dev-packages/event-proxy-server/tsconfig.types.json b/dev-packages/test-utils/tsconfig.types.json similarity index 100% rename from dev-packages/event-proxy-server/tsconfig.types.json rename to dev-packages/test-utils/tsconfig.types.json diff --git a/package.json b/package.json index b7ac85b844e9..42a1b6cd0b89 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "dev-packages/e2e-tests", "dev-packages/node-integration-tests", "dev-packages/overhead-metrics", - "dev-packages/event-proxy-server", + "dev-packages/test-utils", "dev-packages/size-limit-gh-action", "dev-packages/rollup-utils" ], diff --git a/yarn.lock b/yarn.lock index e054994642fc..51f4ec587e73 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6571,12 +6571,12 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== -"@playwright/test@^1.43.1": - version "1.43.1" - resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.43.1.tgz#16728a59eb8ce0f60472f98d8886d6cab0fa3e42" - integrity sha512-HgtQzFgNEEo4TE22K/X7sYTYNqEMMTZmFS8kTq6m8hXj+m1D8TgwgIbumHddJa9h4yl4GkKb8/bgAl2+g7eDgA== +"@playwright/test@^1.44.1": + version "1.44.1" + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.44.1.tgz#cc874ec31342479ad99838040e99b5f604299bcb" + integrity sha512-1hZ4TNvD5z9VuhNJ/walIjvMVvYkZKf71axoF/uiAqpntQJXpG64dlXhoDXE3OczPuTuvjf/M5KWFg5VAVUS3Q== dependencies: - playwright "1.43.1" + playwright "1.44.1" "@polka/url@^1.0.0-next.20": version "1.0.0-next.21" @@ -24951,17 +24951,17 @@ playwright-core@1.40.1, playwright-core@^1.29.1: resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.40.1.tgz#442d15e86866a87d90d07af528e0afabe4c75c05" integrity sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ== -playwright-core@1.43.1: - version "1.43.1" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.43.1.tgz#0eafef9994c69c02a1a3825a4343e56c99c03b02" - integrity sha512-EI36Mto2Vrx6VF7rm708qSnesVQKbxEWvPrfA1IPY6HgczBplDx7ENtx+K2n4kJ41sLLkuGfmb0ZLSSXlDhqPg== +playwright-core@1.44.1: + version "1.44.1" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.44.1.tgz#53ec975503b763af6fc1a7aa995f34bc09ff447c" + integrity sha512-wh0JWtYTrhv1+OSsLPgFzGzt67Y7BE/ZS3jEqgGBlp2ppp1ZDj8c+9IARNW4dwf1poq5MgHreEM2KV/GuR4cFA== -playwright@1.43.1: - version "1.43.1" - resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.43.1.tgz#8ad08984ac66c9ef3d0db035be54dd7ec9f1c7d9" - integrity sha512-V7SoH0ai2kNt1Md9E3Gwas5B9m8KR2GVvwZnAI6Pg0m3sh7UvgiYhRrhsziCmqMJNouPckiOhk8T+9bSAK0VIA== +playwright@1.44.1: + version "1.44.1" + resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.44.1.tgz#5634369d777111c1eea9180430b7a184028e7892" + integrity sha512-qr/0UJ5CFAtloI3avF95Y0L1xQo6r3LQArLIg/z/PoGJ6xa+EwzrwO5lpNr/09STxdHuUoP2mvuELJS+hLdtgg== dependencies: - playwright-core "1.43.1" + playwright-core "1.44.1" optionalDependencies: fsevents "2.3.2" From 3672159f44509b8bddc641e47f2be3ba66208a59 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 29 May 2024 15:29:41 +0200 Subject: [PATCH 2/8] remove wait-port --- .../test-applications/create-remix-app-express/package.json | 3 +-- .../e2e-tests/test-applications/nextjs-14/package.json | 3 +-- .../e2e-tests/test-applications/nextjs-15/package.json | 3 +-- .../e2e-tests/test-applications/sveltekit/package.json | 3 +-- dev-packages/e2e-tests/test-applications/vue-3/package.json | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json index c66fc8ace66e..53ccbdff9e7f 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json @@ -49,8 +49,7 @@ "eslint-plugin-react-hooks": "^4.6.0", "tsx": "4.7.2", "typescript": "^5.1.6", - "vite-tsconfig-paths": "^4.2.1", - "wait-port": "1.0.4" + "vite-tsconfig-paths": "^4.2.1" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/nextjs-14/package.json b/dev-packages/e2e-tests/test-applications/nextjs-14/package.json index 4e14d6f1819a..bbda1b0144cc 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-14/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-14/package.json @@ -20,8 +20,7 @@ "next": "14.1.3", "react": "18.2.0", "react-dom": "18.2.0", - "typescript": "4.9.5", - "wait-port": "1.0.4" + "typescript": "4.9.5" }, "devDependencies": { "@playwright/test": "^1.44.1", diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/package.json b/dev-packages/e2e-tests/test-applications/nextjs-15/package.json index e1c1a84d14b2..3c39c0331b50 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/package.json @@ -20,8 +20,7 @@ "next": "14.3.0-canary.73", "react": "beta", "react-dom": "beta", - "typescript": "4.9.5", - "wait-port": "1.0.4" + "typescript": "4.9.5" }, "devDependencies": { "@playwright/test": "^1.44.1", diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/package.json b/dev-packages/e2e-tests/test-applications/sveltekit/package.json index b4015eb94577..e6b109c437dc 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/package.json +++ b/dev-packages/e2e-tests/test-applications/sveltekit/package.json @@ -27,8 +27,7 @@ "svelte": "^3.54.0", "svelte-check": "^3.0.1", "typescript": "^5.0.0", - "vite": "^4.2.0", - "wait-port": "1.0.4" + "vite": "^4.2.0" }, "type": "module" } diff --git a/dev-packages/e2e-tests/test-applications/vue-3/package.json b/dev-packages/e2e-tests/test-applications/vue-3/package.json index 577de338cff5..f356285a79d9 100644 --- a/dev-packages/e2e-tests/test-applications/vue-3/package.json +++ b/dev-packages/e2e-tests/test-applications/vue-3/package.json @@ -33,8 +33,7 @@ "npm-run-all2": "^6.1.1", "typescript": "~5.3.0", "vite": "^5.0.11", - "vue-tsc": "^1.8.27", - "wait-port": "1.0.4" + "vue-tsc": "^1.8.27" }, "volta": { "extends": "../../package.json" From 956f1e23d9403fc60453162741bd2257d93a2978 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 29 May 2024 15:43:25 +0200 Subject: [PATCH 3/8] add as devdep --- dev-packages/test-utils/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/dev-packages/test-utils/package.json b/dev-packages/test-utils/package.json index b8b7030de67f..a03c8de0e99e 100644 --- a/dev-packages/test-utils/package.json +++ b/dev-packages/test-utils/package.json @@ -44,6 +44,7 @@ "@playwright/test": "^1.44.1" }, "devDependencies": { + "@playwright/test": "^1.44.1", "@sentry/types": "8.7.0", "@sentry/utils": "8.7.0" }, From 4db5c33b455ece2764359b7da044e0d1fa291f69 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 29 May 2024 15:48:25 +0200 Subject: [PATCH 4/8] hardcode for angular --- dev-packages/e2e-tests/test-applications/angular-17/src/main.ts | 2 +- dev-packages/e2e-tests/test-applications/angular-18/src/main.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/angular-17/src/main.ts b/dev-packages/e2e-tests/test-applications/angular-17/src/main.ts index 2bccc92d0d91..a0b841afc333 100644 --- a/dev-packages/e2e-tests/test-applications/angular-17/src/main.ts +++ b/dev-packages/e2e-tests/test-applications/angular-17/src/main.ts @@ -5,11 +5,11 @@ import { appConfig } from './app/app.config'; import * as Sentry from '@sentry/angular'; Sentry.init({ + // Cannot use process.env here, so we hardcode the DSN dsn: 'https://3b6c388182fb435097f41d181be2b2ba@o4504321058471936.ingest.sentry.io/4504321066008576', tracesSampleRate: 1.0, integrations: [Sentry.browserTracingIntegration({})], tunnel: `http://localhost:3031/`, // proxy server - debug: !!process.env.DEBUG, }); bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err)); diff --git a/dev-packages/e2e-tests/test-applications/angular-18/src/main.ts b/dev-packages/e2e-tests/test-applications/angular-18/src/main.ts index 2bccc92d0d91..a0b841afc333 100644 --- a/dev-packages/e2e-tests/test-applications/angular-18/src/main.ts +++ b/dev-packages/e2e-tests/test-applications/angular-18/src/main.ts @@ -5,11 +5,11 @@ import { appConfig } from './app/app.config'; import * as Sentry from '@sentry/angular'; Sentry.init({ + // Cannot use process.env here, so we hardcode the DSN dsn: 'https://3b6c388182fb435097f41d181be2b2ba@o4504321058471936.ingest.sentry.io/4504321066008576', tracesSampleRate: 1.0, integrations: [Sentry.browserTracingIntegration({})], tunnel: `http://localhost:3031/`, // proxy server - debug: !!process.env.DEBUG, }); bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err)); From 1af377cd20e5fc0b354239c9763fe6647de24781 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 29 May 2024 16:07:51 +0200 Subject: [PATCH 5/8] fix config --- dev-packages/test-utils/src/playwright-config.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev-packages/test-utils/src/playwright-config.ts b/dev-packages/test-utils/src/playwright-config.ts index d51b2f374b5e..4f2ea54bc3b4 100644 --- a/dev-packages/test-utils/src/playwright-config.ts +++ b/dev-packages/test-utils/src/playwright-config.ts @@ -55,10 +55,11 @@ export function getPlaywrightConfig( name: 'chromium', use: { // This comes from `devices["Desktop Chrome"] + // We inline this instead of importing this, + // because playwright otherwise complains that it was imported twice :( userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.6422.26 Safari/537.36', viewport: { width: 1280, height: 720 }, - screen: { width: 1920, height: 1080 }, deviceScaleFactor: 1, isMobile: false, hasTouch: false, From cac212e5f13e6465cd711dbadb424fccb5121756 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 29 May 2024 16:30:27 +0200 Subject: [PATCH 6/8] test adjustments --- .../playwright.config.mjs | 5 - .../tests/transactions.test.ts | 14 - .../react-send-to-sentry/package.json | 1 - .../playwright.config.mjs | 69 +++++ .../standard-frontend-react/src/index.tsx | 6 - .../tests/behaviour-test.spec.ts | 60 ----- .../tests/fixtures/ReplayRecordingData.ts | 246 ------------------ .../{test => tests}/errors.client.test.ts | 0 .../{test => tests}/errors.server.test.ts | 0 .../performance.client.test.ts | 0 .../performance.server.test.ts | 0 .../{test => tests}/performance.test.ts | 0 .../{test => tests}/utils.ts | 0 .../test-applications/vue-3/src/main.ts | 1 - 14 files changed, 69 insertions(+), 333 deletions(-) create mode 100644 dev-packages/e2e-tests/test-applications/react-send-to-sentry/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/fixtures/ReplayRecordingData.ts rename dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/{test => tests}/errors.client.test.ts (100%) rename dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/{test => tests}/errors.server.test.ts (100%) rename dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/{test => tests}/performance.client.test.ts (100%) rename dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/{test => tests}/performance.server.test.ts (100%) rename dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/{test => tests}/performance.test.ts (100%) rename dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/{test => tests}/utils.ts (100%) diff --git a/dev-packages/e2e-tests/test-applications/node-express-send-to-sentry/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/node-express-send-to-sentry/playwright.config.mjs index 4f4aacb2c47e..9340e7e9436a 100644 --- a/dev-packages/e2e-tests/test-applications/node-express-send-to-sentry/playwright.config.mjs +++ b/dev-packages/e2e-tests/test-applications/node-express-send-to-sentry/playwright.config.mjs @@ -1,10 +1,5 @@ import { devices } from '@playwright/test'; -// Fix urls not resolving to localhost on Node v17+ -// See: https://github.com/axios/axios/issues/3821#issuecomment-1413727575 -import { setDefaultResultOrder } from 'dns'; -setDefaultResultOrder('ipv4first'); - const expressPort = 3030; /** diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts index 3dc9907e8ff0..e39db36ea6cb 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts @@ -50,20 +50,6 @@ test('Captures a pageload transaction', async ({ page }) => { trace_id: expect.any(String), origin: 'auto.ui.browser.metrics', }); - expect(transactionEvent.spans).toContainEqual({ - data: { - 'sentry.origin': 'auto.ui.browser.metrics', - 'sentry.op': 'browser', - }, - description: 'loadEvent', - op: 'browser', - parent_span_id: expect.any(String), - span_id: expect.any(String), - start_timestamp: expect.any(Number), - timestamp: expect.any(Number), - trace_id: expect.any(String), - origin: 'auto.ui.browser.metrics', - }); expect(transactionEvent.spans).toContainEqual({ data: { 'sentry.origin': 'auto.ui.browser.metrics', diff --git a/dev-packages/e2e-tests/test-applications/react-send-to-sentry/package.json b/dev-packages/e2e-tests/test-applications/react-send-to-sentry/package.json index 1e8b4a36607d..cfe6db496351 100644 --- a/dev-packages/e2e-tests/test-applications/react-send-to-sentry/package.json +++ b/dev-packages/e2e-tests/test-applications/react-send-to-sentry/package.json @@ -48,7 +48,6 @@ }, "devDependencies": { "@playwright/test": "^1.44.1", - "axios": "1.6.0", "serve": "14.0.1" }, "volta": { diff --git a/dev-packages/e2e-tests/test-applications/react-send-to-sentry/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/react-send-to-sentry/playwright.config.mjs new file mode 100644 index 000000000000..7d04e3b6dd4b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/react-send-to-sentry/playwright.config.mjs @@ -0,0 +1,69 @@ +import { devices } from '@playwright/test'; + +/** + * See https://playwright.dev/docs/test-configuration. + */ +const config = { + testDir: './tests', + /* Maximum time one test can run for. */ + timeout: 150_000, + expect: { + /** + * Maximum time expect() should wait for the condition to be met. + * For example in `await expect(locator).toHaveText();` + */ + timeout: 5000, + }, + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: 0, + /* Opt out of parallel tests on CI. */ + workers: 1, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: 'list', + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ + actionTimeout: 0, + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'chromium', + use: { + ...devices['Desktop Chrome'], + }, + }, + // For now we only test Chrome! + // { + // name: 'firefox', + // use: { + // ...devices['Desktop Firefox'], + // }, + // }, + // { + // name: 'webkit', + // use: { + // ...devices['Desktop Safari'], + // }, + // }, + ], + + /* Run your local dev server before starting the tests */ + webServer: { + command: 'pnpm start', + port: 3030, + env: { + PORT: '3030', + }, + }, +}; + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx b/dev-packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx index 3a87a53ffdfa..5980df0ff8dd 100644 --- a/dev-packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx +++ b/dev-packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx @@ -38,12 +38,6 @@ Sentry.init({ replaysOnErrorSampleRate: 0.0, }); -Object.defineProperty(window, 'sentryReplayId', { - get() { - return replay['_replay'].session.id; - }, -}); - Sentry.addEventProcessor(event => { if ( event.type === 'transaction' && diff --git a/dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/behaviour-test.spec.ts b/dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/behaviour-test.spec.ts index fabdd40e588f..0c4ccd1403f2 100644 --- a/dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/behaviour-test.spec.ts +++ b/dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/behaviour-test.spec.ts @@ -1,5 +1,4 @@ import { expect, test } from '@playwright/test'; -import { ReplayRecordingData } from './fixtures/ReplayRecordingData'; const EVENT_POLLING_TIMEOUT = 90_000; @@ -139,62 +138,3 @@ test('Sends a navigation transaction to Sentry', async ({ page }) => { expect(hadPageNavigationTransaction).toBe(true); }); - -test('Sends a Replay recording to Sentry', async ({ browser }) => { - const context = await browser.newContext(); - const page = await context.newPage(); - - await page.goto('/'); - - const replayId = await page.waitForFunction(() => { - return window.sentryReplayId; - }); - - // Keypress event ensures LCP is finished - await page.type('body', 'Y'); - - // Wait for replay to be sent - - if (replayId === undefined) { - throw new Error("Application didn't set a replayId"); - } - - console.log(`Polling for replay with ID: ${replayId}`); - - await expect - .poll( - async () => { - const response = await fetch( - `https://sentry.io/api/0/projects/${sentryTestOrgSlug}/${sentryTestProject}/replays/${replayId}/`, - { headers: { Authorization: `Bearer ${authToken}` } }, - ); - return response.status; - }, - { - timeout: EVENT_POLLING_TIMEOUT, - }, - ) - .toBe(200); - - // now fetch the first recording segment - await expect - .poll( - async () => { - const response = await fetch( - `https://sentry.io/api/0/projects/${sentryTestOrgSlug}/${sentryTestProject}/replays/${replayId}/recording-segments/?cursor=100%3A0%3A1`, - { headers: { Authorization: `Bearer ${authToken}` } }, - ); - - if (response.ok) { - const data = await response.json(); - return data[0]; - } - - return response.status; - }, - { - timeout: EVENT_POLLING_TIMEOUT, - }, - ) - .toEqual(ReplayRecordingData); -}); diff --git a/dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/fixtures/ReplayRecordingData.ts b/dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/fixtures/ReplayRecordingData.ts deleted file mode 100644 index 0b454ba12214..000000000000 --- a/dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/fixtures/ReplayRecordingData.ts +++ /dev/null @@ -1,246 +0,0 @@ -import { expect } from '@playwright/test'; - -export const ReplayRecordingData = [ - { - type: 4, - data: { href: expect.stringMatching(/http:\/\/localhost:\d+\//), width: 1280, height: 720 }, - timestamp: expect.any(Number), - }, - { - data: { - payload: { - blockAllMedia: true, - errorSampleRate: 0, - maskAllInputs: true, - maskAllText: true, - networkCaptureBodies: true, - networkDetailHasUrls: false, - networkRequestHasHeaders: true, - networkResponseHasHeaders: true, - sessionSampleRate: 1, - shouldRecordCanvas: false, - useCompression: false, - useCompressionOption: true, - }, - tag: 'options', - }, - timestamp: expect.any(Number), - type: 5, - }, - { - type: 2, - data: { - node: { - type: 0, - childNodes: [ - { type: 1, name: 'html', publicId: '', systemId: '', id: 2 }, - { - type: 2, - tagName: 'html', - attributes: { lang: 'en' }, - childNodes: [ - { - type: 2, - tagName: 'head', - attributes: {}, - childNodes: [ - { type: 2, tagName: 'meta', attributes: { charset: 'utf-8' }, childNodes: [], id: 5 }, - { - type: 2, - tagName: 'meta', - attributes: { name: 'viewport', content: 'width=device-width,initial-scale=1' }, - childNodes: [], - id: 6, - }, - { - type: 2, - tagName: 'meta', - attributes: { name: 'theme-color', content: '#000000' }, - childNodes: [], - id: 7, - }, - { - type: 2, - tagName: 'title', - attributes: {}, - childNodes: [{ type: 3, textContent: '***** ***', id: 9 }], - id: 8, - }, - ], - id: 4, - }, - { - type: 2, - tagName: 'body', - attributes: {}, - childNodes: [ - { - type: 2, - tagName: 'noscript', - attributes: {}, - childNodes: [{ type: 3, textContent: '*** **** ** ****** ********** ** *** **** ****', id: 12 }], - id: 11, - }, - { type: 2, tagName: 'div', attributes: { id: 'root' }, childNodes: [], id: 13 }, - ], - id: 10, - }, - ], - id: 3, - }, - ], - id: 1, - }, - initialOffset: { left: 0, top: 0 }, - }, - timestamp: expect.any(Number), - }, - { - type: 3, - data: { - source: 0, - texts: [], - attributes: [], - removes: [], - adds: [ - { - parentId: 13, - nextId: null, - node: { - type: 2, - tagName: 'a', - attributes: { id: 'navigation', href: expect.stringMatching(/http:\/\/localhost:\d+\/user\/5/) }, - childNodes: [], - id: 14, - }, - }, - { parentId: 14, nextId: null, node: { type: 3, textContent: '********', id: 15 } }, - { - parentId: 13, - nextId: 14, - node: { - type: 2, - tagName: 'input', - attributes: { type: 'button', id: 'exception-button', value: '******* *********' }, - childNodes: [], - id: 16, - }, - }, - ], - }, - timestamp: expect.any(Number), - }, - { - type: 3, - data: { source: 5, text: 'Capture Exception', isChecked: false, id: 16 }, - timestamp: expect.any(Number), - }, - { - type: 5, - timestamp: expect.any(Number), - data: { - tag: 'performanceSpan', - payload: { - op: 'navigation.navigate', - description: expect.stringMatching(/http:\/\/localhost:\d+\//), - startTimestamp: expect.any(Number), - endTimestamp: expect.any(Number), - data: { - decodedBodySize: expect.any(Number), - encodedBodySize: expect.any(Number), - duration: expect.any(Number), - domInteractive: expect.any(Number), - domContentLoadedEventEnd: expect.any(Number), - domContentLoadedEventStart: expect.any(Number), - loadEventStart: expect.any(Number), - loadEventEnd: expect.any(Number), - domComplete: expect.any(Number), - redirectCount: expect.any(Number), - size: expect.any(Number), - }, - }, - }, - }, - { - type: 5, - timestamp: expect.any(Number), - data: { - tag: 'performanceSpan', - payload: { - op: 'resource.script', - description: expect.stringMatching(/http:\/\/localhost:\d+\/static\/js\/main.(\w+).js/), - startTimestamp: expect.any(Number), - endTimestamp: expect.any(Number), - data: { - decodedBodySize: expect.any(Number), - encodedBodySize: expect.any(Number), - size: expect.any(Number), - }, - }, - }, - }, - { - type: 5, - timestamp: expect.any(Number), - data: { - tag: 'performanceSpan', - payload: { - op: 'paint', - description: 'first-paint', - startTimestamp: expect.any(Number), - endTimestamp: expect.any(Number), - }, - }, - }, - { - type: 5, - timestamp: expect.any(Number), - data: { - tag: 'performanceSpan', - payload: { - op: 'paint', - description: 'first-contentful-paint', - startTimestamp: expect.any(Number), - endTimestamp: expect.any(Number), - }, - }, - }, - { - type: 5, - timestamp: expect.any(Number), - data: { - tag: 'performanceSpan', - payload: { - op: 'largest-contentful-paint', - description: 'largest-contentful-paint', - startTimestamp: expect.any(Number), - endTimestamp: expect.any(Number), - data: { - value: expect.any(Number), - size: expect.any(Number), - nodeId: 16, - }, - }, - }, - }, - { - type: 5, - timestamp: expect.any(Number), - data: { - tag: 'performanceSpan', - payload: { - op: 'memory', - description: 'memory', - startTimestamp: expect.any(Number), - endTimestamp: expect.any(Number), - data: { - memory: { - jsHeapSizeLimit: expect.any(Number), - totalJSHeapSize: expect.any(Number), - usedJSHeapSize: expect.any(Number), - }, - }, - }, - }, - }, -]; diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.client.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/errors.client.test.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.client.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/errors.client.test.ts diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.server.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/errors.server.test.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/errors.server.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/errors.server.test.ts diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.client.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/performance.client.test.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.client.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/performance.client.test.ts diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.server.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/performance.server.test.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.server.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/performance.server.test.ts diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.test.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/performance.test.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/performance.test.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/performance.test.ts diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/utils.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/utils.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/test/utils.ts rename to dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/tests/utils.ts diff --git a/dev-packages/e2e-tests/test-applications/vue-3/src/main.ts b/dev-packages/e2e-tests/test-applications/vue-3/src/main.ts index ee34e939a488..f4a01d4285c5 100644 --- a/dev-packages/e2e-tests/test-applications/vue-3/src/main.ts +++ b/dev-packages/e2e-tests/test-applications/vue-3/src/main.ts @@ -19,7 +19,6 @@ Sentry.init({ }), ], tunnel: `http://localhost:3031/`, // proxy server - debug: !!process.env.DEBUG, }); app.use(router); From 75a0889b3d94e285b3836ac5bceae3c979fe7bc6 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 29 May 2024 17:07:48 +0200 Subject: [PATCH 7/8] fixes... --- .../tests/send-to-sentry.test.ts | 2 +- .../tests/behaviour-test.spec.ts | 2 +- .../tanstack-router/package.json | 4 +- .../tanstack-router/playwright.config.mjs | 7 ++ .../tanstack-router/playwright.config.ts | 66 ------------------- .../tanstack-router/start-event-proxy.mjs | 2 +- .../tests/routing-instrumentation.test.ts | 2 +- 7 files changed, 13 insertions(+), 72 deletions(-) create mode 100644 dev-packages/e2e-tests/test-applications/tanstack-router/playwright.config.mjs delete mode 100644 dev-packages/e2e-tests/test-applications/tanstack-router/playwright.config.ts diff --git a/dev-packages/e2e-tests/test-applications/react-send-to-sentry/tests/send-to-sentry.test.ts b/dev-packages/e2e-tests/test-applications/react-send-to-sentry/tests/send-to-sentry.test.ts index 9c820e2157de..d9c3e09f2ad2 100644 --- a/dev-packages/e2e-tests/test-applications/react-send-to-sentry/tests/send-to-sentry.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-send-to-sentry/tests/send-to-sentry.test.ts @@ -90,7 +90,7 @@ test('Sends a navigation transaction to Sentry', async ({ page }) => { await page.goto('/'); // Give pageload transaction time to finish - page.waitForTimeout(4000); + await page.waitForTimeout(4000); const linkElement = page.locator('id=navigation'); await linkElement.click(); diff --git a/dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/behaviour-test.spec.ts b/dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/behaviour-test.spec.ts index 0c4ccd1403f2..5e9b5ed0cdd6 100644 --- a/dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/behaviour-test.spec.ts +++ b/dev-packages/e2e-tests/test-applications/standard-frontend-react/tests/behaviour-test.spec.ts @@ -87,7 +87,7 @@ test('Sends a navigation transaction to Sentry', async ({ page }) => { await page.goto('/'); // Give pageload transaction time to finish - page.waitForTimeout(4000); + await page.waitForTimeout(4000); const linkElement = page.locator('id=navigation'); await linkElement.click(); diff --git a/dev-packages/e2e-tests/test-applications/tanstack-router/package.json b/dev-packages/e2e-tests/test-applications/tanstack-router/package.json index 2f761c7d3e71..7bee3d4ba828 100644 --- a/dev-packages/e2e-tests/test-applications/tanstack-router/package.json +++ b/dev-packages/e2e-tests/test-applications/tanstack-router/package.json @@ -25,8 +25,8 @@ "@vitejs/plugin-react-swc": "^3.5.0", "typescript": "^5.2.2", "vite": "^5.2.0", - "@playwright/test": "^1.41.1", - "@sentry-internal/event-proxy-server": "link:../../../event-proxy-server" + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/e2e-tests/test-applications/tanstack-router/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/tanstack-router/playwright.config.mjs new file mode 100644 index 000000000000..31f2b913b58b --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/tanstack-router/playwright.config.mjs @@ -0,0 +1,7 @@ +import { getPlaywrightConfig } from '@sentry-internal/test-utils'; + +const config = getPlaywrightConfig({ + startCommand: `pnpm start`, +}); + +export default config; diff --git a/dev-packages/e2e-tests/test-applications/tanstack-router/playwright.config.ts b/dev-packages/e2e-tests/test-applications/tanstack-router/playwright.config.ts deleted file mode 100644 index 2167da6d754e..000000000000 --- a/dev-packages/e2e-tests/test-applications/tanstack-router/playwright.config.ts +++ /dev/null @@ -1,66 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const appPort = 3030; -const eventProxyPort = 3031; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 150_000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000, - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: 0, - /* Opt out of parallel tests on CI. */ - workers: 1, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - - baseURL: `http://localhost:${appPort}`, - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], - - /* Run your local dev server before starting the tests */ - - webServer: [ - { - command: 'node start-event-proxy.mjs', - port: eventProxyPort, - }, - { - command: 'pnpm start', - port: appPort, - }, - ], -}; - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/tanstack-router/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/tanstack-router/start-event-proxy.mjs index d65ca64f1e59..f2ab6289d317 100644 --- a/dev-packages/e2e-tests/test-applications/tanstack-router/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/tanstack-router/start-event-proxy.mjs @@ -1,4 +1,4 @@ -import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; +import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, diff --git a/dev-packages/e2e-tests/test-applications/tanstack-router/tests/routing-instrumentation.test.ts b/dev-packages/e2e-tests/test-applications/tanstack-router/tests/routing-instrumentation.test.ts index 3201b436faba..59d15b989dd4 100644 --- a/dev-packages/e2e-tests/test-applications/tanstack-router/tests/routing-instrumentation.test.ts +++ b/dev-packages/e2e-tests/test-applications/tanstack-router/tests/routing-instrumentation.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/event-proxy-server'; +import { waitForTransaction } from '@sentry-internal/test-utils'; test('sends a pageload transaction with a parameterized URL', async ({ page }) => { const transactionPromise = waitForTransaction('tanstack-router', async transactionEvent => { From f81af6e0fd46c69dbc21003a5e6baafb13e970ef Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Fri, 31 May 2024 12:02:29 +0200 Subject: [PATCH 8/8] fix hapi test --- .../e2e-tests/test-applications/node-hapi/tests/errors.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-packages/e2e-tests/test-applications/node-hapi/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/node-hapi/tests/errors.test.ts index 6afcc015e21f..4fb76c1df687 100644 --- a/dev-packages/e2e-tests/test-applications/node-hapi/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-hapi/tests/errors.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError } from '@sentry-internal/test-utils'; +import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; test('Sends thrown error to Sentry', async ({ baseURL }) => { const errorEventPromise = waitForError('node-hapi', errorEvent => {