From 000166b17e8004101335356593432beb4e98cb6d Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 12 Jul 2023 10:41:43 +0200 Subject: [PATCH] WIP: Manually run E2E tests on CI? --- .github/workflows/build.yml | 104 +++++++++++++++--- .github/workflows/canary.yml | 102 ++++++++++++++--- packages/e2e-tests/package.json | 2 + packages/e2e-tests/prepare.ts | 24 ++++ packages/e2e-tests/publish-packages.ts | 3 - packages/e2e-tests/run.ts | 3 - .../create-next-app/package.json | 4 +- .../create-next-app/playwright.config.ts | 2 +- .../create-next-app/sentry.client.config.ts | 2 +- .../create-react-app/package.json | 6 +- .../create-remix-app/app/entry.client.tsx | 2 +- .../create-remix-app/app/entry.server.tsx | 2 +- .../create-remix-app/package.json | 4 +- .../nextjs-app-dir/assert-build.ts | 2 +- .../nextjs-app-dir/package.json | 7 +- .../nextjs-app-dir/playwright.config.ts | 4 +- .../nextjs-app-dir/start-event-proxy.ts | 2 +- .../node-express-app/package.json | 4 +- .../node-express-app/playwright.config.ts | 2 +- .../node-express-app/src/app.ts | 4 +- .../react-create-hash-router/package.json | 5 +- .../playwright.config.ts | 4 +- .../react-create-hash-router/src/index.tsx | 2 +- .../package.json | 4 +- .../playwright.config.ts | 4 +- .../src/index.tsx | 2 +- .../standard-frontend-react/package.json | 6 +- .../playwright.config.ts | 4 +- .../standard-frontend-react/src/index.tsx | 2 +- .../test-applications/sveltekit/package.json | 4 +- .../sveltekit/playwright.config.ts | 4 +- .../sveltekit/src/hooks.client.ts | 4 +- .../sveltekit/src/hooks.server.ts | 2 +- .../sveltekit/start-event-proxy.ts | 2 +- 34 files changed, 260 insertions(+), 74 deletions(-) create mode 100644 packages/e2e-tests/prepare.ts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5523a861eee..33ef211aa7f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,7 @@ env: ${{ github.workspace }}/packages/utils/esm BUILD_CACHE_KEY: ${{ github.event.inputs.commit || github.sha }} + BUILD_CACHE_TARBALL_KEY: tarball-${{ github.event.inputs.commit || github.sha }} # GH will use the first restore-key it finds that matches # So it will start by looking for one from the same branch, else take the newest one it can find elsewhere @@ -729,20 +730,81 @@ jobs: cd packages/remix yarn test:integration:ci + job_e2e_prepare: + name: Prepare E2E tests + if: + (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && + github.actor != 'dependabot[bot]' + needs: [job_get_metadata, job_build] + runs-on: ubuntu-20.04 + timeout-minutes: 15 + steps: + - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) + uses: actions/checkout@v3 + with: + ref: ${{ env.HEAD_COMMIT }} + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version-file: 'package.json' + - name: Restore caches + uses: ./.github/actions/restore-cache + env: + DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }} + - name: Check tarball cache + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/packages/*/*.tgz + key: ${{ env.BUILD_CACHE_TARBALL_KEY }} + - name: Build tarballs + run: yarn build:tarball + job_e2e_tests: - name: E2E (Shard ${{ matrix.shard }}) Tests + name: E2E ${{ matrix.label || matrix.test-application }} Test # We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks # Dependabot PRs sadly also don't have access to secrets, so we skip them as well if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' - needs: [job_get_metadata, job_build] + needs: [job_get_metadata, job_build, job_e2e_prepare] runs-on: ubuntu-20.04 - timeout-minutes: 30 + timeout-minutes: 10 + env: + E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }} + E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }} + # Needed because next/sveltekit expects a prefix + NEXT_PUBLIC_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }} + PUBLIC_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }} + E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks' + E2E_TEST_SENTRY_TEST_PROJECT: 'sentry-javascript-e2e-tests' strategy: fail-fast: false matrix: - shard: [1, 2, 3, 4] + test-application: + [ + 'node-express-app', + 'create-react-app', + 'create-next-app', + 'create-remix-app', + 'nextjs-app-dir', + 'react-create-hash-router', + 'standard-frontend-react', + 'standard-frontend-react-tracing', + 'sveltekit', + ] + build-command: + - false + label: + - false + # Add any variations of a test app here + # You should provide an alternate build-command as well as a matching label + include: + - test-application: 'create-react-app' + build-command: 'test:build-ts3.8' + label: 'create-react-app (TS 3.8)' + - test-application: 'standard-frontend-react' + build-command: 'test:build-ts3.8' + label: 'standard-frontend-react (TS 3.8)' steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) @@ -761,22 +823,36 @@ jobs: env: DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }} + - name: Restore tarball cache + uses: actions/cache/restore@v3 + with: + path: ${{ github.workspace }}/packages/*/*.tgz + key: ${{ env.BUILD_CACHE_TARBALL_KEY }} + - name: Get node version id: versions run: | echo "echo node=$(jq -r '.volta.node' package.json)" >> $GITHUB_OUTPUT - - name: Run E2E tests + + - name: Validate Verdaccio + run: yarn test:validate + working-directory: packages/e2e-tests + + - name: Prepare Verdaccio + run: yarn test:prepare + working-directory: packages/e2e-tests env: E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }} - E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }} - E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }} - E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks' - E2E_TEST_SENTRY_TEST_PROJECT: 'sentry-javascript-e2e-tests' - E2E_TEST_SHARD: ${{ matrix.shard }} - E2E_TEST_SHARD_AMOUNT: 4 - run: | - cd packages/e2e-tests - yarn test:e2e + + - name: Build E2E app + working-directory: packages/e2e-tests/test-applications/${{ matrix.test-application }} + timeout-minutes: 5 + run: yarn ${{ matrix.build-command || 'test:build' }} + + - name: Run E2E test + working-directory: packages/e2e-tests/test-applications/${{ matrix.test-application }} + timeout-minutes: 5 + run: yarn test:assert job_required_tests: name: All required tests passed or skipped diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index 3bd402dce4cf..c0540b31da13 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -17,41 +17,108 @@ permissions: issues: write jobs: - job_canary_test: - name: Canary Tests + job_e2e_prepare: + name: Prepare E2E Canary tests runs-on: ubuntu-20.04 - timeout-minutes: 60 + timeout-minutes: 15 steps: - - name: 'Check out current commit' + - name: Check out current commit uses: actions/checkout@v3 with: ref: ${{ env.HEAD_COMMIT }} - - uses: pnpm/action-setup@v2 - with: - version: 8.3.1 - name: Set up Node uses: actions/setup-node@v3 with: node-version-file: 'package.json' - name: Install dependencies - run: yarn install --ignore-engines --frozen-lockfile + run: yarn install - name: Build packages run: yarn build + - name: Check tarball cache + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/packages/*/*.tgz + key: tarballs-${{ env.HEAD_COMMIT }} + - name: Build tarballs + run: yarn build:tarball + + job_e2e_tests: + name: E2E ${{ matrix.label }} Test + needs: [job_e2e_prepare] + runs-on: ubuntu-20.04 + timeout-minutes: 10 + env: + E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }} + E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }} + # Needed because next/sveltekit expects a prefix + NEXT_PUBLIC_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }} + PUBLIC_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }} + E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks' + E2E_TEST_SENTRY_TEST_PROJECT: 'sentry-javascript-e2e-tests' + strategy: + fail-fast: false + matrix: + include: + - test-application: 'create-react-app' + build-command: 'test:build-canary' + label: 'create-react-app (canary)' + - test-application: 'nextjs-app-dir' + build-command: 'test:build-canary' + label: 'nextjs-app-dir (canary)' + - test-application: 'nextjs-app-dir' + build-command: 'test:build-latest' + label: 'nextjs-app-dir (latest)' + - test-application: 'react-create-hash-router' + build-command: 'test:build-canary' + label: 'react-create-hash-router (canary)' + - test-application: 'standard-frontend-react' + build-command: 'test:build-canary' + label: 'standard-frontend-react (canary)' + + steps: + - name: Check out current commit + uses: actions/checkout@v3 + with: + ref: ${{ env.HEAD_COMMIT }} + - uses: pnpm/action-setup@v2 + with: + version: 8.3.1 + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version-file: 'package.json' + + - name: Restore tarball cache + uses: actions/cache/restore@v3 + with: + path: ${{ github.workspace }}/packages/*/*.tgz + key: tarballs-${{ env.HEAD_COMMIT }} + - name: Get node version id: versions run: | echo "echo node=$(jq -r '.volta.node' package.json)" >> $GITHUB_OUTPUT - - name: Run Canary Tests + + - name: Validate Verdaccio + run: yarn test:validate + working-directory: packages/e2e-tests + + - name: Prepare Verdaccio + run: yarn test:prepare + working-directory: packages/e2e-tests env: E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }} - E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }} - E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }} - E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks' - E2E_TEST_SENTRY_TEST_PROJECT: 'sentry-javascript-e2e-tests' - CANARY_E2E_TEST: 'yes' - run: | - cd packages/e2e-tests - yarn test:e2e + + - name: Build E2E app + working-directory: packages/e2e-tests/test-applications/${{ matrix.test-application }} + timeout-minutes: 5 + run: yarn ${{ matrix.build-command }} + + - name: Run E2E test + working-directory: packages/e2e-tests/test-applications/${{ matrix.test-application }} + timeout-minutes: 5 + run: yarn test:assert + - name: Create Issue if: failure() && github.event_name == 'schedule' uses: JasonEtco/create-an-issue@e27dddc79c92bc6e4562f268fffa5ed752639abd @@ -101,4 +168,3 @@ jobs: with: filename: .github/CANARY_FAILURE_TEMPLATE.md update_existing: true - title: 'Ember Canary tests failed' diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index c8b4473d24e4..504c7eb31966 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -18,6 +18,8 @@ "test:run": "ts-node run.ts", "test:validate-configuration": "ts-node validate-verdaccio-configuration.ts", "test:validate-test-app-setups": "ts-node validate-test-app-setups.ts", + "test:prepare": "ts-node prepare.ts", + "test:validate": "run-s test:validate-configuration test:validate-test-app-setups", "clean": "rimraf tmp test-applications/**/node_modules test-applications/**/dist" }, "devDependencies": { diff --git a/packages/e2e-tests/prepare.ts b/packages/e2e-tests/prepare.ts new file mode 100644 index 000000000000..7fee7677bf94 --- /dev/null +++ b/packages/e2e-tests/prepare.ts @@ -0,0 +1,24 @@ +/* eslint-disable max-lines */ +/* eslint-disable no-console */ +import * as dotenv from 'dotenv'; + +import { validate } from './lib/validate'; +import { registrySetup } from './registrySetup'; + +async function run(): Promise { + // Load environment variables from .env file locally + dotenv.config(); + + if (!validate()) { + process.exit(1); + } + + try { + registrySetup(); + } catch (error) { + console.error(error); + process.exit(1); + } +} + +void run(); diff --git a/packages/e2e-tests/publish-packages.ts b/packages/e2e-tests/publish-packages.ts index fd03a777315a..4715b3258771 100644 --- a/packages/e2e-tests/publish-packages.ts +++ b/packages/e2e-tests/publish-packages.ts @@ -5,9 +5,6 @@ import * as path from 'path'; const repositoryRoot = path.resolve(__dirname, '../..'); -// Create tarballs -childProcess.execSync('yarn build:tarball', { encoding: 'utf8', cwd: repositoryRoot, stdio: 'inherit' }); - // Get absolute paths of all the packages we want to publish to the fake registry const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', { cwd: repositoryRoot, diff --git a/packages/e2e-tests/run.ts b/packages/e2e-tests/run.ts index 658b4ffaa97f..9e407fd8d062 100644 --- a/packages/e2e-tests/run.ts +++ b/packages/e2e-tests/run.ts @@ -16,11 +16,8 @@ async function run(): Promise { } const envVarsToInject = { - REACT_APP_E2E_TEST_DSN: process.env.E2E_TEST_DSN, - REMIX_APP_E2E_TEST_DSN: process.env.E2E_TEST_DSN, NEXT_PUBLIC_E2E_TEST_DSN: process.env.E2E_TEST_DSN, PUBLIC_E2E_TEST_DSN: process.env.E2E_TEST_DSN, - BASE_PORT: '27496', // just some random port }; try { diff --git a/packages/e2e-tests/test-applications/create-next-app/package.json b/packages/e2e-tests/test-applications/create-next-app/package.json index 3232c1eca7fe..f57202223844 100644 --- a/packages/e2e-tests/test-applications/create-next-app/package.json +++ b/packages/e2e-tests/test-applications/create-next-app/package.json @@ -5,7 +5,9 @@ "scripts": { "build": "next build", "test:prod": "TEST_ENV=prod playwright test", - "test:dev": "TEST_ENV=dev playwright test" + "test:dev": "TEST_ENV=dev playwright test", + "test:build": "pnpm install && npx playwright install && pnpm build", + "test:assert": "pnpm test:prod && pnpn test:dev" }, "dependencies": { "@next/font": "13.0.7", diff --git a/packages/e2e-tests/test-applications/create-next-app/playwright.config.ts b/packages/e2e-tests/test-applications/create-next-app/playwright.config.ts index 22dddd16d7ba..3747c02aea05 100644 --- a/packages/e2e-tests/test-applications/create-next-app/playwright.config.ts +++ b/packages/e2e-tests/test-applications/create-next-app/playwright.config.ts @@ -7,7 +7,7 @@ if (!testEnv) { throw new Error('No test env defined'); } -const port = Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO); +const port = 9000; /** * See https://playwright.dev/docs/test-configuration. diff --git a/packages/e2e-tests/test-applications/create-next-app/sentry.client.config.ts b/packages/e2e-tests/test-applications/create-next-app/sentry.client.config.ts index 48ca1cd7306b..6f68d598bb6c 100644 --- a/packages/e2e-tests/test-applications/create-next-app/sentry.client.config.ts +++ b/packages/e2e-tests/test-applications/create-next-app/sentry.client.config.ts @@ -6,7 +6,7 @@ import * as Sentry from '@sentry/nextjs'; Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions - dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN, + dsn: process.env.E2E_TEST_DSN, // Adjust this value in production, or use tracesSampler for greater control tracesSampleRate: 1.0, // ... diff --git a/packages/e2e-tests/test-applications/create-react-app/package.json b/packages/e2e-tests/test-applications/create-react-app/package.json index 062eef12aa45..5b15630f7a38 100644 --- a/packages/e2e-tests/test-applications/create-react-app/package.json +++ b/packages/e2e-tests/test-applications/create-react-app/package.json @@ -22,7 +22,11 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "test:build": "pnpm install && pnpm build", + "test:build-ts3.8": "pnpm install && pnpm add typescript@3.8 && pnpm build", + "test:build-canary": "pnpm install && pnpm add react@canary react-dom@canary && pnpm build", + "test:assert": "pnpm -v" }, "eslintConfig": { "extends": [ diff --git a/packages/e2e-tests/test-applications/create-remix-app/app/entry.client.tsx b/packages/e2e-tests/test-applications/create-remix-app/app/entry.client.tsx index edb18224d6c6..a4d1618fd976 100644 --- a/packages/e2e-tests/test-applications/create-remix-app/app/entry.client.tsx +++ b/packages/e2e-tests/test-applications/create-remix-app/app/entry.client.tsx @@ -10,7 +10,7 @@ import { hydrateRoot } from 'react-dom/client'; import * as Sentry from '@sentry/remix'; Sentry.init({ - dsn: process.env.REMIX_APP_E2E_TEST_DSN, + dsn: process.env.E2E_TEST_DSN, integrations: [ new Sentry.BrowserTracing({ routingInstrumentation: Sentry.remixRouterInstrumentation(useEffect, useLocation, useMatches), diff --git a/packages/e2e-tests/test-applications/create-remix-app/app/entry.server.tsx b/packages/e2e-tests/test-applications/create-remix-app/app/entry.server.tsx index c9975e940e21..62dd7ea43df2 100644 --- a/packages/e2e-tests/test-applications/create-remix-app/app/entry.server.tsx +++ b/packages/e2e-tests/test-applications/create-remix-app/app/entry.server.tsx @@ -16,7 +16,7 @@ import * as Sentry from '@sentry/remix'; const ABORT_DELAY = 5_000; Sentry.init({ - dsn: process.env.REMIX_APP_E2E_TEST_DSN, + dsn: process.env.E2E_TEST_DSN, // Performance Monitoring tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production! }); diff --git a/packages/e2e-tests/test-applications/create-remix-app/package.json b/packages/e2e-tests/test-applications/create-remix-app/package.json index 080bc7de0446..0bcf27589b8b 100644 --- a/packages/e2e-tests/test-applications/create-remix-app/package.json +++ b/packages/e2e-tests/test-applications/create-remix-app/package.json @@ -5,7 +5,9 @@ "build": "remix build", "dev": "remix dev", "start": "remix-serve build", - "typecheck": "tsc" + "typecheck": "tsc", + "test:build": "pnpn install && pnpm build", + "test:assert": "pnpm typecheck" }, "dependencies": { "@sentry/remix": "*", diff --git a/packages/e2e-tests/test-applications/nextjs-app-dir/assert-build.ts b/packages/e2e-tests/test-applications/nextjs-app-dir/assert-build.ts index cb7adf38cde8..b844f9139bfa 100644 --- a/packages/e2e-tests/test-applications/nextjs-app-dir/assert-build.ts +++ b/packages/e2e-tests/test-applications/nextjs-app-dir/assert-build.ts @@ -3,7 +3,7 @@ import * as assert from 'assert/strict'; const stdin = fs.readFileSync(0).toString(); -// Assert that all static components stay static and ally dynamic components stay dynamic +// Assert that all static components stay static and all dynamic components stay dynamic assert.match(stdin, /○ \/client-component/); assert.match(stdin, /● \/client-component\/parameter\/\[\.\.\.parameters\]/); diff --git a/packages/e2e-tests/test-applications/nextjs-app-dir/package.json b/packages/e2e-tests/test-applications/nextjs-app-dir/package.json index 45f79250d05f..b9c481604195 100644 --- a/packages/e2e-tests/test-applications/nextjs-app-dir/package.json +++ b/packages/e2e-tests/test-applications/nextjs-app-dir/package.json @@ -5,7 +5,12 @@ "scripts": { "build": "next build", "test:prod": "TEST_ENV=production playwright test", - "test:dev": "TEST_ENV=development playwright test" + "test:dev": "TEST_ENV=development playwright test", + "test:build": "pnpm install && npx playwright install && pnpm build", + "test:test-build": "pnpm ts-node --script-mode assert-build.ts", + "test:build-canary": "pnpm install && pnpm add next@canary && npx playwright install && pnpm build", + "test:build-latest": "pnpm install && pnpm add next@latest && npx playwright install && pnpm build", + "test:assert": "pnpm test:test-build && pnpm test:prod && pnpm test:dev" }, "dependencies": { "@next/font": "13.0.7", diff --git a/packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.ts b/packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.ts index d151f812ee38..8e8e6dc9c469 100644 --- a/packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.ts +++ b/packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.ts @@ -7,8 +7,8 @@ if (!testEnv) { throw new Error('No test env defined'); } -const nextPort = Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO); -const eventProxyPort = Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO) + Number(process.env.PORT_GAP); +const nextPort = 9000; +const eventProxyPort = 9001; /** * See https://playwright.dev/docs/test-configuration. diff --git a/packages/e2e-tests/test-applications/nextjs-app-dir/start-event-proxy.ts b/packages/e2e-tests/test-applications/nextjs-app-dir/start-event-proxy.ts index 705af6e98a7a..d5b670854e10 100644 --- a/packages/e2e-tests/test-applications/nextjs-app-dir/start-event-proxy.ts +++ b/packages/e2e-tests/test-applications/nextjs-app-dir/start-event-proxy.ts @@ -1,6 +1,6 @@ import { startEventProxyServer } from '../../test-utils/event-proxy-server'; startEventProxyServer({ - port: Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO) + Number(process.env.PORT_GAP), + port: 9001, proxyServerName: 'nextjs-13-app-dir', }); diff --git a/packages/e2e-tests/test-applications/node-express-app/package.json b/packages/e2e-tests/test-applications/node-express-app/package.json index 2bdb01bb3daf..a4a7b878b217 100644 --- a/packages/e2e-tests/test-applications/node-express-app/package.json +++ b/packages/e2e-tests/test-applications/node-express-app/package.json @@ -5,7 +5,9 @@ "scripts": { "build": "tsc", "start": "node dist/app.js", - "test": "playwright test" + "test": "playwright test", + "test:build": "pnpm install && pnpm build", + "test:assert": "pnpm test" }, "dependencies": { "@sentry/integrations": "*", diff --git a/packages/e2e-tests/test-applications/node-express-app/playwright.config.ts b/packages/e2e-tests/test-applications/node-express-app/playwright.config.ts index d0544001644b..1d78c94d7e71 100644 --- a/packages/e2e-tests/test-applications/node-express-app/playwright.config.ts +++ b/packages/e2e-tests/test-applications/node-express-app/playwright.config.ts @@ -58,7 +58,7 @@ const config: PlaywrightTestConfig = { /* Run your local dev server before starting the tests */ webServer: { command: 'pnpm start', - port: Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO), + port: 9000, }, }; diff --git a/packages/e2e-tests/test-applications/node-express-app/src/app.ts b/packages/e2e-tests/test-applications/node-express-app/src/app.ts index 1035a4958762..330017d20f95 100644 --- a/packages/e2e-tests/test-applications/node-express-app/src/app.ts +++ b/packages/e2e-tests/test-applications/node-express-app/src/app.ts @@ -11,14 +11,14 @@ declare global { Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions - dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN, + dsn: process.env.E2E_TEST_DSN, integrations: [new Integrations.HttpClient()], debug: true, tracesSampleRate: 1, }); const app = express(); -const port = Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO); +const port = 9000; app.use(Sentry.Handlers.requestHandler()); app.use(Sentry.Handlers.tracingHandler()); diff --git a/packages/e2e-tests/test-applications/react-create-hash-router/package.json b/packages/e2e-tests/test-applications/react-create-hash-router/package.json index bac46c9562d0..926dc7410bd9 100644 --- a/packages/e2e-tests/test-applications/react-create-hash-router/package.json +++ b/packages/e2e-tests/test-applications/react-create-hash-router/package.json @@ -21,7 +21,10 @@ "scripts": { "build": "react-scripts build", "start": "serve -s build", - "test": "playwright test" + "test": "playwright test", + "test:build": "pnpm install && npx playwright install && pnpm build", + "test:build-canary": "pnpm install && pnpm add react@canary react-dom@canary && npx playwright install && pnpm build", + "test:assert": "pnpm test" }, "eslintConfig": { "extends": [ diff --git a/packages/e2e-tests/test-applications/react-create-hash-router/playwright.config.ts b/packages/e2e-tests/test-applications/react-create-hash-router/playwright.config.ts index a24d7bc1c742..f895879fabb0 100644 --- a/packages/e2e-tests/test-applications/react-create-hash-router/playwright.config.ts +++ b/packages/e2e-tests/test-applications/react-create-hash-router/playwright.config.ts @@ -60,9 +60,9 @@ const config: PlaywrightTestConfig = { /* Run your local dev server before starting the tests */ webServer: { command: 'pnpm start', - port: Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO), + port: 9000, env: { - PORT: String(Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO)), + PORT: '9000', }, }, }; diff --git a/packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx b/packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx index aef574bce3c4..70ec5a8b8bdb 100644 --- a/packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx +++ b/packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx @@ -16,7 +16,7 @@ const replay = new Sentry.Replay(); Sentry.init({ // environment: 'qa', // dynamic sampling bias to keep transactions - dsn: process.env.REACT_APP_E2E_TEST_DSN, + dsn: process.env.E2E_TEST_DSN, integrations: [ new Sentry.BrowserTracing({ routingInstrumentation: Sentry.reactRouterV6Instrumentation( diff --git a/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/package.json b/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/package.json index abfb3bfea914..204916d0311b 100644 --- a/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/package.json +++ b/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/package.json @@ -22,7 +22,9 @@ "scripts": { "build": "react-scripts build", "start": "serve -s build", - "test": "playwright test" + "test": "playwright test", + "test:build": "pnpm install && npx playwright install && pnpm build", + "test:assert": "pnpm test" }, "eslintConfig": { "extends": [ diff --git a/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/playwright.config.ts b/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/playwright.config.ts index a24d7bc1c742..f895879fabb0 100644 --- a/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/playwright.config.ts +++ b/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/playwright.config.ts @@ -60,9 +60,9 @@ const config: PlaywrightTestConfig = { /* Run your local dev server before starting the tests */ webServer: { command: 'pnpm start', - port: Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO), + port: 9000, env: { - PORT: String(Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO)), + PORT: '9000', }, }, }; diff --git a/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/index.tsx b/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/index.tsx index a146513fcebb..7d51876eb3b8 100644 --- a/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/index.tsx +++ b/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/index.tsx @@ -16,7 +16,7 @@ import User from './pages/User'; Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions - dsn: process.env.REACT_APP_E2E_TEST_DSN, + dsn: process.env.E2E_TEST_DSN, integrations: [ new BrowserTracing({ routingInstrumentation: Sentry.reactRouterV6Instrumentation( diff --git a/packages/e2e-tests/test-applications/standard-frontend-react/package.json b/packages/e2e-tests/test-applications/standard-frontend-react/package.json index 8ea59b80e55a..9c3c8d13919f 100644 --- a/packages/e2e-tests/test-applications/standard-frontend-react/package.json +++ b/packages/e2e-tests/test-applications/standard-frontend-react/package.json @@ -21,7 +21,11 @@ "scripts": { "build": "react-scripts build", "start": "serve -s build", - "test": "playwright test" + "test": "playwright test", + "test:build": "pnpm install && npx playwright install && pnpm build", + "test:build-ts3.8": "pnpm install && pnpm add typescript@3.8 && npx playwright install && pnpm build", + "test:build-canary": "pnpm install && pnpm add react@canary react-dom@canary && npx playwright install && pnpm build", + "test:assert": "pnpm test" }, "eslintConfig": { "extends": [ diff --git a/packages/e2e-tests/test-applications/standard-frontend-react/playwright.config.ts b/packages/e2e-tests/test-applications/standard-frontend-react/playwright.config.ts index a24d7bc1c742..f895879fabb0 100644 --- a/packages/e2e-tests/test-applications/standard-frontend-react/playwright.config.ts +++ b/packages/e2e-tests/test-applications/standard-frontend-react/playwright.config.ts @@ -60,9 +60,9 @@ const config: PlaywrightTestConfig = { /* Run your local dev server before starting the tests */ webServer: { command: 'pnpm start', - port: Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO), + port: 9000, env: { - PORT: String(Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO)), + PORT: '9000', }, }, }; diff --git a/packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx b/packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx index 3ade9c308091..4ac6729a53f2 100644 --- a/packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx +++ b/packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx @@ -17,7 +17,7 @@ const replay = new Sentry.Replay(); Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions - dsn: process.env.REACT_APP_E2E_TEST_DSN, + dsn: process.env.E2E_TEST_DSN, integrations: [ new Sentry.BrowserTracing({ routingInstrumentation: Sentry.reactRouterV6Instrumentation( diff --git a/packages/e2e-tests/test-applications/sveltekit/package.json b/packages/e2e-tests/test-applications/sveltekit/package.json index 5c4139365599..fa0e9d8f5914 100644 --- a/packages/e2e-tests/test-applications/sveltekit/package.json +++ b/packages/e2e-tests/test-applications/sveltekit/package.json @@ -9,7 +9,9 @@ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "test:prod": "TEST_ENV=production playwright test", - "test:dev": "TEST_ENV=development playwright test" + "test:dev": "TEST_ENV=development playwright test", + "test:build": "pnpm install && pnpm build", + "test:assert": "pnpm -v" }, "dependencies": { "@sentry/sveltekit": "*" diff --git a/packages/e2e-tests/test-applications/sveltekit/playwright.config.ts b/packages/e2e-tests/test-applications/sveltekit/playwright.config.ts index edeec487f24c..3d1ed09ef424 100644 --- a/packages/e2e-tests/test-applications/sveltekit/playwright.config.ts +++ b/packages/e2e-tests/test-applications/sveltekit/playwright.config.ts @@ -7,7 +7,7 @@ if (!testEnv) { throw new Error('No test env defined'); } -const port = Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO); +const port = 9000; /** * See https://playwright.dev/docs/test-configuration. @@ -56,7 +56,7 @@ const config: PlaywrightTestConfig = { webServer: [ { command: 'pnpm ts-node --esm start-event-proxy.ts', - port: Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO) + Number(process.env.PORT_GAP), + port: 9001, }, { command: diff --git a/packages/e2e-tests/test-applications/sveltekit/src/hooks.client.ts b/packages/e2e-tests/test-applications/sveltekit/src/hooks.client.ts index 243813eda7b8..0010b3f3ae10 100644 --- a/packages/e2e-tests/test-applications/sveltekit/src/hooks.client.ts +++ b/packages/e2e-tests/test-applications/sveltekit/src/hooks.client.ts @@ -5,9 +5,7 @@ Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: env.PUBLIC_E2E_TEST_DSN, debug: true, - tunnel: `http://localhost:${ - Number(env.PUBLIC_BASE_PORT) + Number(env.PUBLIC_PORT_MODULO) + Number(env.PUBLIC_PORT_GAP) - }/`, // proxy server + tunnel: `http://localhost:9001/`, // proxy server tracesSampleRate: 1.0, }); diff --git a/packages/e2e-tests/test-applications/sveltekit/src/hooks.server.ts b/packages/e2e-tests/test-applications/sveltekit/src/hooks.server.ts index f049ff9b48f0..42aa10ed0a4c 100644 --- a/packages/e2e-tests/test-applications/sveltekit/src/hooks.server.ts +++ b/packages/e2e-tests/test-applications/sveltekit/src/hooks.server.ts @@ -5,7 +5,7 @@ Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: env.E2E_TEST_DSN, debug: true, - tunnel: `http://localhost:${Number(env.BASE_PORT) + Number(env.PORT_MODULO) + Number(env.PORT_GAP)}/`, // proxy server + tunnel: `http://localhost:9001/`, // proxy server tracesSampleRate: 1.0, }); diff --git a/packages/e2e-tests/test-applications/sveltekit/start-event-proxy.ts b/packages/e2e-tests/test-applications/sveltekit/start-event-proxy.ts index cac3cea3bacd..eb88d215617d 100644 --- a/packages/e2e-tests/test-applications/sveltekit/start-event-proxy.ts +++ b/packages/e2e-tests/test-applications/sveltekit/start-event-proxy.ts @@ -1,6 +1,6 @@ import { startEventProxyServer } from './event-proxy-server'; startEventProxyServer({ - port: Number(process.env.BASE_PORT) + Number(process.env.PORT_MODULO) + Number(process.env.PORT_GAP), + port: 9001, proxyServerName: 'sveltekit', });