Commit a2339be4 authored by qwj-github's avatar qwj-github

Merge branch 'develop' of http://gitlab2.dui88.com/mabo/test-platform into develop

parents c39e4608 a7549de4
......@@ -22,13 +22,14 @@ import static io.restassured.RestAssured.given;
*/
public class Postman {
final static String dingdingUrl="https://shark.dui88.com/test/integration";
final static String testPlatformUrl = "http://101.37.27.82:8080/insert";
final static String testPlatformUrl = "http://test-run.duibatest.com.cn/insert";
final static String miriaUrl = "http://miria-aliyun.duibatest.com.cn/autoTest/finish";
final static String miriaUrlTesting = "http://miria-aliyun.duibatest.com.cn/autoTest/testing";
final static String miriaUrlFindTestApp = "http://miria-aliyun.duibatest.com.cn/autoTest/findTestApp";
//dingdingUrl="http://www.json.cn/";
private static Logger logger = LogManager.getLogger(Postman.class);
// private static Logger logger = LogManager.getLogger(Postman.class);
public static DuibaLog logger = DuibaLog.getLogger();
public static void send2Dingding(Map result){
System.out.println("Dingding:"+result);
RestAssuredConfig config = RestAssured.config();
......@@ -44,7 +45,7 @@ public class Postman {
String[] name = DingdingResult.name;
result.put("names",name);
response=given().contentType(ContentType.JSON).body(result).post(dingdingUrl);
System.out.println("钉钉重试响应数据:"+response.asString());
logger.info("钉钉重试响应数据:"+response.asString());
}
......@@ -52,28 +53,28 @@ public class Postman {
public static void sendTestPlatform(Map result){
Response response=given().contentType(ContentType.JSON).body(result).post(testPlatformUrl);
System.out.println("自动化数据收集平台响应数据:"+response.asString());
logger.info("自动化数据收集平台响应数据:"+response.asString());
}
public static void sendFinish(Map result){
Response response=given().params(result).get(miriaUrl);
System.out.println("jobName:"+result.get("jobName"));
System.out.println("miriaUrl:"+miriaUrl);
System.out.println("miria响应结果:"+response.asString());
logger.info("jobName:"+result.get("jobName"));
logger.info("miriaUrl:"+miriaUrl);
logger.info("miria响应结果:"+response.asString());
}
public static void sendTesting(Map result){
Response response=given().params(result).get(miriaUrlTesting);
System.out.println("jobName:"+result.get("jobName"));
System.out.println("miriaUrl:"+miriaUrlTesting);
System.out.println("miria响应结果:"+response.asString());
logger.info("jobName:"+result.get("jobName"));
logger.info("miriaUrl:"+miriaUrlTesting);
logger.info("miria响应结果:"+response.asString());
}
public static String sendFindTestApp(Map result){
Response response=given().params(result).get(miriaUrlFindTestApp);
System.out.println("jobName:"+result.get("jobName"));
System.out.println("miriaUrl:"+miriaUrlTesting);
System.out.println("miria响应结果:"+response.asString());
logger.info("jobName:"+result.get("jobName"));
logger.info("miriaUrl:"+miriaUrlFindTestApp);
logger.info("miria响应结果:"+response.asString());
String value = response.jsonPath().getString("value");
return value;
}
......
......@@ -387,7 +387,7 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_创建活动楼层皮肤" })
public void B_手机端活动() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -444,7 +444,7 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_手机端活动" })
public void C_删除活动楼层皮肤() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......
......@@ -154,7 +154,7 @@ public class Banner_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_创建banner楼层皮肤" })
public void B_banner楼层活动校验() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -212,7 +212,7 @@ public class Banner_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_banner楼层活动校验" })
public void C_banner商品校验() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......
......@@ -342,7 +342,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_创建优惠券楼层皮肤" })
public void B_优惠券手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -392,7 +392,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_优惠券手机端" })
public void C_删除优惠券楼层皮肤() throws Exception {
......
......@@ -230,7 +230,7 @@ public class Game_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_创建游戏楼层皮肤" })
public void B_游戏手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -272,7 +272,7 @@ public class Game_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_游戏手机端" })
public void C_删除游戏楼层皮肤() throws Exception {
......
......@@ -222,7 +222,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_创建icon楼层皮肤" })
public void B_icon添加图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -296,7 +296,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_icon添加图标" })
public void C_icon编辑图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -352,7 +352,7 @@ public class Icon_FloorTest extends DuibaTestBase {
Assert.assertEquals(map.get("logo"),"//yun.dui88.com/images/201806/9lz5ifre0h.png","今日必抢logo校验错误");
}
@Test
@Test(dependsOnMethods = { "C_icon编辑图标" })
public void D_icon删除图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -388,7 +388,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "D_icon删除图标" })
public void E_删除icon楼层皮肤() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......
......@@ -362,7 +362,7 @@ public class Item_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_item创建楼层皮肤" })
public void B_item手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -404,7 +404,7 @@ public class Item_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_item手机端" })
public void C_item删除楼层皮肤() throws Exception {
......
......@@ -806,7 +806,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
response = floorService.switchOpenState(authorization.ssoLogin(),skinId,"true");
}
@Test
@Test(dependsOnMethods = { "A_Seckill创建楼层皮肤" })
public void B_Seckill手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -849,7 +849,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_Seckill手机端" })
public void C_Seckill删除楼层皮肤() throws Exception {
......
......@@ -244,7 +244,7 @@ public class Showcase_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_Showcase创建楼层皮肤" })
public void B_Showcase手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -289,7 +289,7 @@ public class Showcase_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_Showcase手机端" })
public void C_Showcase删除楼层皮肤() throws Exception {
......
......@@ -510,7 +510,7 @@ public class Sign_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_sign创建楼层皮肤" })
public void B_sign手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -545,7 +545,7 @@ public class Sign_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_sign手机端" })
public void C_sign删除楼层皮肤() throws Exception {
......
......@@ -25,7 +25,7 @@ import org.testng.annotations.Test;
import java.util.Map;
public class 瓜分积分_作弊瓜分 extends DuibaTestBase {
public class 瓜分积分_作弊瓜分_AccessTest extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
......
......@@ -27,7 +27,7 @@ import java.util.List;
import java.util.Map;
public class 瓜分积分_实际瓜分 extends DuibaTestBase {
public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
......
......@@ -27,7 +27,7 @@ import java.text.DecimalFormat;
import java.util.Map;
public class 瓜分红包_作弊瓜分 extends DuibaTestBase {
public class 瓜分红包_作弊瓜分_AccessTest extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
......
......@@ -27,7 +27,7 @@ import java.text.DecimalFormat;
import java.util.Map;
public class 瓜分红包_实际瓜分 extends DuibaTestBase {
public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
......
......@@ -56,6 +56,7 @@ public class Authorization {
private static Map<String,String> hdCookiesMabo;
private static Map<String,String> hdCookiesSaas;
private static Map<String,Map> hdCookiesSaasByApp = new ConcurrentHashMap<>();
private static Map<String,Map> hdCookiesSaasNew = new ConcurrentHashMap<>();
private static Map<String,Map> hdCookiesCommon = new ConcurrentHashMap<>();
private static Map<String,String> openbsCookies;
private Map<String,String> ssoCookies =null;
......@@ -241,6 +242,7 @@ public class Authorization {
return hdCookiesMabo;
}
//密码为wxs123456 (支持账号 wxs@duiba.com.cn,尽量不要用)
public Map hdLoginSaas(){
int i=10;
while((hdCookiesSaas==null||hdCookiesSaas.size()==0)&&i>0) {
......@@ -261,6 +263,7 @@ public class Authorization {
return hdCookiesSaas;
}
//密码为wxs123456 (支持 账号为wxs@duiba.com.cn 下的任意appId)
public Map hdLoginSaas(String appId){
int i=10;
logger.info("hdCookiesSaasByApp cookies:"+hdCookiesSaasByApp.toString());
......@@ -292,7 +295,44 @@ public class Authorization {
logger.info("hdCookiesSaasByApp cookies集合:"+hdCookiesSaasByApp.toString());
return hdCookies;
}
//密码为duibaduiba123
//密码为duibaduiba123(支持任意手机账号下的任意APPId)
public Map hdLoginSaasNew(String account,String appId){
String path = "/doLoginNew";
int i=10;
logger.info("hdCookiesSaasByApp cookies:"+hdCookiesSaasNew.toString());
Map<String,String> hdCookies = hdCookiesSaasNew.get(appId);
while((hdCookies==null||hdCookies.size()==0)&&i>0) {
Response token=this.hdGetToken();
String url = PROTOCOL + hdHost + path;
Map<String,String> cookies=token.getCookies();
Map<String, String> paras = new HashMap<>();
paras.put("account", account);
paras.put("password", SecurityUtils.getMD5("Dct7xTdGPvbUL1eOtSWoB9ySZNY="+from(token.asString()).getString("data.loginsToken")));
paras.put("redirect", "/redirectApp");
paras.put("isAutoLogin", "true");
paras.put("validate","22");
Response response = given().cookies(cookies).params(paras).post(url);
response.prettyPrint();
Map<String,String> map = response.getCookies();
logger.info("cookies:"+map.toString());
hdCookies=new HashMap<>(response.getCookies());
if(hdCookies!=null||hdCookies.size()!=0) {
//取消安全校验
hdCookies.remove("csrf_token");
hdCookies.put("appId", appId);
hdCookies.put("duibaAppId", appId);
logger.info("cookies2:"+hdCookies.toString());
hdCookiesSaasNew.put(appId,hdCookies);
}
i--;
}
logger.info("hdCookiesSaasByApp cookies集合:"+hdCookiesSaasNew.toString());
return hdCookies;
}
//密码为duibaduiba123 (支持任意邮箱账号)
public Map hdLoginCommon(String email){
int i=10;
Map<String,String> hdCookies = hdCookiesCommon.get(email);
......@@ -344,7 +384,6 @@ public class Authorization {
i--;
}
//取消安全校验
// logger.info(hdCookies);
return hdCookies;
}
......
......@@ -40,8 +40,6 @@ public class PkDevelopService {
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
public Response betEditor(String appId,String bonusType,String bonusAmount,String creditsValue,String shareExp) throws Exception{
String data = PublicMethod.data();
......@@ -100,6 +98,64 @@ public class PkDevelopService {
return betResponse;
}
public Response betEditor_right(String account,String appId,String bonusType,String bonusAmount,String creditsValue,String shareExp,String loser,String winner) throws Exception{
String data = PublicMethod.data();
String url = "http://" + hdHost + "/visual-editor/bet/post";
//创建投注项
List<BetOptionVo> betOptionVoList = new ArrayList<>();
BetOptionVo betOptionVo1 = new BetOptionVo();
BetOptionVo betOptionVo2 = new BetOptionVo();
betOptionVo1.setOptionImg("//yun.dui88.com/images/201812/75j84chnkg.jpg");
betOptionVo1.setOptionName("1");
betOptionVo1.setRightAnswer(loser);
betOptionVo2.setOptionImg("//yun.dui88.com/images/201812/4f51vmzfpu.png");
betOptionVo2.setOptionName("2");
betOptionVo2.setRightAnswer(winner);
betOptionVoList.add(betOptionVo1);
betOptionVoList.add(betOptionVo2);
//创建活动配置
List<BetDevelopVo> betDevelopVoList = new ArrayList<>();
BetDevelopVo betDevelopVo = new BetDevelopVo();
betDevelopVo.setBetOptionDtoList(betOptionVoList);
betDevelopVo.setBetType("1");
betDevelopVo.setBonusType(bonusType);
if (bonusType.equals("2")){
betDevelopVo.setTitle("【自动化】组件pk_瓜分红包"+data);
}else if (bonusType.equals("4")){
betDevelopVo.setTitle("【自动化】组件pk_瓜分积分"+data);
}
betDevelopVo.setBonusAmount(bonusAmount);
betDevelopVo.setConfigStatus("3");
betDevelopVo.setCreditsValue(creditsValue);
betDevelopVo.setEndTime("2029-12-31 00:00");
betDevelopVo.setShareExp(shareExp);
betDevelopVoList.add(betDevelopVo);
Map<String,Object> para = new HashMap<>();
para.put("list",betDevelopVoList);
para.put("rules","自动化规则自动化规则");
para.put("title","组件pk自动化_主胜方");
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(para));
Response betResponse = given().contentType("application/json;charset=UTF-8").cookies(authorization.hdLoginSaasNew(account,appId)).body(jsonParam).post(url);
betResponse.prettyPrint();
try{
Assert.assertEquals(betResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("创建pk活动接口失败,返回信息:"+betResponse.asString());
}catch(Error er){
throw new Exception("创建pk活动接口失败,返回信息:"+betResponse.asString());
}
return betResponse;
}
public Response doDraw() throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betOpenPrize/doDraw";
Map<String,Object> para = new HashMap<>();
......
......@@ -14,7 +14,7 @@ public class 优惠券_ExchangeTest_ui extends DuibaBaseUi{
@Test
public void 优惠券兑换_正常流程() throws Exception {
open("http://dafuweng.duibatest.com.cn/user/index");
clickByTextEqual("4762");
clickByTextEqual("5074");
switchWindow();
sleep(2);
clickByClass("btn-close");
......
......@@ -11,8 +11,8 @@ import static com.codeborne.selenide.Selenide.open;
public class 实物_ExchangeTest_ui extends DuibaBaseUi{
@Test
public void 实物兑换_正常流程() throws Exception {
open("http://47.97.214.108/user/index");
clickByTextEqual("4762");
open("http://dafuweng.duibatest.com.cn/user/index");
clickByTextEqual("5074");
switchWindow();
sleep(2);
clickByClass("btn-close");
......
......@@ -11,8 +11,8 @@ import static com.codeborne.selenide.Selenide.open;
public class 支付宝_ExchangeTest_ui extends DuibaBaseUi{
@Test
public void 支付宝_正常流程() throws Exception {
open("http://47.97.214.108/user/index");
clickByTextEqual("4762");
open("http://dafuweng.duibatest.com.cn/user/index");
clickByTextEqual("5074");
switchWindow();
sleep(2);
clickByClass("btn-close");
......
......@@ -71,6 +71,9 @@ public class WebDriverFactory {
String OS = prop.getProperty("os.name");
boolean bl=OS.startsWith("Mac");
String basePath=WebDriverType.class.getClassLoader().getResource("").getPath();
basePath = basePath.replaceAll("%20"," ");//repaceAll("%20",'');
File directory = new File("");
System.out.println("-----路径:"+directory.getAbsolutePath());
RemoteWebDriver browser=null;
String driverPath=null;
switch (driverType){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment