From fc17dae983205d05b1093ea14e58a4e856e49d4f Mon Sep 17 00:00:00 2001 From: s1gr1d Date: Fri, 18 Jul 2025 13:52:48 +0200 Subject: [PATCH 1/2] test(astro): Add E2E test for catch-all routes --- .../src/pages/catchAll/[...path].astro | 12 +++++ .../astro-5/tests/tracing.dynamic.test.ts | 49 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 dev-packages/e2e-tests/test-applications/astro-5/src/pages/catchAll/[...path].astro diff --git a/dev-packages/e2e-tests/test-applications/astro-5/src/pages/catchAll/[...path].astro b/dev-packages/e2e-tests/test-applications/astro-5/src/pages/catchAll/[...path].astro new file mode 100644 index 000000000000..bb225c166241 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/astro-5/src/pages/catchAll/[...path].astro @@ -0,0 +1,12 @@ +--- +import Layout from '../../layouts/Layout.astro'; + +export const prerender = false; + +const params = Astro.params; + +--- + + +

params: {params}

+
diff --git a/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts b/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts index 36f32cd5dc0e..f98672830d32 100644 --- a/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts @@ -262,4 +262,53 @@ test.describe('nested SSR routes (client, server, server request)', () => { request: { url: expect.stringContaining('/api/user/myUsername123.json') }, }); }); + + test('sends parametrized pageload and server transaction names for catch-all routes', async ({ page }) => { + const clientPageloadTxnPromise = waitForTransaction('astro-5', txnEvent => { + return txnEvent?.transaction?.startsWith('/catchAll/') ?? false; + }); + + const serverPageRequestTxnPromise = waitForTransaction('astro-5', txnEvent => { + return txnEvent?.transaction?.startsWith('GET /catchAll/') ?? false; + }); + + await page.goto('/catchAll/hell0/whatever-do'); + + const clientPageloadTxn = await clientPageloadTxnPromise; + const serverPageRequestTxn = await serverPageRequestTxnPromise; + + expect(clientPageloadTxn).toMatchObject({ + transaction: '/catchAll/hell0/whatever-do', // todo: parametrize to '/catchAll/[...path]' + transaction_info: { source: 'url' }, + contexts: { + trace: { + op: 'pageload', + origin: 'auto.pageload.browser', + data: { + 'sentry.op': 'pageload', + 'sentry.origin': 'auto.pageload.browser', + 'sentry.source': 'url', + }, + }, + }, + }); + + expect(serverPageRequestTxn).toMatchObject({ + transaction: 'GET /catchAll/[path]', + transaction_info: { source: 'route' }, + contexts: { + trace: { + op: 'http.server', + origin: 'auto.http.astro', + data: { + 'sentry.op': 'http.server', + 'sentry.origin': 'auto.http.astro', + 'sentry.source': 'route', + url: expect.stringContaining('/catchAll/hell0/whatever-do'), + }, + }, + }, + request: { url: expect.stringContaining('/catchAll/hell0/whatever-do') }, + }); + }); }); From fda4f240978ee6e99a546c0344aa5d86a2de9b6d Mon Sep 17 00:00:00 2001 From: s1gr1d Date: Fri, 18 Jul 2025 13:55:11 +0200 Subject: [PATCH 2/2] test(astro): Add E2E test for catch-all routes --- .../test-applications/astro-5/tests/tracing.dynamic.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts b/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts index f98672830d32..9315d3d3ea84 100644 --- a/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts +++ b/dev-packages/e2e-tests/test-applications/astro-5/tests/tracing.dynamic.test.ts @@ -233,7 +233,7 @@ test.describe('nested SSR routes (client, server, server request)', () => { expect(serverRequestHTTPClientSpan).toMatchObject({ op: 'http.client', origin: 'auto.http.otel.node_fetch', - description: 'GET http://localhost:3030/api/user/myUsername123.json', // todo: parametrize (this is just a span though - no transaction) + description: 'GET http://localhost:3030/api/user/myUsername123.json', // http.client does not need to be parametrized data: { 'sentry.op': 'http.client', 'sentry.origin': 'auto.http.otel.node_fetch',