Skip to content

Commit

Permalink
Merge pull request #38 from appium/touch-id
Browse files Browse the repository at this point in the history
Add touchId command
  • Loading branch information
jlipps authored Nov 9, 2016
2 parents cf51522 + 5984924 commit 06c68c2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
10 changes: 10 additions & 0 deletions PHPUnit/Extensions/AppiumTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,16 @@ public function shake()
$session->getDriver()->curl('POST', $url, null);
}

public function touchId($match)
{
$session = $this->prepareSession();
$data = array(
'match' => $match
);
$url = $this->getSessionUrl()->descend('appium')->descend('simulator')->descend('touch_id');
$session->getDriver()->curl('POST', $url, $data);
}

public function getDeviceTime()
{
$session = $this->prepareSession();
Expand Down
21 changes: 14 additions & 7 deletions test/functional/ios/appium_tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class AppiumTests extends PHPUnit_Extensions_AppiumTestCase
{
public function testSetImmediateValue()
{
$this->byAccessibilityId('TextFields, Uses of UITextField')->click();
$el = $this->byClassName('UIATextField');
$this->byAccessibilityId('Uses of UITextField')->click();
$el = $this->byClassName('XCUIElementTypeTextField');
$el->click();

$el->setImmediateValue('Testing');
Expand All @@ -38,9 +38,15 @@ public function testShake()
$this->shake();
}

public function testTouchId()
{
$this->touchId(true);
$this->touchId(false);
}

public function testHideKeyboard()
{
$this->byName('TextFields, Uses of UITextField')->click();
$this->byName('Uses of UITextField')->click();

# get focus on text field, so keyboard comes up
$el = $this->byClassName('UIATextField');
Expand Down Expand Up @@ -77,13 +83,13 @@ public function testHideKeyboardPressKeyStrategy()

public function testHideKeyboardNoKeyname()
{
$this->byName('TextFields, Uses of UITextField')->click();
$this->byName('Uses of UITextField')->click();

# get focus on text field, so keyboard comes up
$el = $this->byClassName('UIATextField');
$el = $this->byClassName('XCUIElementTypeTextField');
$el->value('Testing');

$keyboard = $this->byClassName('UIAKeyboard');
$keyboard = $this->byClassName('XCUIElementTypeKeyboard');
$this->assertTrue($keyboard->displayed());

$this->hideKeyboard();
Expand All @@ -92,6 +98,7 @@ public function testHideKeyboardNoKeyname()
$this->assertFalse($keyboard->displayed());
}


public function testGetDeviceTime()
{
$this->getDeviceTime();
Expand All @@ -105,7 +112,7 @@ public function testGetDeviceTime()
'desiredCapabilities' => array(
'app' => APP_PATH,
'platformName' => 'iOS',
'platformVersion' => '7.1',
'platformVersion' => '10.1',
'deviceName' => 'iPhone Simulator'
)
)
Expand Down

0 comments on commit 06c68c2

Please sign in to comment.