Skip to content

Commit

Permalink
fix: handle cloud sessions gracefully (#38)
Browse files Browse the repository at this point in the history
* fix: handle cloud sessions gracefully

* Update package.json

* Update package-lock.json
  • Loading branch information
sudharsan-selvaraj authored Jul 23, 2024
1 parent 25ce153 commit 65e6372
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "appium-interceptor",
"version": "1.0.0-beta.9",
"version": "1.0.0-beta.10",
"description": "Appium 2.0 plugin to mock api calls for android apps",
"main": "./lib/index.js",
"types": "./lib/types/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export class AppiumInterceptorPlugin extends BasePlugin {
const adb = driver.sessions[sessionId]?.adb;

if (interceptFlag && platformName.toLowerCase().trim() === 'android') {
if(!adb) {
log.info(`Unable to find adb instance from session ${sessionId}. So skipping api interception.`);
return response;
}
const realDevice = await isRealDevice(adb, deviceUDID);
const proxy = await setupProxyServer(sessionId, deviceUDID, realDevice);
await configureWifiProxy(adb, deviceUDID, realDevice, proxy);
Expand Down

0 comments on commit 65e6372

Please sign in to comment.