Skip to content

Commit 03e7627

Browse files
committed
tests: adjust assertions to be consistent
1 parent ceaa144 commit 03e7627

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

dev-packages/e2e-tests/test-applications/create-next-app/tests/server-transactions.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ test('Sends server-side transactions to Sentry', async ({ baseURL }) => {
4040
},
4141
description: 'test-span',
4242
origin: 'manual',
43-
// Note: parent_span_id may be the root span or an intermediate "executing api route" span
44-
// depending on Next.js instrumentation, so we just check it exists
43+
// Won't be the trace span id because we don't wrap the Next.js span in the wrapper
4544
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
4645
span_id: expect.stringMatching(/[a-f0-9]{16}/),
4746
start_timestamp: expect.any(Number),

dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/cjs-api-endpoints.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ test('should create a transaction for a CJS pages router API endpoint', async ({
3939
data: {
4040
'http.response.status_code': 200,
4141
'sentry.op': 'http.server',
42-
'sentry.origin': 'auto',
42+
'sentry.origin': 'auto.http.nextjs',
4343
'sentry.sample_rate': 1,
4444
'sentry.source': 'route',
4545
},
4646
op: 'http.server',
47-
origin: 'auto',
47+
origin: 'auto.http.nextjs',
4848
span_id: expect.stringMatching(/[a-f0-9]{16}/),
4949
status: 'ok',
5050
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
@@ -57,7 +57,7 @@ test('should create a transaction for a CJS pages router API endpoint', async ({
5757
cookies: expect.any(Object),
5858
headers: expect.any(Object),
5959
method: 'GET',
60-
url: expect.stringMatching(/\/api\/cjs-api-endpoint$/),
60+
url: expect.stringMatching(/^http.*\/api\/cjs-api-endpoint$/),
6161
},
6262
spans: expect.arrayContaining([]),
6363
start_timestamp: expect.any(Number),
@@ -102,12 +102,12 @@ test('should not mess up require statements in CJS API endpoints', async ({ requ
102102
data: {
103103
'http.response.status_code': 200,
104104
'sentry.op': 'http.server',
105-
'sentry.origin': 'auto',
105+
'sentry.origin': 'auto.http.nextjs',
106106
'sentry.sample_rate': 1,
107107
'sentry.source': 'route',
108108
},
109109
op: 'http.server',
110-
origin: 'auto',
110+
origin: 'auto.http.nextjs',
111111
span_id: expect.stringMatching(/[a-f0-9]{16}/),
112112
status: 'ok',
113113
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
@@ -120,7 +120,7 @@ test('should not mess up require statements in CJS API endpoints', async ({ requ
120120
cookies: expect.any(Object),
121121
headers: expect.any(Object),
122122
method: 'GET',
123-
url: expect.stringMatching(/\/api\/cjs-api-endpoint-with-require$/),
123+
url: expect.stringMatching(/^http.*\/api\/cjs-api-endpoint-with-require$/),
124124
},
125125
spans: expect.arrayContaining([]),
126126
start_timestamp: expect.any(Number),

dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/pages-router-api-endpoints.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ test('Should report an error event for errors thrown in pages router api routes'
5555
data: {
5656
'http.response.status_code': 500,
5757
'sentry.op': 'http.server',
58-
'sentry.origin': 'auto',
58+
'sentry.origin': 'auto.http.nextjs',
5959
'sentry.source': 'route',
6060
},
6161
op: 'http.server',
62-
origin: 'auto',
62+
origin: 'auto.http.nextjs',
6363
span_id: expect.stringMatching(/[a-f0-9]{16}/),
6464
status: 'internal_error',
6565
trace_id: (await errorEventPromise).contexts?.trace?.trace_id,
@@ -98,11 +98,11 @@ test('Should report a transaction event for a successful pages router api route'
9898
data: {
9999
'http.response.status_code': 200,
100100
'sentry.op': 'http.server',
101-
'sentry.origin': 'auto',
101+
'sentry.origin': 'auto.http.nextjs',
102102
'sentry.source': 'route',
103103
},
104104
op: 'http.server',
105-
origin: 'auto',
105+
origin: 'auto.http.nextjs',
106106
span_id: expect.stringMatching(/[a-f0-9]{16}/),
107107
status: 'ok',
108108
trace_id: expect.stringMatching(/[a-f0-9]{32}/),

dev-packages/e2e-tests/test-applications/nextjs-pages-dir/tests/edge-route.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ test('Faulty edge routes', async ({ request }) => {
5454

5555
test.step('should have scope isolation', () => {
5656
expect(edgerouteTransaction.tags?.['my-isolated-tag']).toBe(true);
57-
expect(edgerouteTransaction.tags?.['my-global-scope-isolated-tag']).not.toBeDefined();
57+
// No longer valid since we removed the global scope isolation from the wrapper
58+
// expect(edgerouteTransaction.tags?.['my-global-scope-isolated-tag']).not.toBeDefined();
59+
expect(edgerouteTransaction.tags?.['my-global-scope-isolated-tag']).toBeDefined();
5860
expect(errorEvent.tags?.['my-isolated-tag']).toBe(true);
59-
expect(errorEvent.tags?.['my-global-scope-isolated-tag']).not.toBeDefined();
61+
// No longer valid since we removed the global scope isolation from the wrapper
62+
// expect(errorEvent.tags?.['my-global-scope-isolated-tag']).not.toBeDefined();
63+
expect(errorEvent.tags?.['my-global-scope-isolated-tag']).toBeDefined();
6064
});
6165
});

0 commit comments

Comments
 (0)