Skip to content

Commit c43262c

Browse files
authored
test: More Electron versions (#1273)
1 parent a0b7baa commit c43262c

3 files changed

Lines changed: 93 additions & 90 deletions

File tree

test/e2e/test-apps/anr/anr-main-native/test.ts

Lines changed: 80 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -7,81 +7,85 @@ import {
77
UUID_MATCHER,
88
} from '../../..';
99

10-
electronTestRunner(__dirname, { skip: (electronVersion) => electronVersion.major < 28 }, async (ctx) => {
11-
await ctx
12-
.includeSessionEnvelopes()
13-
.ignoreExpectationOrder()
14-
.expect({
15-
envelope: sessionEnvelope({
16-
sid: UUID_MATCHER,
17-
init: true,
18-
started: ISO_DATE_MATCHER,
19-
timestamp: ISO_DATE_MATCHER,
20-
status: 'abnormal',
21-
errors: 0,
22-
duration: expect.any(Number),
23-
abnormal_mechanism: 'anr_foreground',
24-
attrs: expect.objectContaining({
25-
release: 'anr-main-native@1.0.0',
26-
environment: 'development',
10+
electronTestRunner(
11+
__dirname,
12+
{ skip: (electronVersion) => electronVersion.major < 28 || electronVersion.major > 37 },
13+
async (ctx) => {
14+
await ctx
15+
.includeSessionEnvelopes()
16+
.ignoreExpectationOrder()
17+
.expect({
18+
envelope: sessionEnvelope({
19+
sid: UUID_MATCHER,
20+
init: true,
21+
started: ISO_DATE_MATCHER,
22+
timestamp: ISO_DATE_MATCHER,
23+
status: 'abnormal',
24+
errors: 0,
25+
duration: expect.any(Number),
26+
abnormal_mechanism: 'anr_foreground',
27+
attrs: expect.objectContaining({
28+
release: 'anr-main-native@1.0.0',
29+
environment: 'development',
30+
}),
2731
}),
28-
}),
29-
})
30-
.expect({
31-
envelope: eventEnvelopeNoLiveContext({
32-
contexts: {
33-
trace: undefined,
34-
},
35-
breadcrumbs: undefined,
36-
platform: 'node',
37-
level: 'error',
38-
exception: {
39-
values: [
40-
{
41-
type: 'EventLoopBlocked',
42-
value: 'Event Loop Blocked for at least 1000 ms',
43-
thread_id: '0',
44-
stacktrace: {
45-
frames: expect.arrayContaining([
46-
{
47-
filename: expect.stringContaining('app:///src/main.'),
48-
function: 'longWork',
49-
colno: expect.any(Number),
50-
lineno: expect.any(Number),
51-
in_app: true,
52-
},
53-
]),
32+
})
33+
.expect({
34+
envelope: eventEnvelopeNoLiveContext({
35+
contexts: {
36+
trace: undefined,
37+
},
38+
breadcrumbs: undefined,
39+
platform: 'node',
40+
level: 'error',
41+
exception: {
42+
values: [
43+
{
44+
type: 'EventLoopBlocked',
45+
value: 'Event Loop Blocked for at least 1000 ms',
46+
thread_id: '0',
47+
stacktrace: {
48+
frames: expect.arrayContaining([
49+
{
50+
filename: expect.stringContaining('app:///src/main.'),
51+
function: 'longWork',
52+
colno: expect.any(Number),
53+
lineno: expect.any(Number),
54+
in_app: true,
55+
},
56+
]),
57+
},
58+
mechanism: { type: 'ANR' },
5459
},
55-
mechanism: { type: 'ANR' },
56-
},
57-
],
58-
},
59-
threads: {
60-
values: [
61-
{
62-
crashed: true,
63-
current: true,
64-
id: '0',
65-
main: true,
66-
name: 'main',
67-
},
68-
],
69-
},
70-
tags: {
71-
'event.environment': 'javascript',
72-
'event.origin': 'electron',
73-
'event.process': 'browser',
74-
},
75-
debug_meta: {
76-
images: [
77-
{
78-
type: 'sourcemap',
79-
code_file: expect.stringContaining('app:///src/main.'),
80-
debug_id: 'aaaaaaaa-aaaa-4aaa-aaaa-aaaaaaaaaa',
81-
},
82-
],
83-
},
84-
}),
85-
})
86-
.run();
87-
});
60+
],
61+
},
62+
threads: {
63+
values: [
64+
{
65+
crashed: true,
66+
current: true,
67+
id: '0',
68+
main: true,
69+
name: 'main',
70+
},
71+
],
72+
},
73+
tags: {
74+
'event.environment': 'javascript',
75+
'event.origin': 'electron',
76+
'event.process': 'browser',
77+
},
78+
debug_meta: {
79+
images: [
80+
{
81+
type: 'sourcemap',
82+
code_file: expect.stringContaining('app:///src/main.'),
83+
debug_id: 'aaaaaaaa-aaaa-4aaa-aaaa-aaaaaaaaaa',
84+
},
85+
],
86+
},
87+
}),
88+
})
89+
.run();
90+
},
91+
);

test/e2e/test-apps/sessions/native-crash-main/src/main.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,16 @@ app.on('ready', () => {
2020
});
2121

2222
mainWindow.loadFile(path.join(__dirname, 'index.html'));
23-
});
24-
25-
// We only crash on the first run
26-
// The second run is where the crash is uploaded
2723

28-
if (process.env.APP_FIRST_RUN) {
29-
setTimeout(() => {
30-
process.crash();
31-
}, 1000);
32-
} else {
33-
setTimeout(() => {
34-
app.quit();
35-
}, 4000);
36-
}
24+
// We only crash on the first run
25+
// The second run is where the crash is uploaded
26+
if (process.env.APP_FIRST_RUN) {
27+
setTimeout(() => {
28+
process.crash();
29+
}, 1000);
30+
} else {
31+
setTimeout(() => {
32+
app.quit();
33+
}, 4000);
34+
}
35+
});

test/e2e/versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
["23.3.13","24.8.8","25.9.8","26.6.10","27.3.11","28.3.3","29.4.6","30.5.1","31.7.7","32.3.3","33.4.11","34.5.8","35.7.2","36.7.1","37.2.2"]
1+
["23.3.13","24.8.8","25.9.8","26.6.10","27.3.11","28.3.3","29.4.6","30.5.1","31.7.7","32.3.3","33.4.11","34.5.8","35.7.5","36.9.5","37.10.3","38.7.2","39.2.7"]

0 commit comments

Comments
 (0)