-
-
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.
test(react): Update react-create-hash-router E2E test (#12262)
Instead of just testing to send to Sentry, this now tests the actual payloads being sent. This kind of builds on top of #12259, where we specifically test the event sending now.
- Loading branch information
Showing
9 changed files
with
208 additions
and
482 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
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
6 changes: 6 additions & 0 deletions
6
dev-packages/e2e-tests/test-applications/react-create-hash-router/start-event-proxy.mjs
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { startEventProxyServer } from '@sentry-internal/event-proxy-server'; | ||
|
||
startEventProxyServer({ | ||
port: 3031, | ||
proxyServerName: 'react-create-hash-router', | ||
}); |
204 changes: 0 additions & 204 deletions
204
...ackages/e2e-tests/test-applications/react-create-hash-router/tests/behaviour-test.spec.ts
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
dev-packages/e2e-tests/test-applications/react-create-hash-router/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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { waitForError } from '@sentry-internal/event-proxy-server'; | ||
|
||
test('Captures exception correctly', async ({ page }) => { | ||
const errorEventPromise = waitForError('react-create-hash-router', event => { | ||
return !event.type && event.exception?.values?.[0]?.value === 'I am an error!'; | ||
}); | ||
|
||
await page.goto('/'); | ||
|
||
const exceptionButton = page.locator('id=exception-button'); | ||
await exceptionButton.click(); | ||
|
||
const errorEvent = await errorEventPromise; | ||
|
||
expect(errorEvent.exception?.values).toHaveLength(1); | ||
expect(errorEvent.exception?.values?.[0]?.value).toBe('I am an error!'); | ||
|
||
expect(errorEvent.request).toEqual({ | ||
headers: expect.any(Object), | ||
url: 'http://localhost:3030/', | ||
}); | ||
|
||
expect(errorEvent.transaction).toEqual('/'); | ||
|
||
expect(errorEvent.contexts?.trace).toEqual({ | ||
trace_id: expect.any(String), | ||
span_id: expect.any(String), | ||
}); | ||
}); |
Oops, something went wrong.