-
-
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: Refactor webpack E2E tests to avoid sending to Sentry (#12312)
Part of #11910
- Loading branch information
Showing
14 changed files
with
62 additions
and
208 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { browserTracingIntegration, captureException, init } from '@sentry/browser'; | ||
import { browserTracingIntegration, init } from '@sentry/browser'; | ||
|
||
init({ | ||
dsn: process.env.E2E_TEST_DSN, | ||
integrations: [browserTracingIntegration()], | ||
tunnel: 'http://localhost:3031', | ||
}); | ||
|
||
setTimeout(() => { | ||
const eventId = captureException(new Error('I am an error!')); | ||
window.capturedExceptionId = eventId; | ||
throw new Error('I am an error!'); | ||
}, 2000); |
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
7 changes: 7 additions & 0 deletions
7
dev-packages/e2e-tests/test-applications/webpack-4/playwright.config.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,7 @@ | ||
import { getPlaywrightConfig } from '@sentry-internal/test-utils'; | ||
|
||
const config = getPlaywrightConfig({ | ||
startCommand: 'pnpm start', | ||
}); | ||
|
||
export default config; |
70 changes: 0 additions & 70 deletions
70
dev-packages/e2e-tests/test-applications/webpack-4/playwright.config.ts
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
dev-packages/e2e-tests/test-applications/webpack-4/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/test-utils'; | ||
|
||
startEventProxyServer({ | ||
port: 3031, | ||
proxyServerName: 'webpack-4', | ||
}); |
31 changes: 0 additions & 31 deletions
31
dev-packages/e2e-tests/test-applications/webpack-4/tests/behaviour-test.spec.ts
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
dev-packages/e2e-tests/test-applications/webpack-4/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,14 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { waitForError } from '@sentry-internal/test-utils'; | ||
|
||
test('Captures an exception', async ({ page }) => { | ||
const eventPromise = waitForError('webpack-4', event => { | ||
return event.exception?.values?.[0].value === 'I am an error!'; | ||
}); | ||
await page.goto('/'); | ||
|
||
const errorEvent = await eventPromise; | ||
|
||
expect(errorEvent.exception?.values?.[0].value).toBe('I am an error!'); | ||
expect(errorEvent.transaction).toBe('/'); | ||
}); |
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,11 +1,11 @@ | ||
import { browserTracingIntegration, captureException, init } from '@sentry/browser'; | ||
import { browserTracingIntegration, init } from '@sentry/browser'; | ||
|
||
init({ | ||
dsn: process.env.E2E_TEST_DSN, | ||
integrations: [browserTracingIntegration()], | ||
tunnel: 'http://localhost:3031', | ||
}); | ||
|
||
setTimeout(() => { | ||
const eventId = captureException(new Error('I am an error!')); | ||
window.capturedExceptionId = eventId; | ||
throw new Error('I am an error!'); | ||
}, 2000); |
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
7 changes: 7 additions & 0 deletions
7
dev-packages/e2e-tests/test-applications/webpack-5/playwright.config.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,7 @@ | ||
import { getPlaywrightConfig } from '@sentry-internal/test-utils'; | ||
|
||
const config = getPlaywrightConfig({ | ||
startCommand: 'pnpm start', | ||
}); | ||
|
||
export default config; |
70 changes: 0 additions & 70 deletions
70
dev-packages/e2e-tests/test-applications/webpack-5/playwright.config.ts
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
dev-packages/e2e-tests/test-applications/webpack-5/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/test-utils'; | ||
|
||
startEventProxyServer({ | ||
port: 3031, | ||
proxyServerName: 'webpack-5', | ||
}); |
31 changes: 0 additions & 31 deletions
31
dev-packages/e2e-tests/test-applications/webpack-5/tests/behaviour-test.spec.ts
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
dev-packages/e2e-tests/test-applications/webpack-5/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,14 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { waitForError } from '@sentry-internal/test-utils'; | ||
|
||
test('Captures an exception', async ({ page }) => { | ||
const eventPromise = waitForError('webpack-5', event => { | ||
return event.exception?.values?.[0].value === 'I am an error!'; | ||
}); | ||
await page.goto('/'); | ||
|
||
const errorEvent = await eventPromise; | ||
|
||
expect(errorEvent.exception?.values?.[0].value).toBe('I am an error!'); | ||
expect(errorEvent.transaction).toBe('/'); | ||
}); |