forked from ios-driver/ios-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SendKeys() does not only send keys but also click 'Done' ios-driver#251
- Loading branch information
Alex Zaytsev
committed
Nov 12, 2014
1 parent
ad6762a
commit 7fa482f
Showing
4 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...-tests/src/test/java/org/uiautomation/ios/selenium/ShowKeyboardAfterClickAndTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.uiautomation.ios.selenium; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
import org.testng.annotations.Test; | ||
import org.uiautomation.ios.IOSCapabilities; | ||
|
||
|
||
import static org.testng.Assert.assertEquals; | ||
import static org.testng.Assert.assertTrue; | ||
|
||
|
||
public class ShowKeyboardAfterClickAndTypeTest extends BaseSeleniumTest { | ||
|
||
|
||
@Test() | ||
public void testShowKeyBoardAfterClick() throws Exception { | ||
|
||
IOSCapabilities caps = IOSCapabilities.iphone("Safari"); | ||
caps.setCapability(IOSCapabilities.SHOW_KEYBOARD_AFTER_CLICK_AND_TYPE, true); | ||
|
||
startDriver(caps); | ||
driver.get(pages.formPage); | ||
|
||
|
||
String stringyNumber = ""; | ||
String numberNumber = "18003569377"; | ||
String validationNumber = null; | ||
// iphone has number trackpad, ipad is has full keyboard still | ||
if (driver.getCapabilities().getCapability(IOSCapabilities.DEVICE).equals("iphone")) { | ||
validationNumber = numberNumber; | ||
} else { | ||
validationNumber = stringyNumber; | ||
} | ||
|
||
WebElement input = driver.findElement(By.id("telephone")); | ||
input.sendKeys(numberNumber); | ||
Thread.sleep(2000); | ||
|
||
assertEquals(input.getAttribute("value"), validationNumber); | ||
assertTrue(Boolean.TRUE.equals(driver.getRequestedCapabilities().getCapability(IOSCapabilities.SHOW_KEYBOARD_AFTER_CLICK_AND_TYPE))); | ||
|
||
stopDriver(); | ||
} | ||
|
||
@Test() | ||
public void testHideKeyBoardAfterClick() throws Exception { | ||
|
||
driver.get(pages.formPage); | ||
|
||
|
||
String stringyNumber = ""; | ||
String numberNumber = "18003569377"; | ||
String validationNumber = null; | ||
// iphone has number trackpad, ipad is has full keyboard still | ||
if (driver.getCapabilities().getCapability(IOSCapabilities.DEVICE).equals("iphone")) { | ||
validationNumber = numberNumber; | ||
} else { | ||
validationNumber = stringyNumber; | ||
} | ||
|
||
WebElement input = driver.findElement(By.id("telephone")); | ||
input.sendKeys(numberNumber); | ||
Thread.sleep(2000); | ||
|
||
assertEquals(input.getAttribute("value"), validationNumber); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters