Skip to content

Commit

Permalink
Merge pull request #847 from AppiumTestDistribution/proxy-cloud
Browse files Browse the repository at this point in the history
try proxy for cloud
  • Loading branch information
anandbagmar authored Oct 25, 2023
2 parents 9657084 + 0964703 commit 68b34a2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 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.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "appium-device-farm",
"version": "8.3.6",
"version": "8.3.7",
"description": "An appium 2.0 plugin that manages and create driver session on available devices",
"main": "./lib/index.js",
"scripts": {
Expand Down Expand Up @@ -188,6 +188,9 @@
},
"emulators": {
"type": "array"
},
"proxy": {
"type": "object"
}
},
"title": "Appium device farm plugin",
Expand Down
5 changes: 5 additions & 0 deletions server-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"device-farm": {
"platform": "android",
"skipChromeDownload": true,
"proxy": {
"host": "10.32.80.80",
"port": 800,
"auth": { "username": "username", "password": "password" }
},
"derivedDataPath": {
"simulator": "/Users/saikrishna/Library/Developer/Xcode/DerivedData/WebDriverAgent-Test"
}
Expand Down
13 changes: 8 additions & 5 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ import { ADB } from 'appium-adb';

const commandsQueueGuard = new AsyncLock();
const DEVICE_MANAGER_LOCK_NAME = 'DeviceManager';
let platform: any;
let androidDeviceType: any;
let iosDeviceType: any;
let skipChromeDownload: any;
let emulators: any;
let proxy: any;

class DevicePlugin extends BasePlugin {
constructor(pluginName: string, cliArgs: any) {
Expand All @@ -64,18 +70,14 @@ class DevicePlugin extends BasePlugin {
}

public static async updateServer(expressApp: any, httpServer: any, cliArgs: any): Promise<void> {
let platform;
let androidDeviceType;
let iosDeviceType;
let skipChromeDownload;
let emulators;
registerProxyMiddlware(expressApp);

if (cliArgs.plugin && cliArgs.plugin['device-farm']) {
platform = cliArgs.plugin['device-farm'].platform;
androidDeviceType = cliArgs.plugin['device-farm'].androidDeviceType || 'both';
iosDeviceType = cliArgs.plugin['device-farm'].iosDeviceType || 'both';
skipChromeDownload = cliArgs.plugin['device-farm'].skipChromeDownload;
proxy = cliArgs.plugin['device-farm'].proxy;
emulators = Object.hasOwn(cliArgs.plugin['device-farm'], 'emulators');
}

Expand Down Expand Up @@ -214,6 +216,7 @@ class DevicePlugin extends BasePlugin {
const config = {
method: 'post',
url: remoteUrl,
proxy,
headers: {
'Content-Type': 'application/json',
},
Expand Down

0 comments on commit 68b34a2

Please sign in to comment.