Skip to content

Commit

Permalink
Merge pull request #14 from testsigmahq/feat/selenium-appium-upgrade-…
Browse files Browse the repository at this point in the history
…dev-cloud-2

feat: Archtype changes for Selenium/Appium upgrade
  • Loading branch information
Ganesh-Testsigma authored Dec 6, 2023
2 parents 01b21d8 + 0740c84 commit 7589b9d
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 34 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ repositories {

dependencies {
implementation 'org.projectlombok:lombok:1.18.20'
implementation 'org.seleniumhq.selenium:selenium-api:3.141.59'
implementation 'io.appium:java-client:7.0.0'
implementation 'org.seleniumhq.selenium:selenium-api:4.14.1'
implementation 'io.appium:java-client:9.0.0'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.apache.maven.plugins:maven-toolchains-plugin:3.0.0'
implementation 'org.testng:testng:7.4.0'
implementation 'org.seleniumhq.selenium:selenium-java:3.141.59'
implementation 'org.seleniumhq.selenium:selenium-java:4.14.1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.0'
annotationProcessor 'org.projectlombok:lombok:1.18.20'
}

group = 'com.testsigma'
version = '1.2.3_cloud'
version = '1.2.4_cloud'
description = 'testsigma-addon-archetype'
java.sourceCompatibility = JavaVersion.VERSION_11

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ RELEASE_SIGNING_ENABLED=true

GROUP=com.testsigma
POM_ARTIFACT_ID=testsigma-addon-archetype
VERSION_NAME=1.2.3_cloud
VERSION_NAME=1.2.4_cloud

POM_NAME=Testsigma Addon Archetype
POM_DESCRIPTION=Testsigma Addon Archetype
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/archetype-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<testsigma.sdk.version>1.2.3_cloud</testsigma.sdk.version>
<testsigma.sdk.version>1.2.4_cloud</testsigma.sdk.version>
<junit.jupiter.version>5.8.0-M1</junit.jupiter.version>
<testsigma.addon.maven.plugin>1.0.0</testsigma.addon.maven.plugin>
<maven.source.plugin.version>3.2.1</maven.source.plugin.version>
Expand Down Expand Up @@ -48,13 +48,13 @@
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
<version>4.14.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
<version>9.0.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
package ${package}.android.test;


import ${package}.android.SwipeOnScreen;

import com.google.common.collect.ImmutableMap;
import com.testsigma.sdk.TestData;
import com.testsigma.sdk.runners.ActionRunner;
import io.appium.java_client.android.AndroidDriver;
import ${package}.android.SwipeOnScreen;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.net.URL;
import java.util.concurrent.TimeUnit;
import java.time.Duration;;

public class TestAndroidAction {
private ActionRunner runner;
private AndroidDriver driver;

@BeforeClass
public void setup() throws Exception {
//Make sure to start Appium server
// Make sure to start Appium server
DesiredCapabilities caps = new DesiredCapabilities();

caps.setCapability("app", "<APP_PATH>");
caps.setCapability("deviceName", "<DEVICE_NAME>");
caps.setCapability("udid", "<DEVICE_UDID>");
caps.setCapability("platformName", "android");
driver = new AndroidDriver<>(new URL("http://localhost:4723/wd/hub"), caps);
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
driver.launchApp();
driver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"), caps);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
driver.executeScript("mobile: activateApp", ImmutableMap.of("appId", driver.getCapabilities().getCapability("appium:appPackage")));
runner = new ActionRunner(driver); //Initialie Action runner

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
package ${package}.ios.test;


import com.testsigma.sdk.TestData;
import com.google.common.collect.ImmutableMap;
import ${package}.ios.EnterDataIfVisible;

import com.testsigma.sdk.Element;
import com.testsigma.sdk.TestData;
import com.testsigma.sdk.runners.ActionRunner;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import ${package}.ios.EnterDataIfVisible;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.net.URL;
import java.util.concurrent.TimeUnit;
import java.time.Duration;
import java.util.HashMap;
import java.util.Map;


public class TestIOSAction {
Expand All @@ -24,20 +26,24 @@ public class TestIOSAction {

@BeforeClass
public void setup() throws Exception {
//Make sure to start Appium server
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "14");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 11 Max");
// Make sure to start Appium server
DesiredCapabilities capabilities = new DesiredCapabilities();

capabilities.setCapability("platformName", "iOS");

capabilities.setCapability("app", "<IPA FILE PATH>");
Map<String, Object> appiumOptions = new HashMap<>();
appiumOptions.put("platformVersion", "14");
appiumOptions.put("automationName", "XCUITest");
appiumOptions.put("deviceName", "iPhone 11 Max");
appiumOptions.put("app", "<IPA FILE PATH>");
capabilities.setCapability("appium:options", appiumOptions);

IOSDriver<WebElement> driver = new IOSDriver<>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.launchApp();
runner = new ActionRunner(driver); //Initialie Action runner
IOSDriver driver = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(60));
driver.executeScript("mobile: activateApp", ImmutableMap.of("bundleId",
driver.getCapabilities().getCapability("appium:bundleId")));

runner = new ActionRunner(driver); //Initialie Action runner
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package ${package}.web.test;

import com.testsigma.sdk.TestData;
import ${package}.web.MyFirstWebAction;

import com.testsigma.sdk.Element;
import com.testsigma.sdk.TestData;
import com.testsigma.sdk.runners.ActionRunner;
import ${package}.web.MyFirstWebAction;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.util.concurrent.TimeUnit;
import java.time.Duration;

public class TestWebAction {
private ActionRunner runner;
Expand All @@ -21,7 +22,7 @@ public void setup() throws Exception {
System.setProperty("webdriver.chrome.driver", "<Chrome Driver Path>");
driver = new ChromeDriver();
driver.manage().deleteAllCookies();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(20));
runner = new ActionRunner(driver); //Initialie Action runner
driver.get("https://www.orangehrm.com/orangehrm-30-day-trial/");
}
Expand Down

0 comments on commit 7589b9d

Please sign in to comment.