Commit 83618bbe authored by 赵然's avatar 赵然

Merge branch 'master' of gitlab2.dui88.com:mabo/test-platform

parents f890502b 348c15e7
......@@ -147,7 +147,7 @@ public class 种红包新用户_AccessTest extends DuibaTestBase{
Response response = editManagerInfoService.createUser("种红包新用户","68");
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '种红包新用户' and app_id = '68'");
uid = Integer.valueOf(user.get("id").toString());
String url = "http://dafuweng.dui88.com/user/loginDuiba?uid=" + uid;
String url = "http://autotest-dafuweng.duibatest.com.cn/user/loginDuiba?uid=" + uid;
Response login = given().get(url);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = '19380'",uid);
consumerId = consumer.get("id").toString();
......
......@@ -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
......
......@@ -449,7 +449,7 @@ public class EditManagerInfoService {
public Response createUser(String name){
String url = "http://dafuweng.dui88.com" + "/user/create";
String url = "http://autotest-dafuweng.duibatest.com.cn" + "/user/create";
Map<String,Object> map = new HashMap<>();
map.put("appId","67");
map.put("name",name);
......@@ -464,7 +464,7 @@ public class EditManagerInfoService {
public Response createUser(String name,String appId){
String url = "http://dafuweng.dui88.com" + "/user/create";
String url = "http://autotest-dafuweng.duibatest.com.cn" + "/user/create";
Map<String,Object> map = new HashMap<>();
map.put("appId",appId);
map.put("name",name);
......
......@@ -13,7 +13,7 @@ import static io.restassured.RestAssured.given;
*/
@Service
public class SupplierExchangeTemplateService {
private String dafuwengHost = "dafuweng.dui88.com";
private String dafuwengHost = "autotest-dafuweng.duibatest.com.cn";
public Response use(String id){
String url = "http://"+dafuwengHost+"/supplierExchangeTemplate/use";
......
......@@ -586,6 +586,7 @@ public class gawService {
map.put("appItemId",appItemId);
map.put("payType", 3);
map.put("appSkuId",appSkuId);
map.put("vipFlag",false);
logger.info("请求确认下单页接口:"+ "/gaw/h5/confirmItemDetail");
Response response = given().contentType("application/json; charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).get("http://"+goodsHost+"/gaw/h5/confirmItemDetail");
......
......@@ -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();
......
......@@ -10,7 +10,7 @@ import static java.lang.Thread.sleep;
* Created by mabo on 2018/12/17
*/
public class MoblieLogin{
private String dafuwengUrl="http://dafuweng.dui88.com/user/index";
private String dafuwengUrl="http://autotest-dafuweng.duibatest.com.cn/user/index";
public MoblieLogin(String uid, DuibaBaseUi father) throws Exception {
open(dafuwengUrl);
father.clickByTextEqual(uid);
......
......@@ -4,7 +4,7 @@ proxyserver.ip=172.16.80.203
proxyserver.port=22
proxyserver.user=dev
proxyserver.prvkey=key/hzlId_rsa
dafuweng.host=dafuweng.dui88.com
dafuweng.host=autotest-dafuweng.duibatest.com.cn
dafuweng.port=80
uid=2707
appId=2239
......
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