Skip to content

Commit 9543190

Browse files
authored
Merge pull request #12 from browserstack/new_sample_app
Changes for new sample app
2 parents 5979031 + 1924c16 commit 9543190

File tree

2 files changed

+19
-25
lines changed

2 files changed

+19
-25
lines changed

ios/BrowserStackIOS.java

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,30 @@ public class BrowserStackIOS {
1616
public static String userName = "BROWSERSTACK_ACCESS_KEY";
1717

1818
public static void main(String args[]) throws MalformedURLException, InterruptedException {
19-
DesiredCapabilities capabilities = new DesiredCapabilities();
19+
DesiredCapabilities caps = new DesiredCapabilities();
2020

21-
capabilities.setCapability("device", "iPhone 7");
22-
capabilities.setCapability("app", "bs://<hashed app-id>");
21+
caps.setCapability("device", "iPhone 7 Plus");
22+
caps.setCapability("app", "bs://<hashed app-id>");
2323

24-
IOSDriver<IOSElement> driver = new IOSDriver<IOSElement>(new URL("http://"+userName+":"+accessKey+"@hub.browserstack.com/wd/hub"), capabilities);
24+
IOSDriver<IOSElement> driver = new IOSDriver<IOSElement>(new URL("http://"+userName+":"+accessKey+"@hub-cloud.browserstack.com/wd/hub"), caps);
2525

26-
IOSElement loginButton = (IOSElement) new WebDriverWait(driver, 30).until(
27-
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Log In")));
28-
loginButton.click();
29-
IOSElement emailTextField = (IOSElement) new WebDriverWait(driver, 30).until(
30-
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Email address")));
31-
emailTextField.sendKeys("[email protected]");
26+
IOSElement textButton = (IOSElement) new WebDriverWait(driver, 30).until(
27+
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Button")));
28+
textButton.click();
29+
IOSElement textInput = (IOSElement) new WebDriverWait(driver, 30).until(
30+
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Input")));
31+
textInput.sendKeys("[email protected]");
3232

33-
driver.findElementByAccessibilityId("Next").click();
3433
Thread.sleep(5000);
3534

36-
List<IOSElement> textElements = driver.findElementsByXPath("//XCUIElementTypeStaticText");
37-
assert(textElements.size() > 0);
38-
String matchedString = "";
39-
for(IOSElement textElement : textElements) {
40-
String textContent = textElement.getText();
41-
if(textContent != null && textContent.contains("not registered")) {
42-
matchedString = textContent;
43-
}
44-
}
45-
46-
System.out.println(matchedString);
47-
assert(matchedString.contains("not registered on WordPress.com"));
48-
35+
IOSElement textOutput = (IOSElement) new WebDriverWait(driver, 30).until(
36+
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Output")));
37+
38+
if(textOutput != null && textOutput.getText().equals("[email protected]"))
39+
assert(true);
40+
else
41+
assert(false);
42+
4943
driver.quit();
5044
}
5145
}

ios/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
curl -u "username:accesskey" -X POST "https://api.browserstack.com/app-automate/upload" -F "file=@/path/to/app/file/Application-debug.ipa"
77
```
88

9-
- If you do not have an .ipa file and looking to simply try App Automate, [you can download our sample app and upload](https://www.browserstack.com/app-automate/sample-apps/ios/WordPressSample.ipa)
9+
- If you do not have an .ipa file and looking to simply try App Automate, [you can download our sample app and upload](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa)
1010
to the BrowserStack servers using the above API.
1111
- Update the desired capability "app" with the App URL returned from the above API call
1212

0 commit comments

Comments
 (0)