Skip to content

Commit a755833

Browse files
committed
WIP: Re-simplify tests now they're working to see what we _need_
1 parent f43b825 commit a755833

File tree

3 files changed

+8
-32
lines changed

3 files changed

+8
-32
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,12 @@ jobs:
6969

7070
- name: Run smoke tests
7171
run: |
72-
"$ANDROID_HOME/platform-tools/adb" start-server
73-
ps xao pid,ppid,pgid,cmd --forest
74-
7572
if [ "$RUNNER_OS" == "Linux" ]; then
7673
xvfb-run --auto-servernum npm test
7774
else
7875
npm test
7976
fi
8077
shell: bash
81-
env:
82-
DEBUG: pw:*
83-
HTTPTOOLKIT_SERVER_DISABLE_AUTOUPDATE: 1 # Don't try to autoupdate during tests etc
8478

8579
- uses: actions/upload-artifact@v4
8680
with:

src/index.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const DEV_MODE = process.env.HTK_DEV === 'true';
33
// Set up error handling before everything else:
44
import { logError, addBreadcrumb } from './errors.ts';
55

6-
import { spawn, ChildProcess, execSync } from 'child_process';
6+
import { spawn, ChildProcess } from 'child_process';
77
import * as os from 'os';
88
import { promises as fs, createWriteStream, WriteStream } from 'fs'
99
import * as net from 'net';
@@ -154,15 +154,6 @@ if (!amMainInstance) {
154154
console.log('Failed to kill server', error);
155155
logError(error);
156156
} finally {
157-
// Log at exit
158-
execSync('ps xao pid,ppid,pgid,cmd --forest', {
159-
stdio: 'inherit'
160-
});
161-
162-
if (process.stdin) process.stdin.destroy();
163-
if (process.stdout) process.stdout.destroy();
164-
if (process.stderr) process.stderr.destroy();
165-
166157
// We've done our best - now shut down for real.
167158
app.quit();
168159
}
@@ -375,11 +366,6 @@ if (!amMainInstance) {
375366
}
376367

377368
async function startServer(retries = 2) {
378-
await delay(100);
379-
execSync('ps xao pid,ppid,pgid,cmd --forest', {
380-
stdio: 'inherit'
381-
});
382-
383369
logStream.write('Starting server\n');
384370
const binName = isWindows ? 'httptoolkit-server.cmd' : 'httptoolkit-server';
385371
const serverBinPath = path.join(RESOURCES_PATH, 'httptoolkit-server', 'bin', binName);

test/smoke.spec.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ test('app launches and loads UI from server', async () => {
55
const electronApp = await electron.launch({
66
cwd: path.join(import.meta.dirname, '..'),
77
args: ['.'],
8-
timeout: 60000,
9-
...(process.env.CI && { env: { ...process.env, ELECTRON_ENABLE_LOGGING: '1' } })
8+
timeout: 10000,
9+
env: {
10+
...process.env,
11+
// Disable auto-update during tests
12+
'HTTPTOOLKIT_SERVER_DISABLE_AUTOUPDATE': '1'
13+
}
1014
});
1115

1216
electronApp.process().stdout?.on('data', (data) => {
@@ -19,15 +23,7 @@ test('app launches and loads UI from server', async () => {
1923
const window = await electronApp.firstWindow();
2024

2125
await expect(window.evaluate(() => typeof (window as any).desktopApi !== 'undefined')).resolves.toBe(true);
22-
console.log('saw desktopApi');
23-
2426
await expect(window.locator('h1:has-text("Intercept HTTP")')).toBeVisible({ timeout: 60000 });
25-
console.log('saw title');
26-
27-
electronApp.on('close', () => {
28-
console.log('electron app close event');
29-
});
3027

31-
// await electronApp.close();
32-
// console.log('closed app');
28+
await electronApp.close();
3329
});

0 commit comments

Comments
 (0)