From 5bf34b0d81e786f09e14e8165e359e074f655dde Mon Sep 17 00:00:00 2001 From: UchihaMadaraaa Date: Tue, 3 Jun 2025 18:13:13 +0530 Subject: [PATCH] TTN-23587 updated java version and and locator starategy in both android and ios --- .gitignore | 1 + .idea/misc.xml | 2 +- pom.xml | 2 +- src/test/java/com/lambdatest/android.java | 16 ++++---- src/test/java/com/lambdatest/ios.java | 49 +++++++++++++++++------ 5 files changed, 48 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 8fbdb55..5a6f45c 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ hs_err_pid* .DS_Store /.idea/ /target/ +.idea/ diff --git a/.idea/misc.xml b/.idea/misc.xml index e24323e..868906c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,5 +8,5 @@ - + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 95ddfb1..9a3e99c 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ maven-compiler-plugin - 3.0 + 3.11.0 1.8 1.8 diff --git a/src/test/java/com/lambdatest/android.java b/src/test/java/com/lambdatest/android.java index 10f6065..7361fdf 100644 --- a/src/test/java/com/lambdatest/android.java +++ b/src/test/java/com/lambdatest/android.java @@ -46,17 +46,17 @@ public void setUp() throws Exception { public void testSimple() throws Exception { try { WebDriverWait wait = new WebDriverWait(driver, 30); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("color"))).click(); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("geoLocation"))).click(); + driver.findElement(MobileBy.id("color")).click(); + driver.findElement(MobileBy.id("geoLocation")).click(); Thread.sleep(5000); driver.navigate().back(); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("Text"))).click(); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("notification"))).click(); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("toast"))).click(); - wait.until(ExpectedConditions.elementToBeClickable(By.id("webview"))).click(); + driver.findElement(MobileBy.id("Text")).click(); + driver.findElement(MobileBy.id("notification")).click(); + driver.findElement(MobileBy.id("toast")).click(); + driver.findElement(By.id("webview")).click(); Thread.sleep(10000); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("url"))).sendKeys("https://www.lambdatest.com/"); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("find"))).click(); + driver.findElement(MobileBy.id("url")).sendKeys("https://www.lambdatest.com/"); + driver.findElement(MobileBy.id("find")).click(); Thread.sleep(5000); driver.navigate().back(); status = "passed"; diff --git a/src/test/java/com/lambdatest/ios.java b/src/test/java/com/lambdatest/ios.java index c96d810..ee420a4 100644 --- a/src/test/java/com/lambdatest/ios.java +++ b/src/test/java/com/lambdatest/ios.java @@ -4,6 +4,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.By; @@ -44,21 +45,45 @@ public void setUp() throws Exception { @Test public void testSimple() throws Exception { try { - WebDriverWait wait = new WebDriverWait(driver, 30); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("color"))).click(); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("geoLocation"))).click(); - Thread.sleep(5000); + + WebDriverWait Wait = new WebDriverWait(driver, 30); + //Changing Locator type from Accessibility ID to Name as in the Proverbial app there is no Accessibility ID Attribute for Any Element + //Changes the color of the text + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("color"))).click(); + Thread.sleep(1000); + + //Changes the text to "Proverbial" + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("Text"))).click(); + Thread.sleep(1000); + + //Toast will be visible + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("toast"))).click(); + Thread.sleep(1000); + + //Notification will be visible + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("notification"))).click(); + Thread.sleep(4000); + + //Opens the geolocation page + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("geoLocation"))).click(); + Thread.sleep(4000); + + //Takes back driver.navigate().back(); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("Text"))).click(); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("notification"))).click(); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("toast"))).click(); - wait.until(ExpectedConditions.elementToBeClickable(By.id("Browser"))).click(); - Thread.sleep(10000); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("url"))).sendKeys("https://www.lambdatest.com/"); - wait.until(ExpectedConditions.elementToBeClickable(MobileBy.id("find"))).click(); - Thread.sleep(5000); + + //Takes to speedtest page + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("speedTest"))).click(); + Thread.sleep(4000); driver.navigate().back(); + //Opens the browser + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("Browser"))).click(); + Thread.sleep(1000); + WebElement url = driver.findElement(By.name("url")); + url.click(); + url.sendKeys("https://www.lambdatest.com"); + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("find"))).click(); + Thread.sleep(1000); status = "passed"; } catch (Exception e) { System.out.println(e.getMessage());