Skip to content

Commit fb37b81

Browse files
authored
Added touchId to driver (appium#143)
* Added touchId to driver Wrote a test for it (still need help running Python tests though). Updated capabilities to use iOS 10.1
1 parent 47cc892 commit fb37b81

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

appium/webdriver/mobilecommand.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class MobileCommand(object):
4949
END_TEST_COVERAGE = 'endTestCoverage'
5050
LOCK = 'lock'
5151
SHAKE = 'shake'
52+
TOUCH_ID = 'touchId'
5253
RESET = 'reset'
5354
HIDE_KEYBOARD = 'hideKeyboard'
5455
REPLACE_KEYS = 'replaceKeys'

appium/webdriver/webdriver.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,15 @@ def shake(self):
606606
self.execute(Command.SHAKE)
607607
return self
608608

609+
def touch_id(self, match):
610+
"""Do a fingerprint scan
611+
"""
612+
data = {
613+
'match': match
614+
}
615+
self.execute(Command.TOUCH_ID, data)
616+
return self
617+
609618
def open_notifications(self):
610619
"""Open notification shade in Android (API Level 18 and above)
611620
"""
@@ -784,6 +793,8 @@ def _addCommands(self):
784793
('POST', '/session/$sessionId/appium/device/lock')
785794
self.command_executor._commands[Command.SHAKE] = \
786795
('POST', '/session/$sessionId/appium/device/shake')
796+
self.command_executor._commands[Command.TOUCH_ID] = \
797+
('POST', '/session/$sessionId/appium/simulator/touch_id')
787798
self.command_executor._commands[Command.RESET] = \
788799
('POST', '/session/$sessionId/appium/app/reset')
789800
self.command_executor._commands[Command.HIDE_KEYBOARD] = \

test/functional/ios/appium_tests.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def setUp(self):
2828

2929
def tearDown(self):
3030
self.driver.quit()
31-
3231
def test_lock(self):
3332
el = self.driver.find_element_by_id('ButtonsExplain')
3433
self.assertIsNotNone(el)
@@ -44,6 +43,12 @@ def test_shake(self):
4443
# what can we assert about this?
4544
self.driver.shake()
4645

46+
47+
def test_touch_id(self):
48+
# nothing to assert, just verify that it doesn't blow up
49+
self.driver.touch_id(True)
50+
self.driver.touch_id(False)
51+
4752
def test_hide_keyboard(self):
4853
el = self.driver.find_element_by_name('TextFields, Uses of UITextField')
4954
el.click()

test/functional/ios/desired_capabilities.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
1514
import os
1615

1716
# Returns abs path relative to this file and not cwd
@@ -22,9 +21,11 @@
2221

2322
def get_desired_capabilities(app):
2423
desired_caps = {
25-
'deviceName': 'iPhone Simulator',
24+
'deviceName': 'iPhone 5s',
2625
'platformName': 'iOS',
26+
'platformVersion': '10.1',
2727
'app': PATH('../../apps/' + app),
28+
'automationName': 'XCUITest'
2829
}
2930

3031
return desired_caps

0 commit comments

Comments
 (0)