-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy patherrors.test.ts
More file actions
94 lines (73 loc) · 2.63 KB
/
errors.test.ts
File metadata and controls
94 lines (73 loc) · 2.63 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
test('Sends client-side error to Sentry with auto-instrumentation', 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();
await page.locator('button').filter({ hasText: 'Break the client' }).click();
const errorEvent = await errorEventPromise;
expect(errorEvent).toMatchObject({
exception: {
values: [
{
type: 'Error',
value: 'Sentry Client Test Error',
mechanism: {
handled: false,
},
},
],
},
});
expect(errorEvent.transaction).toBe('/');
});
test('Sends server-side function error to Sentry with auto-instrumentation', async ({ page }) => {
const errorEventPromise = waitForError('tanstackstart-react', errorEvent => {
return errorEvent?.exception?.values?.[0]?.value === 'Sentry Server Function Test Error';
});
await page.goto(`/`);
await expect(page.locator('button').filter({ hasText: 'Break server function' })).toBeVisible();
await page.locator('button').filter({ hasText: 'Break server function' }).click();
const errorEvent = await errorEventPromise;
expect(errorEvent).toMatchObject({
exception: {
values: [
{
type: 'Error',
value: 'Sentry Server Function Test Error',
mechanism: {
handled: false,
type: 'auto.function.tanstackstart.server',
},
},
],
},
});
expect(errorEvent.transaction).toBe('/');
});
test('Sends API route error to Sentry with auto-instrumentation', async ({ page }) => {
const errorEventPromise = waitForError('tanstackstart-react', errorEvent => {
return errorEvent?.exception?.values?.[0]?.value === 'Sentry API Route Test Error';
});
await page.goto(`/`);
await expect(page.locator('button').filter({ hasText: 'Break API route' })).toBeVisible();
await page.locator('button').filter({ hasText: 'Break API route' }).click();
const errorEvent = await errorEventPromise;
expect(errorEvent).toMatchObject({
exception: {
values: [
{
type: 'Error',
value: 'Sentry API Route Test Error',
mechanism: {
handled: false,
type: 'auto.function.tanstackstart.server',
},
},
],
},
});
expect(errorEvent.transaction).toBe('GET /api/error');
});