Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ curl -u "YOUR_LAMBDATEST_USERNAME":"YOUR_LAMBDATEST_ACCESS_KEY" \

> **Note:**
>
> - If you do not have any **.apk** or **.ipa** file, you can run your sample tests on LambdaTest by using our sample [Android app](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_android.apk) or sample [iOS app](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_ios.ipa).
> - If you do not have any **.apk** or **.ipa** file, you can run your sample tests on LambdaTest by using our sample [Android app](https://prod-mobile-qa-artefacts.lambdatest.com/Espreeso/Proverbial.apk) or sample [iOS app](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_ios.ipa).
> - Response of above cURL will be a **JSON** object containing the `App URL` of the format - <lt://APP123456789123456789> and will be used in the next step.

### **Step 2: Write Your Automation Script**
Expand Down
24 changes: 11 additions & 13 deletions src/main/java/iOSApp.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileBy;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidElement;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.net.URL;

Expand Down Expand Up @@ -44,41 +41,42 @@ public void iOSApp1(String device, String version, String platform) {

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(MobileBy.AccessibilityId("color"))).click();
Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("color"))).click();
Thread.sleep(1000);

//Changes the text to "Proverbial"
Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("Text"))).click();
Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("Text"))).click();
Thread.sleep(1000);

//Toast will be visible
Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("toast"))).click();
Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("toast"))).click();
Thread.sleep(1000);

//Notification will be visible
Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("notification"))).click();
Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("notification"))).click();
Thread.sleep(4000);

//Opens the geolocation page
Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("geoLocation"))).click();
Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("geoLocation"))).click();
Thread.sleep(4000);

//Takes back
driver.navigate().back();

//Takes to speedtest page
Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("speedTest"))).click();
Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("speedTest"))).click();
Thread.sleep(4000);
driver.navigate().back();

//Opens the browser
Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("Browser"))).click();
Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("Browser"))).click();
Thread.sleep(1000);
MobileElement url = (MobileElement) driver.findElementByAccessibilityId("url");
MobileElement url = (MobileElement) driver.findElementByName("url");
url.click();
url.sendKeys("https://www.lambdatest.com");
Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("find"))).click();
Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("find"))).click();
Thread.sleep(1000);
driver.quit();
} catch (Exception e) {
Expand Down