From e9ea53aef620df52799beac8b714ff5e2171288d Mon Sep 17 00:00:00 2001 From: JiGsaw_xs <79110820+8ll@users.noreply.github.com> Date: Mon, 30 Jan 2023 07:07:16 +0300 Subject: [PATCH] Update BrowserStackSample.java --- .../src/test/java/ios/BrowserStackSample.java | 36 ++++--------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/java_7/src/test/java/ios/BrowserStackSample.java b/java_7/src/test/java/ios/BrowserStackSample.java index ce5ab08..1497bc3 100644 --- a/java_7/src/test/java/ios/BrowserStackSample.java +++ b/java_7/src/test/java/ios/BrowserStackSample.java @@ -1,32 +1,27 @@ package ios; - import java.net.URL; import java.util.List; import java.net.MalformedURLException; - import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedConditions; - import io.appium.java_client.MobileBy; import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.ios.IOSElement; - public class BrowserStackSample { - public static void main(String[] args) throws MalformedURLException, InterruptedException { DesiredCapabilities caps = new DesiredCapabilities(); // Set your access credentials - caps.setCapability("browserstack.user", "YOUR_USERNAME"); - caps.setCapability("browserstack.key", "YOUR_ACCESS_KEY"); + caps.setCapability("browserstack.user", "abdullazizxs_M0W5GX"); + caps.setCapability("browserstack.key", "zS2Tit6YTbuhoCGgbB21"); // Set URL of the application under test - caps.setCapability("app", "bs://"); + caps.setCapability("app", "bs://ff266c82636fc47ee3a615747bc9a7b63857a03d"); // Specify device and os_version for testing - caps.setCapability("device", "iPhone 12"); - caps.setCapability("os_version", "13"); + caps.setCapability("device", "iPhone XS"); + caps.setCapability("os_version", "12"); // Set other BrowserStack capabilities caps.setCapability("project", "First Java Project"); @@ -38,27 +33,10 @@ public static void main(String[] args) throws MalformedURLException, Interrupted // and desired capabilities defined above IOSDriver driver = new IOSDriver( new URL("http://hub-cloud.browserstack.com/wd/hub"), caps); + + // Write your test case statements here - - // Test case for the BrowserStack sample iOS app. - // If you have uploaded your app, update the test case here. - IOSElement textButton = (IOSElement) new WebDriverWait(driver, 30).until( - ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Button"))); - textButton.click(); - IOSElement textInput = (IOSElement) new WebDriverWait(driver, 30).until( - ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Input"))); - textInput.sendKeys("hello@browserstack.com"); - Thread.sleep(5000); - IOSElement textOutput = (IOSElement) new WebDriverWait(driver, 30).until( - ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Output"))); - if(textOutput != null && textOutput.getText().equals("hello@browserstack.com")) - assert(true); - else - assert(false); - // Invoke driver.quit() after the test is done to indicate that the test is completed. driver.quit(); - } - }