Skip to content

Commit 3e55a46

Browse files
authored
Update restart.test.js
1 parent 78f3307 commit 3e55a46

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

tests/e2e/restart.test.js

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,6 @@ function isElectronRunning(pid) {
2121
}
2222
}
2323

24-
function forceKillElectron(pid) {
25-
try {
26-
const platform = os.platform();
27-
28-
if (platform === 'win32') {
29-
execSync(`taskkill /PID ${pid} /F`);
30-
} else if (platform === 'darwin' || platform === 'linux') {
31-
process.kill(pid, 'SIGKILL');
32-
}
33-
console.log('Electron process forcefully terminated.');
34-
} catch (error) {
35-
console.error('Error forcefully terminating Electron process:', error);
36-
}
37-
}
38-
3924
test('Launch and close Electron app 10 times', async () => {
4025
for (let i = 0; i < 10; i++) {
4126
console.log(`Iteration ${i + 1}: Launching and closing Electron app.`);
@@ -45,6 +30,11 @@ test('Launch and close Electron app 10 times', async () => {
4530
const pid = app.process().pid;
4631
const window = await app.firstWindow();
4732

33+
// Selecting the device (MPW1 Gemini)
34+
const deviceDropdown = await window.waitForSelector('#deviceId');
35+
await deviceDropdown.selectOption('MPW1');
36+
37+
4838
// Close the app
4939
await app.close();
5040

@@ -54,19 +44,6 @@ test('Launch and close Electron app 10 times', async () => {
5444
// Check if the Electron app is still running
5545
let running = isElectronRunning(pid);
5646
if (running) {
57-
console.warn(`Iteration ${i + 1}: Electron app is still running. Attempting to force kill.`);
58-
forceKillElectron(pid);
59-
60-
// Re-check if the process is still running after the forced kill
61-
running = isElectronRunning(pid);
62-
}
63-
64-
// Assert that the app is not running
65-
expect(running).toBeFalsy();
66-
67-
if (!running) {
68-
console.log(`Iteration ${i + 1}: Electron app closed successfully.`);
69-
} else {
7047
console.error(`Iteration ${i + 1}: Electron app could not be terminated.`);
7148
break; // Stop further iterations if the app cannot be killed
7249
}

0 commit comments

Comments
 (0)