From 560e251fd7afb072ae3e51e494fea2277d77737e Mon Sep 17 00:00:00 2001 From: prklm10 Date: Fri, 16 Jun 2023 12:52:09 +0530 Subject: [PATCH] updating example project to remove static declaration --- .../java/io/percy/examplepercyappiumjava/Android.java | 8 +++----- src/main/java/io/percy/examplepercyappiumjava/Ios.java | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/io/percy/examplepercyappiumjava/Android.java b/src/main/java/io/percy/examplepercyappiumjava/Android.java index e230aac..4df3191 100644 --- a/src/main/java/io/percy/examplepercyappiumjava/Android.java +++ b/src/main/java/io/percy/examplepercyappiumjava/Android.java @@ -16,7 +16,6 @@ import io.percy.appium.AppPercy; public class Android { - private static AppPercy percy; // Hub Url to connect to Automation session private static String HUB_URL = "https://hub.browserstack.com/wd/hub"; @@ -42,7 +41,7 @@ public static void main(String[] args) throws MalformedURLException { AndroidDriver driver = new AndroidDriver(new URL(HUB_URL), capabilities); // Initialize AppPercy - percy = new AppPercy(driver); + AppPercy percy = new AppPercy(driver); try { TimeUnit.SECONDS.sleep(5); @@ -52,13 +51,12 @@ public static void main(String[] args) throws MalformedURLException { // Take First Screenshot percy.screenshot("First Screenshot"); - AndroidElement searchElement = (AndroidElement) new WebDriverWait(driver, 30).until( - ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Search Wikipedia"))); + ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Search Wikipedia"))); searchElement.click(); AndroidElement textInput = (AndroidElement) new WebDriverWait(driver, 30).until( - ExpectedConditions.elementToBeClickable(MobileBy.id("org.wikipedia.alpha:id/search_src_text"))); + ExpectedConditions.elementToBeClickable(MobileBy.id("org.wikipedia.alpha:id/search_src_text"))); textInput.sendKeys("Browserstack\n"); try { diff --git a/src/main/java/io/percy/examplepercyappiumjava/Ios.java b/src/main/java/io/percy/examplepercyappiumjava/Ios.java index e1e2efc..c0f48ce 100644 --- a/src/main/java/io/percy/examplepercyappiumjava/Ios.java +++ b/src/main/java/io/percy/examplepercyappiumjava/Ios.java @@ -14,7 +14,6 @@ import io.percy.appium.AppPercy; public class Ios { - private static AppPercy percy; // Hub Url to connect to Automation session private static String HUB_URL = "https://hub.browserstack.com/wd/hub"; @@ -40,19 +39,19 @@ public static void main(String[] args) throws MalformedURLException { IOSDriver driver = new IOSDriver(new URL(HUB_URL), capabilities); // Initialize AppPercy - percy = new AppPercy(driver); + AppPercy percy = new AppPercy(driver); // Take First Screenshot percy.screenshot("First Screenshot"); // Find element and click to change screen IOSElement textButton = (IOSElement) new WebDriverWait(driver, 30).until( - ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Button"))); + ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Button"))); textButton.click(); // Find textInput and send some data to it IOSElement textInput = (IOSElement) new WebDriverWait(driver, 30).until( - ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Input"))); + ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Input"))); textInput.sendKeys("hello@percy.io\n"); // Take Second Screenshot Post screen update