Skip to content

Commit 68bafbe

Browse files
add more mocks
1 parent 17fc49f commit 68bafbe

9 files changed

Lines changed: 411 additions & 105 deletions

File tree

.DS_Store

6 KB
Binary file not shown.

package-lock.json

Lines changed: 164 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"http-mitm-proxy": "^1.1.0",
9797
"ip": "^1.1.8",
9898
"lodash": "^4.17.21",
99+
"minimatch": "^9.0.3",
99100
"regex-parser": "^2.3.0",
100101
"uuid": "^9.0.1"
101102
}

src/plugin.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import _ from 'lodash';
66
import { configureWifiProxy, isRealDevice } from './utils/adb';
77
import { cleanUpProxyServer, setupProxyServer } from './utils/proxy';
88
import proxyCache from './proxy-cache';
9+
910
export class AppiumInterceptorPlugin extends BasePlugin {
1011
constructor(name: string, cliArgs: CliArg) {
1112
super(name, cliArgs);
@@ -52,4 +53,16 @@ export class AppiumInterceptorPlugin extends BasePlugin {
5253
}
5354
return next();
5455
}
56+
57+
async onUnexpectedShutdown(driver: any, cause: any) {
58+
const sessions = Object.keys(driver.sessions || {});
59+
for (const sessionId of sessions) {
60+
const proxy = proxyCache.get(sessionId);
61+
if (proxy) {
62+
const adb = driver.sessions[sessionId]?.adb;
63+
await configureWifiProxy(adb, proxy.getDeviceUDID(), false);
64+
await cleanUpProxyServer(proxy);
65+
}
66+
}
67+
}
5568
}

0 commit comments

Comments
 (0)