From 62f1106677788416b4c4c564026de4d8e06e93a7 Mon Sep 17 00:00:00 2001 From: saikrishna321 Date: Mon, 5 Feb 2024 16:01:28 +0800 Subject: [PATCH 1/4] #988 change filter capabity from host to filterByHost --- docs/capabilities.md | 2 +- package-lock.json | 11 +++++++++++ server-config.json | 2 +- src/data-service/device-service.ts | 5 ++--- src/device-utils.ts | 5 +++-- src/interfaces/IDeviceFilterOptions.ts | 2 +- test/unit/device-utils.spec.ts | 4 ++-- test/unit/plugin.spec.ts | 6 +++--- 8 files changed, 24 insertions(+), 13 deletions(-) diff --git a/docs/capabilities.md b/docs/capabilities.md index dd8cb40df..f9604925d 100644 --- a/docs/capabilities.md +++ b/docs/capabilities.md @@ -13,4 +13,4 @@ title: Capabilities | appium:platformVersion | This capability is used to filter devices/simulators based on SDK. Only devices/simulators that are an exact match with the platformVerson would be considered for test run. `appium:platformVersion` is optional argument. ex: `'appium:platformVersion': 16.1.1` | | appium:minSDK | This capability is used to filter devices/simulators based on SDK. Devices/Simulators with SDK greater then or equal to minSDK would only be considered for test run. `appium:minSDK` is optional argument. ex: `'appium:minSDK': 15` | | appium:maxSDK | This capability is used to filter devices/simulators based on SDK. Devices/Simulators with SDK less then or equal to maxSDK would only be considered for test run. `appium:maxSDK` is optional argument. ex: `'appium:maxSDK': 15` | -| host | This capability is used to filter devices/simulators based on node IP. This will only consider devices from specific node. `host` is optional argument. ex: `'host': '192.168.0.226',` | \ No newline at end of file +| appium:filterByHost | This capability is used to filter devices/simulators based on node IP. This will only consider devices from specific node. `host` is optional argument. ex: `'host': '192.168.0.226',` | \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 28e89b7f3..0807a19ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13438,6 +13438,12 @@ "utf8-byte-length": "^1.0.1" } }, + "node_modules/appium-xcuitest-driver/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "extraneous": true + }, "node_modules/appium-xcuitest-driver/node_modules/type-fest": { "version": "4.9.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.9.0.tgz", @@ -36095,6 +36101,11 @@ "utf8-byte-length": "^1.0.1" } }, + "tslib": { + "version": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "extraneous": true + }, "type-fest": { "version": "4.9.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.9.0.tgz", diff --git a/server-config.json b/server-config.json index feee69cf5..0df42a67c 100644 --- a/server-config.json +++ b/server-config.json @@ -3,7 +3,7 @@ "port": 31337, "plugin": { "device-farm": { - "platform": "ios", + "platform": "android", "skipChromeDownload": true } } diff --git a/src/data-service/device-service.ts b/src/data-service/device-service.ts index ad640402d..098bd5e6b 100644 --- a/src/data-service/device-service.ts +++ b/src/data-service/device-service.ts @@ -161,8 +161,8 @@ export async function getDevices(filterOptions: IDeviceFilterOptions): Promise { 'appium:app': '/Downloads/VodQA.apk', 'appium:deviceAvailabilityTimeout': 1800, 'appium:deviceRetryInterval': 100, - host: '192.168.0.226', + 'appium:filterByHost': '192.168.0.226', }, firstMatch: [{}], }; @@ -144,7 +144,7 @@ describe('Device Utils', () => { .to.be.an('error') .with.property( 'message', - 'Device is busy or blocked.. Device request: {"platform":"android","udid":"emulator-5555","host":"192.168.0.226"}', + 'Device is busy or blocked.. Device request: {"platform":"android","udid":"emulator-5555","filterByHost":"192.168.0.226"}', ), ); }); diff --git a/test/unit/plugin.spec.ts b/test/unit/plugin.spec.ts index cfe116423..3a4884df8 100644 --- a/test/unit/plugin.spec.ts +++ b/test/unit/plugin.spec.ts @@ -36,7 +36,7 @@ describe('Device filter tests', () => { udid: '21112-1111-1111-111', minSDK: undefined, maxSDK: undefined, - host: undefined, + filterByHost: undefined, busy: false, userBlocked: false, }); @@ -64,7 +64,7 @@ describe('Device filter tests', () => { platform: 'ios', platformVersion: '14.0', name: 'iPhone', - host: undefined, + filterByHost: undefined, deviceType: 'simulator', udid: undefined, minSDK: undefined, @@ -88,7 +88,7 @@ describe('Device filter tests', () => { const filter = getDeviceFiltersFromCapability(firstMatch, pluginArgs); expect(filter).to.deep.equal({ platform: 'ios', - host: undefined, + filterByHost: undefined, platformVersion: undefined, name: 'iPhone', deviceType: 'simulator', From 8d6507ded8af2d93cc5a0fe928a5cc14714bdb99 Mon Sep 17 00:00:00 2001 From: saikrishna321 Date: Mon, 5 Feb 2024 16:58:13 +0800 Subject: [PATCH 2/4] fix prettier --- server-config.json | 3 ++- src/device-utils.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server-config.json b/server-config.json index 0df42a67c..51ddbd313 100644 --- a/server-config.json +++ b/server-config.json @@ -4,7 +4,8 @@ "plugin": { "device-farm": { "platform": "android", - "skipChromeDownload": true + "skipChromeDownload": true, + "hub": "http://10.211.55.3:31337" } } } diff --git a/src/device-utils.ts b/src/device-utils.ts index 4f30cfd6c..5c9b3e6a5 100644 --- a/src/device-utils.ts +++ b/src/device-utils.ts @@ -282,7 +282,7 @@ export function getDeviceFiltersFromCapability( } else if (capability[customCapability.iphoneOnly]) { name = 'iPhone'; } - console.log(capability) + console.log(capability); let caps = { platform, platformVersion: capability['appium:platformVersion'] From b1996376bb9bf7ea20c9bda1cda0dbdafe0d7dfe Mon Sep 17 00:00:00 2001 From: saikrishna321 Date: Mon, 5 Feb 2024 16:58:16 +0800 Subject: [PATCH 3/4] 8.4.7-rc.7 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0807a19ed..60223b8e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "appium-device-farm", - "version": "8.4.7-rc.6", + "version": "8.4.7-rc.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "appium-device-farm", - "version": "8.4.7-rc.6", + "version": "8.4.7-rc.7", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 8311b79a7..4134fd038 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appium-device-farm", - "version": "8.4.7-rc.6", + "version": "8.4.7-rc.7", "description": "An appium 2.0 plugin that manages and create driver session on available devices", "main": "./lib/src/index.js", "scripts": { From eafd5847684567a4db796a369a86fc9a4c2833c1 Mon Sep 17 00:00:00 2001 From: saikrishna321 Date: Mon, 5 Feb 2024 17:55:09 +0800 Subject: [PATCH 4/4] clean console.log --- server-config.json | 3 +-- src/device-utils.ts | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/server-config.json b/server-config.json index 51ddbd313..0df42a67c 100644 --- a/server-config.json +++ b/server-config.json @@ -4,8 +4,7 @@ "plugin": { "device-farm": { "platform": "android", - "skipChromeDownload": true, - "hub": "http://10.211.55.3:31337" + "skipChromeDownload": true } } } diff --git a/src/device-utils.ts b/src/device-utils.ts index 5c9b3e6a5..c563ca8e4 100644 --- a/src/device-utils.ts +++ b/src/device-utils.ts @@ -282,7 +282,6 @@ export function getDeviceFiltersFromCapability( } else if (capability[customCapability.iphoneOnly]) { name = 'iPhone'; } - console.log(capability); let caps = { platform, platformVersion: capability['appium:platformVersion']