Commit 348c15e7 authored by 马博's avatar 马博

dafuwen域名变化

parent 2f23dfa9
......@@ -99,6 +99,43 @@ public class Authorization {
return dafuwengCookiesMap.get(uid);
}
//大富翁登录
public Map dafuwengLoginTest(int uid){
int i=10;
Map<String,String> dafuwengCookies = null;
while((dafuwengCookiesMap.get(uid)==null||dafuwengCookiesMap.get(uid).size()==0)&&i>0) {
String url = PROTOCOL + "dafuweng.duibatest.com.cn" + ":" + dafuwengPort + dafuwengLoginPath;
Response response=given().redirects().follow(false).param("uid",uid).get(url);
String location = response.getHeader("location");
dafuwengCookies =response.getCookies();
//logger.info(location);
URL url1=null;
try {
url1= new URL(location);
} catch (MalformedURLException e) {
e.printStackTrace();
}
if(url1!=null&&url1.getProtocol().equals("http")) {
response=given().cookies(dafuwengCookies).redirects().follow(false).get(location);
}else if(url1!=null&&url1.getProtocol().equals("https")){
response=given().cookies(dafuwengCookies).relaxedHTTPSValidation().redirects().follow(false).get(location);
}
dafuwengCookies=response.getCookies();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
dafuwengCookiesMap.put(uid,dafuwengCookies);
i--;
}
if((dafuwengCookiesMap.get(uid)==null||dafuwengCookiesMap.get(uid).size()==0)){
logger.info("dafuweng登陆app失败,cookies为null");
}
return dafuwengCookiesMap.get(uid);
}
/**
* 大富翁登陆
* @param uid
......
......@@ -22,7 +22,7 @@ import static ui.common.WebDriverType.CHRMOE;
/**
* Created by mabo on 2019/4/10
*/
public class 双列图 extends DuibaBaseUi{
public class 双列图_Cms_ui extends DuibaBaseUi{
@Autowired
Authorization authorization;
@Autowired
......@@ -50,11 +50,11 @@ public class 双列图 extends DuibaBaseUi{
inputByContainsAttribut("placeholder","请输入无线链接","input","http://www.baidu.com");
sleep(2);
clickByXpath("//*[@class='decoration-link-footer']/button[@class='el-button el-button--primary']");
clickByXpath("//*[@class='decoration-link-footer']/button[@class='el-button el-button--primary el-button--medium']");
clickByTextEqual("添加跳转链接",0);
sleep(2);
clickByXpath("//*[@class='decoration-link-footer']/button[@class='el-button el-button--primary']");
clickByXpath("//*[@class='decoration-link-footer']/button[@class='el-button el-button--primary el-button--medium']");
sleep(1);
inputByXpath("//*[@placeholder=\"请输入文本,20字以内\"]","test1",0);
inputByXpath("//*[@placeholder=\"请输入文本,20字以内\"]","test2",1);
......
......@@ -11,7 +11,7 @@ import ui.service.DafuwengLogin;
/**
* Created by mabo on 2019/4/15
*/
public class 商品分组 extends DuibaBaseUi{
public class 商品分组_Cms_ui extends DuibaBaseUi{
@Autowired
Authorization authorization;
@Autowired
......@@ -28,11 +28,13 @@ public class 商品分组 extends DuibaBaseUi{
clickByTextEqual("商品分组",1);
sleep(3);
clickByTextContains("选择分组",1);
clickByXpath("//*[@class=\"el-table__row \"]//label");
clickByXpath("//*[@class=\"el-table__row\"]//label");
clickByTextEqual("确 定");
clickByTextContains("选择分组",1);
clickByXpath("//*[@class=\"el-table__row el-table__row--striped \"]//label");
clickByXpath("//*[@class=\"el-table__row\"]//label");
// clickByXpath("//*[@class=\"el-table__row el-table__row--striped \"]//label");
clickByTextEqual("确 定");
inputByXpath("//*[@class=\"el-input el-input--medium\"]//input","test1",0);
......@@ -69,10 +71,10 @@ public class 商品分组 extends DuibaBaseUi{
clickByTextEqual("test2");
clickByTextContains("【接口自动化】实物-一直可兑");
clickByTextContains("(勿动)新优惠券日期进行中",1);
sleep(2);
title = driver.getTitle();
Assert.assertEquals(title,"【接口自动化】实物-一直可兑");
Assert.assertEquals(title,"(勿动)新优惠券日期进行中");
}
......
......@@ -16,7 +16,7 @@ import static com.codeborne.selenide.Selenide.open;
/**
* Created by mabo on 2019/4/15
*/
public class 活动分组 extends DuibaBaseUi{
public class 活动分组_Cms_ui extends DuibaBaseUi{
@Autowired
Authorization authorization;
......
......@@ -26,6 +26,7 @@ import ui.common.ProxyFactory;
import ui.common.StatusCheckor;
import ui.common.WebDriverFactory;
import ui.common.WebDriverType;
import utils.MatcherString;
import java.io.File;
import java.io.IOException;
......@@ -84,15 +85,28 @@ public class test extends DuibaBases {
@Test
public void tests(){
int uid = 4662;
String activityId ="22224";
String oaId="22224";
String consumerId = "100340851";
Map<String,String> map = new HashMap<>();
map.put("activityId","22226");
map.put("token","ulxn1sd");
// map.put("score","3");
map.put("activityId",activityId);
map.put("oaId",oaId);
map.put("activityType","hdtool");
map.put("consumerId",consumerId);
map.put("token","1gffs6mq3");
String url = "http://activity.m.duibatest.com.cn";
Map<String,String> header = new HashMap<>();
header.put("User-Agent","windows mabo");
Response response = given().headers(header).cookies(authorization.dafuwengLogin(4665)).params(map).post(url+"/hdtool/guzhanggui/doJoin");
Map mapCookies = new HashMap();
mapCookies.put("_duibaServiceGroupKey","miria-562");
mapCookies.putAll(authorization.dafuwengLoginTest(uid));
Response response = given().headers(header).cookies(mapCookies).params(map).post(url+"/hdtool/doJoin");
response.getCookies();
response.prettyPrint();
String orderId = response.jsonPath().getString("orderId");
......@@ -101,16 +115,59 @@ public class test extends DuibaBases {
sleep(5000);
map.clear();
map.put("orderId",orderId);
response = given().cookies(authorization.dafuwengLogin(4665)).params(map).post(url+"/hdtool/getOrderStatus");
response = given().cookies(mapCookies).params(map).post(url+"/hdtool/getOrderStatus");
response.prettyPrint();
}
@Test
public void testsss() throws SQLException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
System.out.println(df.format(new Date()));
jdbc.findSimpleResult("select sleep(10)");
System.out.println(df.format(new Date()));
int uid = 4816;//4815 4816
String activityId ="22469";
String oaId="22469";
String consumerId = "100355301";//100355300 100355301
Map<String,String> map = new HashMap<>();
map.put("activityId",activityId);
map.put("oaId",oaId);
map.put("activityType","hdtool");
map.put("consumerId",consumerId);
map.put("token","1gffs6mq3");
String url = "http://activity.m.duibatest.com.cn";
Map<String,String> header = new HashMap<>();
header.put("User-Agent","windows mabo");
Map mapCookies = new HashMap();
mapCookies.put("_duibaServiceGroupKey","miria-562");
mapCookies.putAll(authorization.dafuwengLoginTest(uid));
Response response = given().headers(header).cookies(mapCookies).params(map).post(url+"/hdtool/doJoin");
response.getCookies();
response.prettyPrint();
String orderId = response.jsonPath().getString("orderId");
sleep(5000);
map.clear();
map.put("orderId",orderId);
response = given().cookies(mapCookies).params(map).post(url+"/hdtool/getOrderStatus");
response.prettyPrint();
String recordId = MatcherString.getString(response.asString(),"recordId=(.*?)&",1);
System.out.println(recordId);
map.clear();
map.put("alipay","120039974@qq.com");
map.put("realname","mabo");
map.put("recordId",recordId);
map.put("token","12mvxkef");
response = given().headers(header).cookies(mapCookies).params(map).post(url+"/activity/doTakePrize");
response.prettyPrint();
}
......@@ -130,7 +187,7 @@ public class test extends DuibaBases {
Map<String,String> cookie = new HashMap<>(authorization.dafuwengLogin(4665));
cookie.put("_duibaServiceGroupKey","miria-469");
cookie.put("_duibaServiceGroupKey","miria-562");
// Response response = given().headers(header).cookies(cookie).params(map).post(url+"/plugin/doJoin");
Response response = given().headers(header).cookies(cookie).params(map).post(url+"/activityPlugDrawInfo/doJoinPlugdraw");
response.prettyPrint();
......
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