-
-
Notifications
You must be signed in to change notification settings - Fork 360
Expand file tree
/
Copy pathcaptureMessage.test.android.manual.ts
More file actions
148 lines (130 loc) · 4.45 KB
/
captureMessage.test.android.manual.ts
File metadata and controls
148 lines (130 loc) · 4.45 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import { describe, it, beforeAll, expect, afterAll } from '@jest/globals';
import { Envelope, EventItem } from '@sentry/core';
import {
createSentryServer,
containingEventWithAndroidMessage,
} from '../../utils/mockedSentryServer';
import { getItemOfTypeFrom } from '../../utils/event';
import { maestro } from '../../utils/maestro';
describe('Capture message (manual native init)', () => {
let sentryServer = createSentryServer();
let envelope: Envelope;
beforeAll(async () => {
await sentryServer.start();
const envelopePromise = sentryServer.waitForEnvelope(
containingEventWithAndroidMessage('Captured message'),
);
await maestro('tests/captureMessage/captureMessage.test.yml');
envelope = await envelopePromise;
}, 240000); // 240 seconds timeout
afterAll(async () => {
await sentryServer.close();
});
it('envelope contains message event', async () => {
const item = getItemOfTypeFrom<EventItem>(envelope, 'event');
expect(item).toEqual([
{
content_type: 'application/json',
length: expect.any(Number),
type: 'event',
},
expect.objectContaining({
level: 'info',
message: {
message: 'Captured message',
},
platform: 'javascript',
}),
]);
});
it('contains device context', async () => {
const item = getItemOfTypeFrom<EventItem>(envelope, 'event');
expect(item?.[1]).toEqual(
expect.objectContaining({
contexts: expect.objectContaining({
device: expect.objectContaining({
battery_level: expect.any(Number),
battery_temperature: expect.any(Number),
boot_time: expect.any(String),
brand: expect.any(String),
charging: expect.any(Boolean),
connection_type: expect.any(String),
family: expect.any(String),
free_memory: expect.any(Number),
free_storage: expect.any(Number),
id: expect.any(String),
locale: expect.any(String),
low_memory: expect.any(Boolean),
manufacturer: expect.any(String),
memory_size: expect.any(Number),
model: expect.any(String),
model_id: expect.any(String),
online: expect.any(Boolean),
orientation: expect.any(String),
processor_count: expect.any(Number),
processor_frequency: expect.any(Number),
screen_density: expect.any(Number),
screen_dpi: expect.any(Number),
screen_height_pixels: expect.any(Number),
screen_width_pixels: expect.any(Number),
simulator: expect.any(Boolean),
storage_size: expect.any(Number),
timezone: expect.any(String),
}),
}),
}),
);
});
it('contains app context', async () => {
const item = getItemOfTypeFrom<EventItem>(envelope, 'event');
expect(item?.[1]).toEqual(
expect.objectContaining({
contexts: expect.objectContaining({
app: expect.objectContaining({
app_build: expect.any(String),
app_identifier: expect.any(String),
app_name: expect.any(String),
app_start_time: expect.any(String),
app_version: expect.any(String),
in_foreground: expect.any(Boolean),
view_names: ['ErrorsScreen'],
}),
}),
}),
);
});
it('contains os context', async () => {
const item = getItemOfTypeFrom<EventItem>(envelope, 'event');
expect(item?.[1]).toEqual(
expect.objectContaining({
contexts: expect.objectContaining({
os: {
build: expect.any(String),
kernel_version: expect.any(String),
name: 'Android',
rooted: expect.any(Boolean),
version: expect.any(String),
},
}),
}),
);
});
it('contains react native context', async () => {
const item = getItemOfTypeFrom<EventItem>(envelope, 'event');
expect(item?.[1]).toEqual(
expect.objectContaining({
contexts: expect.objectContaining({
react_native_context: {
expo: false,
fabric: expect.any(Boolean),
hermes_debug_info: expect.any(Boolean),
hermes_version: expect.any(String),
js_engine: 'hermes',
react_native_version: expect.any(String),
turbo_module: expect.any(Boolean),
},
}),
}),
);
});
});