Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
saikrishna321 committed Feb 5, 2024
2 parents 40007e6 + 41e225a commit e897e29
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,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',` |
| 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',` |
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-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/main.js",
"scripts": {
Expand Down
5 changes: 2 additions & 3 deletions src/data-service/device-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export async function getDevices(filterOptions: IDeviceFilterOptions): Promise<I
case 'session_id':
filter.session_id = filterOptions.session_id;
break;
case 'host':
filter.host = { $contains: filterOptions.host };
case 'filterByHost':
filter.host = { $contains: filterOptions.filterByHost };
break;
case 'minSDK':
if (semver.coerce(filterOptions.minSDK)) {
Expand Down Expand Up @@ -204,7 +204,6 @@ export async function getDevices(filterOptions: IDeviceFilterOptions): Promise<I
// if (filterOptions.deviceType === 'simulator') {
// filter.state = 'Booted'; // Needs a fix
// }

const matchingDevices = results.find(filter).data();
// use the following debugging tools to debug this function
/*
Expand Down
4 changes: 2 additions & 2 deletions src/device-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const customCapability = {
udids: 'appium:udids',
minSDK: 'appium:minSDK',
maxSDK: 'appium:maxSDK',
filterByHost: 'appium:filterByHost',
};

let timer: any;
Expand Down Expand Up @@ -281,7 +282,6 @@ export function getDeviceFiltersFromCapability(
} else if (capability[customCapability.iphoneOnly]) {
name = 'iPhone';
}

let caps = {
platform,
platformVersion: capability['appium:platformVersion']
Expand All @@ -292,7 +292,7 @@ export function getDeviceFiltersFromCapability(
udid: udids?.length ? udids : capability['appium:udid'],
busy: false,
userBlocked: false,
host: capability['host'],
filterByHost: capability[customCapability.filterByHost],
minSDK: capability[customCapability.minSDK] ? capability[customCapability.minSDK] : undefined,
maxSDK: capability[customCapability.maxSDK] ? capability[customCapability.maxSDK] : undefined,
};
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IDeviceFilterOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export interface IDeviceFilterOptions {
minSDK?: string;
maxSDK?: string;
session_id?: string;
host?: string;
filterByHost?: string;
}
4 changes: 2 additions & 2 deletions test/unit/device-utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('Device Utils', () => {
'appium:app': '/Downloads/VodQA.apk',
'appium:deviceAvailabilityTimeout': 1800,
'appium:deviceRetryInterval': 100,
host: '192.168.0.226',
'appium:filterByHost': '192.168.0.226',
},
firstMatch: [{}],
};
Expand Down Expand Up @@ -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"}',
),
);
});
Expand Down
6 changes: 3 additions & 3 deletions test/unit/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down Expand Up @@ -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,
Expand All @@ -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',
Expand Down

0 comments on commit e897e29

Please sign in to comment.