2

For instance, we have scenarios that require TouchID to be enabled and we have scenarios that require TouchID to be disabled. Appium itself doesn't expose such capabilities, so I'm wondering if it is possible to define custom capabilities for a device.

If it's not possible to do with Appium itself, I'm happy to put Selenium Grid in the middle, in case that would provide such functionality.

We are testing both locally and in the cloud, using Perfecto, so as a side question I would like to know if Perfecto or any other cloud service provides this capability.

So, if I define the following capability when launching my Appium session:

capabilities.touchID = 'enabled';

I would get a device where TouchID has been enabled.

Also, TouchID is just an example, we have a number of things we need custom capabilities for.

Erik B
  • 35,941
  • 21
  • 106
  • 122

1 Answers1

0

It is possible to define your own capability while creating new session:

caps.android = {
  platformName: 'Android',
  ...
  mycap: 12345
}

Appium server will throw message that it received unrecognised capability:

[BaseDriver] The following capabilities were provided, but are not recognized 
by appium: mycap.
[BaseDriver] Session created with session id: f672074d-ed33-49c1-a243-b8d10572608e

Later in your tests you can get capability value, e.g. in wd.js:

const caps = await driver.sessionCapabilities()
// caps.mycap will return 12345

and based on value set the logic you need, e.g. send specific adb command

Several notes:

  • Appium server has no idea about your capabilities and there is no way to configure its logic based on custom capability. More likely you need to define logic on client side where your tests placed
  • Capabilities stored for session. If you want to change -> start new session

Most of the mobile clouds have there own custom capabilities as well, so for your side question:

dmle
  • 3,056
  • 1
  • 10
  • 20
  • Do you know if it is possible to configure selenium grid to select a device based on custom capabilities? – Erik B Jan 14 '18 at 00:15
  • I doubt if its possible out of box, but you can implement your own version of gird service with that functionality, shouldn't be too much work. – dmle Jan 14 '18 at 06:52
  • We already have a solution for Touch ID, but it only works on certain devices. So if a scenario requires Touch ID, that scenario needs to run on a device that supports Touch ID, i.e. we don't want to get an iPhone 5 or older. Today we have to specify the UDID of a device that we know is compatible, but a more flexible solution would be preferable, hence my question. – Erik B Jan 16 '18 at 14:44