-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip - still an error in backend error trace prop
- Loading branch information
Showing
4 changed files
with
112 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 72 additions & 3 deletions
75
dev-packages/e2e-tests/test-applications/sveltekit-2-twp/tests/errors.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,74 @@ | ||
import { test } from '@playwright/test'; | ||
import { expect, test } from '@playwright/test'; | ||
import { waitForError } from '@sentry-internal/test-utils'; | ||
test('errors on frontend and backend are connected by the same trace', async ({ page }) => { | ||
const clientErrorPromise = waitForError('sveltekit-2-twp', evt => { | ||
return evt.exception?.values?.[0].value === 'Client Error'; | ||
}); | ||
|
||
test.skip('errors on frontend and backend are connected by the same trace', async ({ page }) => { | ||
// TODO once browserTracingIntegration is always added | ||
const serverErrorPromise = waitForError('sveltekit-2-twp', evt => { | ||
return evt.exception?.values?.[0].value === 'No search query provided'; | ||
}); | ||
|
||
await page.goto('/errors'); | ||
|
||
const clientError = await clientErrorPromise; | ||
const serverError = await serverErrorPromise; | ||
|
||
expect(clientError).toMatchObject({ | ||
contexts: { | ||
trace: { | ||
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), | ||
span_id: expect.stringMatching(/[a-f0-9]{16}/), | ||
trace_id: expect.stringMatching(/[a-f0-9]{32}/), | ||
}, | ||
}, | ||
environment: 'qa', | ||
exception: { | ||
values: [ | ||
{ | ||
mechanism: { | ||
handled: false, | ||
type: 'onunhandledrejection', | ||
}, | ||
stacktrace: expect.any(Object), | ||
type: 'Error', | ||
value: 'Client Error', | ||
}, | ||
], | ||
}, | ||
level: 'error', | ||
platform: 'javascript', | ||
release: '1.0.0', | ||
timestamp: expect.any(Number), | ||
transaction: '/errors', | ||
}); | ||
|
||
expect(serverError).toMatchObject({ | ||
contexts: { | ||
trace: { | ||
span_id: expect.stringMatching(/[a-f0-9]{16}/), | ||
trace_id: expect.stringMatching(/[a-f0-9]{32}/), | ||
}, | ||
}, | ||
environment: 'qa', | ||
exception: { | ||
values: [ | ||
{ | ||
mechanism: { | ||
handled: true, | ||
type: 'generic', | ||
}, | ||
stacktrace: {}, | ||
}, | ||
], | ||
}, | ||
platform: 'node', | ||
timestamp: expect.any(Number), | ||
transaction: 'GET /errors', | ||
}); | ||
|
||
const clientTraceId = clientError.contexts?.trace?.trace_id; | ||
const serverTraceId = serverError.contexts?.trace?.trace_id; | ||
|
||
expect(clientTraceId).toBe(serverTraceId); | ||
}); |