parent
3dd0ac7d6c
commit
c135e9a571
11
pom.xml
11
pom.xml
|
@ -118,12 +118,13 @@
|
|||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.3.RELEASE</version>
|
||||
<version>2.2.3.RELEASE</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>GBK</project.build.sourceEncoding>
|
||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
|
@ -243,19 +244,21 @@
|
|||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-java</artifactId>
|
||||
<!--<version>3.141.59</version>$NO-MVN-MAN-VER$-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-remote-driver</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- 暂不需求,怀疑是以前testlink API需要的 -->
|
||||
<!-- <dependency>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</dependency>
|
||||
</dependency> -->
|
||||
<dependency>
|
||||
<groupId>io.appium</groupId>
|
||||
<artifactId>java-client</artifactId>
|
||||
<version>6.0.0-BETA2</version>
|
||||
<version>7.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#===============================系统配置=====================================
|
||||
client.verison=3.1.1
|
||||
client.verison=3.2
|
||||
server.web.ip=localhost
|
||||
server.web.port=80
|
||||
#================================ 邮件=======================================
|
||||
|
|
|
@ -58,8 +58,8 @@ public class AppiumInitialization {
|
|||
capabilities.setCapability("noSign", Boolean.valueOf(properties.getProperty("noSign")));
|
||||
// 等待超时没接收到命令关闭appium
|
||||
capabilities.setCapability("newCommandTimeout", properties.getProperty("newCommandTimeout"));
|
||||
appium = new AndroidDriver<AndroidElement>(
|
||||
new URL("http://" + properties.getProperty("appiumsever") + "/wd/hub"), capabilities);
|
||||
String url="http://" + properties.getProperty("appiumsever") + "/wd/hub";
|
||||
appium = new AndroidDriver<AndroidElement>(new URL(url), capabilities);
|
||||
int waittime = Integer.valueOf(properties.getProperty("implicitlyWait"));
|
||||
appium.manage().timeouts().implicitlyWait(waittime, TimeUnit.SECONDS);
|
||||
return appium;
|
||||
|
@ -94,8 +94,8 @@ public class AppiumInitialization {
|
|||
capabilities.setCapability("noSign", Boolean.valueOf(properties.getProperty("noSign")));
|
||||
// 等待超时没接收到命令关闭appium
|
||||
capabilities.setCapability("newCommandTimeout", properties.getProperty("newCommandTimeout"));
|
||||
appium = new IOSDriver<IOSElement>(new URL("http://" + properties.getProperty("appiumsever") + "/wd/hub"),
|
||||
capabilities);
|
||||
String url="http://" + properties.getProperty("appiumsever") + "/wd/hub";
|
||||
appium = new IOSDriver<IOSElement>(new URL(url),capabilities);
|
||||
int waittime = Integer.valueOf(properties.getProperty("implicitlyWait"));
|
||||
appium.manage().timeouts().implicitlyWait(waittime, TimeUnit.SECONDS);
|
||||
return appium;
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package luckyclient.execution.appium;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.appium.java_client.android.AndroidDriver;
|
||||
import io.appium.java_client.android.AndroidElement;
|
||||
import luckyclient.execution.appium.androidex.AndroidCaseExecution;
|
||||
import luckyclient.remote.api.GetServerApi;
|
||||
import luckyclient.remote.api.serverOperation;
|
||||
import luckyclient.remote.entity.ProjectCase;
|
||||
import luckyclient.remote.entity.ProjectCaseParams;
|
||||
import luckyclient.remote.entity.ProjectCaseSteps;
|
||||
import luckyclient.utils.LogUtil;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
* 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。
|
||||
* 为了尊重作者的劳动成果,LuckyFrame关键版权信息严禁篡改
|
||||
* 有任何疑问欢迎联系作者讨论。 QQ:1573584944 seagull1985
|
||||
* =================================================================
|
||||
*
|
||||
* @author: seagull
|
||||
* @date 2017年12月1日 上午9:29:40
|
||||
*
|
||||
*/
|
||||
public class CaseLocalDebug{
|
||||
|
||||
/**
|
||||
* 单个移动端用例调试
|
||||
* @param appium
|
||||
* @param testCaseExternalId
|
||||
* @author Seagull
|
||||
* @date 2020年1月20日
|
||||
*/
|
||||
public static void oneCasedebug(AndroidDriver<AndroidElement> appium,String testCaseExternalId){
|
||||
//不记录日志到数据库
|
||||
serverOperation.exetype = 1;
|
||||
serverOperation caselog = new serverOperation();
|
||||
try {
|
||||
ProjectCase testcase = GetServerApi.cgetCaseBysign(testCaseExternalId);
|
||||
List<ProjectCaseParams> pcplist=GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
|
||||
LogUtil.APP.info("开始执行用例:【{}】......",testCaseExternalId);
|
||||
List<ProjectCaseSteps> steps=GetServerApi.getStepsbycaseid(testcase.getCaseId());
|
||||
AndroidCaseExecution.caseExcution(testcase, steps, "888888", appium, caselog, pcplist);
|
||||
LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign());
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("用户执行过程中抛出异常!", e);
|
||||
}
|
||||
//退出
|
||||
appium.quit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 多个移动端用例调试
|
||||
* @param appium
|
||||
* @param projectname
|
||||
* @param addtestcase
|
||||
* @author Seagull
|
||||
* @date 2020年1月20日
|
||||
*/
|
||||
public static void moreCaseDebug(AndroidDriver<AndroidElement> appium,String projectname,List<String> addtestcase){
|
||||
System.out.println("当前调试用例总共:"+addtestcase.size());
|
||||
for(String testCaseExternalId:addtestcase) {
|
||||
try{
|
||||
LogUtil.APP.info("开始调用方法,项目名:{},用例编号:{}",projectname,testCaseExternalId);
|
||||
oneCasedebug(appium,testCaseExternalId);
|
||||
}catch(Exception e){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -9,9 +9,12 @@ import org.openqa.selenium.Alert;
|
|||
import org.openqa.selenium.JavascriptExecutor;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.appium.java_client.android.AndroidDriver;
|
||||
import io.appium.java_client.android.AndroidElement;
|
||||
import io.appium.java_client.android.AndroidTouchAction;
|
||||
import io.appium.java_client.android.nativekey.AndroidKey;
|
||||
import io.appium.java_client.android.nativekey.KeyEvent;
|
||||
import io.appium.java_client.touch.LongPressOptions;
|
||||
import io.appium.java_client.touch.WaitOptions;
|
||||
import io.appium.java_client.touch.offset.ElementOption;
|
||||
|
@ -201,14 +204,21 @@ public class AndroidEncapsulateOperation {
|
|||
result = "执行安卓adb命令...【" + operationValue + "】";
|
||||
LogUtil.APP.info("执行安卓adb命令...【{}】",operationValue);
|
||||
break;
|
||||
case "keycode":
|
||||
case "androidkeycode":
|
||||
// 模拟手机键盘
|
||||
if (ChangString.isNumeric(operationValue)) {
|
||||
appium.pressKeyCode(Integer.valueOf(operationValue));
|
||||
result = "模拟手机键盘发送指令...keycode【" + operationValue + "】";
|
||||
LogUtil.APP.info("模拟手机键盘发送指令...keycode【{}】",operationValue);
|
||||
} else {
|
||||
|
||||
try {
|
||||
if (StrUtil.isNotBlank(operationValue)) {
|
||||
KeyEvent keyEvent = new KeyEvent();
|
||||
appium.pressKey(keyEvent.withKey(AndroidKey.valueOf(operationValue)));
|
||||
result = "模拟手机键盘发送指令...keycode【" + operationValue + "】";
|
||||
LogUtil.APP.info("模拟手机键盘发送指令...keycode【{}】", operationValue);
|
||||
} else {
|
||||
result = "模拟手机键盘失败,键盘参数为空,请检查你的参数!";
|
||||
LogUtil.APP.info("模拟手机键盘失败,键盘参数为空,请检查你的参数!");
|
||||
}
|
||||
} catch (IllegalArgumentException ae) {
|
||||
result = "模拟手机按键失败,没有找到对应的按键参数,请检查你的参数!";
|
||||
LogUtil.APP.info("模拟手机按键失败,没有找到对应的按键参数,请检查你的参数!");
|
||||
}
|
||||
break;
|
||||
// 隐藏手机键盘
|
||||
|
|
|
@ -221,9 +221,6 @@ public class IosCaseExecution{
|
|||
case "iosnspredicate":
|
||||
ae = appium.findElementByIosNsPredicate(propertyValue);
|
||||
break;
|
||||
case "iosuiautomation":
|
||||
ae = appium.findElementByIosUIAutomation(propertyValue);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,13 @@ import luckyclient.utils.LogUtil;
|
|||
*/
|
||||
public class CaseLocalDebug{
|
||||
|
||||
|
||||
/**
|
||||
* 单个用例Web UI调试
|
||||
* @param wd
|
||||
* @param testCaseExternalId
|
||||
* @author Seagull
|
||||
* @date 2020年1月20日
|
||||
*/
|
||||
public static void oneCasedebug(WebDriver wd,String testCaseExternalId){
|
||||
//不记录日志到数据库
|
||||
serverOperation.exetype = 1;
|
||||
|
@ -45,10 +51,12 @@ public class CaseLocalDebug{
|
|||
}
|
||||
|
||||
/**
|
||||
* @param 项目名
|
||||
* @param 用例编号
|
||||
* @param 用例版本号
|
||||
* 用于在testlink上配置好用例参数后,做多条用例串行调试
|
||||
* 多个用例串行Web UI调试
|
||||
* @param wd
|
||||
* @param projectname
|
||||
* @param addtestcase
|
||||
* @author Seagull
|
||||
* @date 2020年1月20日
|
||||
*/
|
||||
public static void moreCaseDebug(WebDriver wd,String projectname,List<String> addtestcase){
|
||||
System.out.println("当前调试用例总共:"+addtestcase.size());
|
||||
|
|
|
@ -2,7 +2,6 @@ package luckyclient.remote.entity;
|
|||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
/**
|
||||
* 测试用例实体
|
||||
|
|
|
@ -2,7 +2,6 @@ package luckyclient.remote.entity;
|
|||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
/**
|
||||
* 测试计划实体
|
||||
|
|
Loading…
Reference in New Issue