-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtunnel.test.ts
More file actions
29 lines (20 loc) · 1.14 KB
/
tunnel.test.ts
File metadata and controls
29 lines (20 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
const useTunnelRoute = process.env.E2E_TEST_USE_TUNNEL_ROUTE === '1';
test.skip(!useTunnelRoute, 'Tunnel assertions only run in the tunnel variant');
test('Sends client-side errors through the monitor tunnel route', async ({ page }) => {
const errorEventPromise = waitForError('tanstackstart-react', errorEvent => {
return errorEvent?.exception?.values?.[0]?.value === 'Sentry Client Test Error';
});
await page.goto('/');
await expect(page.locator('button').filter({ hasText: 'Break the client' })).toBeVisible();
const monitorResponsePromise = page.waitForResponse(response => {
return response.url().endsWith('/monitor') && response.request().method() === 'POST';
});
await page.locator('button').filter({ hasText: 'Break the client' }).click();
const monitorResponse = await monitorResponsePromise;
const errorEvent = await errorEventPromise;
expect(monitorResponse.status()).toBe(200);
expect(errorEvent.exception?.values?.[0]?.value).toBe('Sentry Client Test Error');
expect(errorEvent.transaction).toBe('/');
});