Skip to content

Commit

Permalink
Test render name can be found via protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Oct 2, 2023
1 parent b878397 commit e0e5b81
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 0 deletions.
106 changes: 106 additions & 0 deletions test/e2e/test-apps/other/custom-renderer-name-protocol/event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"method": "envelope",
"sentryKey": "37f8a2ee37c0409d8970bc7559c7c7e4",
"appId": "277345",
"data": {
"sdk": {
"name": "sentry.javascript.electron",
"packages": [
{
"name": "npm:@sentry/electron",
"version": "{{version}}"
}
],
"version": "{{version}}"
},
"contexts": {
"app": {
"app_name": "custom-renderer-name-protocol",
"app_version": "1.0.0",
"app_start_time": "{{time}}"
},
"browser": {
"name": "Chrome"
},
"chrome": {
"name": "Chrome",
"type": "runtime",
"version": "{{version}}"
},
"device": {
"arch": "{{arch}}",
"family": "Desktop",
"memory_size": 0,
"free_memory": 0,
"processor_count": 0,
"processor_frequency": 0,
"cpu_description": "{{cpu}}",
"screen_resolution":"{{screen}}",
"screen_density": 1,
"language": "{{language}}"
},
"node": {
"name": "Node",
"type": "runtime",
"version": "{{version}}"
},
"os": {
"name": "{{platform}}",
"version": "{{version}}"
},
"runtime": {
"name": "Electron",
"version": "{{version}}"
}
},
"release": "custom-renderer-name-protocol@1.0.0",
"environment": "development",
"user": {
"ip_address": "{{auto}}"
},
"exception": {
"values": [
{
"type": "Error",
"value": "Some renderer error",
"stacktrace": {
"frames": [
{
"colno": 0,
"filename": "app:///src/index.html",
"function": "{{function}}",
"in_app": true,
"lineno": 0
}
]
},
"mechanism": {
"handled": false,
"type": "instrument"
}
}
]
},
"level": "error",
"event_id": "{{id}}",
"platform": "javascript",
"timestamp": 0,
"breadcrumbs": [
{
"timestamp": 0,
"category": "electron",
"message": "SomeWindow.dom-ready",
"type": "ui"
}
],
"request": {
"url": "app:///src/index.html"
},
"tags": {
"event.environment": "javascript",
"event.origin": "electron",
"event.process": "SomeWindow",
"event_type": "javascript"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "custom-renderer-name-protocol",
"version": "1.0.0",
"main": "src/main.js",
"dependencies": {
"@sentry/electron": "3.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
description: Custom Renderer Name via Protocol
command: yarn
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
</head>
<body>
<script>
const { init } = require('@sentry/electron');

init({
debug: true,
});

setTimeout(() => {
throw new Error('Some renderer error');
}, 500);
</script>
</body>
</html>
27 changes: 27 additions & 0 deletions test/e2e/test-apps/other/custom-renderer-name-protocol/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const path = require('path');

const { app, BrowserWindow } = require('electron');
const { init, IPCMode } = require('@sentry/electron');

init({
dsn: '__DSN__',
debug: true,
autoSessionTracking: false,
ipcMode: IPCMode.Protocol,
onFatalError: () => {},
getRendererName(_) {
return 'SomeWindow';
},
});

app.on('ready', () => {
const mainWindow = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
});

mainWindow.loadFile(path.join(__dirname, 'index.html'));
});

0 comments on commit e0e5b81

Please sign in to comment.