Commit 13a37900 authored by 张艳玲's avatar 张艳玲

Merge branch 'gifeature/20210729-gj' into 'master'

180天打卡、我的吐槽、历史分享接口用例

See merge request test-group/kejiji!90
parents 916a8391 bd2ccc67
...@@ -55,8 +55,11 @@ public interface Authorization { ...@@ -55,8 +55,11 @@ public interface Authorization {
network.agentCookies.put("tku", VISITOR1_TKU); network.agentCookies.put("tku", VISITOR1_TKU);
System.out.println("访客tku:" + VISITOR1_TKU); System.out.println("访客tku:" + VISITOR1_TKU);
} }
//获取代理人tku,180天打卡返现专用:Jovia
default void cashBackTku(){
network.agentCookies.put("tku",CASHBACK_TKU);
System.out.println("打卡返现tku:"+CASHBACK_TKU);
}
/** /**
* 直播业务相关 * 直播业务相关
......
package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*;
import com.kjj.cases.admin.Authorization;
import org.testng.Assert;
import org.testng.annotations.*;
import io.restassured.response.Response;
import java.util.*;
import java.text.SimpleDateFormat;
public class CashBack implements Authorization {
public String sid; //加密的销售id
public String grassContentId; //文章内容id
public String scId; //获取文章id
public Integer clockTimes; //获取打卡的总次数
@BeforeClass
public void setUp() {
//打卡返现专用TKU
cashBackTku();
}
//种草文章转发
@Test(description = "种草素材转发", priority = 1)
public void 种草素材转发() {
//获取种草素材列表页
Response listRes = network.getResponse(ARTICLE_GETEXPLOSIONCONTENTLIST);
grassContentId = listRes.jsonPath().getString("data[0].contentId");
//根据种草素材的ContentId获取Scid
Map<String, Object> getScIdParams = new HashMap<>();
getScIdParams.put("contentId", grassContentId);
Response getScIdRes = network.getResponse(getScIdParams, GETSCID);
scId = getScIdRes.jsonPath().getString("data");
//种草文章转发
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId", scId);
params.put("forwardType", 1);
Response response = network.getResponse(params, FORWARD);
Boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params, FORWARD, "种草文章转发失败", response.body().asString()));
}
@Test(description = "打卡任务进度",priority = 2)
public void 打卡任务进度(){
Response response = network.getResponse(HOME_dailyProgress);
Object dayStatus = response.jsonPath().getJsonObject("data.dayStatus");
String desc = response.jsonPath().getString("desc");
clockTimes = response.jsonPath().getInt("data.clockInTimes");
Assert.assertEquals(dayStatus,2, network.message(HOME_dailyProgress,"打卡任务查询失败",response.body().asString()));
Assert.assertEquals(desc,"OK",network.message(HOME_dailyProgress,"打卡任务查询失败",response.body().asString()));
}
@Test(description = "打卡数据统计",priority = 3)
public void 打卡数据统计(){
Response response = network.getResponse(HOME_statistic);
Object clockInTimes = response.jsonPath().getJsonObject("data.clockInTimes");
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(clockInTimes,clockTimes, network.message(HOME_dailyProgress,"打卡数据统计错误",response.body().asString()));
Assert.assertEquals(desc,"OK",network.message(HOME_dailyProgress,"打卡数据统计错误",response.body().asString()));
}
@Test(description = "打卡记录",priority = 4)
public void 打卡记录(){
Map<String,Object> params = new HashMap<>();
params.put("dayStatus",2);
Response response = network.getResponse(params,HOME_record);
Object doneTime = response.jsonPath().getJsonObject("data.list.get(0).doneTime");
//获取当天时间
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String today = simpleDateFormat.format(date.getTime());
//获取当天凌晨的时间戳
long current = System.currentTimeMillis();
long currentDate = current-(current+ TimeZone.getDefault().getRawOffset())%(1000*3600*24);
Assert.assertEquals(doneTime,currentDate,network.message(params,HOME_record,"获取当日打卡记录成功",response.body().asString()));
}
}
...@@ -24,10 +24,9 @@ public class HomePage implements Authorization { ...@@ -24,10 +24,9 @@ public class HomePage implements Authorization {
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
BaseUtils.ssoLogin();
agentTku(); agentTku();
userTku(); userTku();
//管理后台登录
BaseUtils.ssoLogin();
} }
//获取种草素材列表页 //获取种草素材列表页
...@@ -318,4 +317,30 @@ public class HomePage implements Authorization { ...@@ -318,4 +317,30 @@ public class HomePage implements Authorization {
Assert.assertTrue(updateSuccess,network.message(params,MANAGER_updateStatus,"下架成功案例失败",updateRes.body().asString())); Assert.assertTrue(updateSuccess,network.message(params,MANAGER_updateStatus,"下架成功案例失败",updateRes.body().asString()));
} }
//个人中心—我的反馈
@Test(description = "个人中心_我的反馈",priority = 20)
public void 我的反馈(){
//tku 切换为访客的
network.agentCookies.put("tku", VISITOR_TKU);
Map<String,Object> params = new HashMap<>();
params.put("feedbackContent","自动化测试");
params.put("feedbackPics","//yun.dui88.com/kjy/image/20210729/d66257a1efe348819539372d4b53313f.jpg");
params.put("feedbackSource",3); //feedbackSource指反馈建议的入口,3指代个人中心
params.put("feedbackType",4);
Response response = network.postResponse(params,HOME_feedBackSave);
String desc = response.jsonPath().getString("desc");
boolean success = response.jsonPath().getBoolean("success");
Assert.assertEquals(desc,"OK",network.message(params,HOME_feedBackSave,"反馈意见提交成功",response.body().asString()));
Assert.assertTrue(success,network.message(params,HOME_feedBackSave,"反馈意见提交成功",response.body().asString()));
}
//管理后台-集客助手反馈
@Test(description = "管理后台_集客助手反馈",priority = 21)
public void 集客助手反馈结果(){
//验证管理后台是否接收到消息
Response manageRes = network.getResponse(MANAGER_feedBackList);
Object feedbackContent = manageRes.jsonPath().getJsonObject("data.list.get(0).feedbackContent");
System.out.println(feedbackContent);
Assert.assertEquals(feedbackContent,"自动化测试",network.message(MANAGER_feedBackList,"个人中心反馈失败",manageRes.body().asString()));
}
} }
...@@ -80,6 +80,13 @@ public class RecommendMaterial implements Authorization { ...@@ -80,6 +80,13 @@ public class RecommendMaterial implements Authorization {
Response response = network.getResponse(params, FORWARD); Response response = network.getResponse(params, FORWARD);
Boolean success = response.jsonPath().getBoolean("success"); Boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params, FORWARD, "种草文章转发失败", response.body().asString())); Assert.assertTrue(success, network.message(params, FORWARD, "种草文章转发失败", response.body().asString()));
//个人中心——历史分享
Map<String,Object> paramsHistory = new HashMap<>();
paramsHistory.put("sellerId",2991); //吉吉的销售员id
Response historyRes = network.getResponse(paramsHistory,HOME_sellerContentHistory);
Object list = historyRes.jsonPath().getJsonObject("data.list.get(0).scId");
Assert.assertEquals(list,scid, network.message(paramsHistory,HOME_sellerContentHistory,"获取历史分享失败",historyRes.body().asString()));
} }
......
...@@ -82,8 +82,8 @@ public class BasicConfig { ...@@ -82,8 +82,8 @@ public class BasicConfig {
public static String VISITOR_UserTku = "T3gM31f18jAW2hicRDxbwHFSuwA4MMVLLeHZ5G4yvb3sz6YRdcqKfzRJ8dMnfqDmgS8EprRjhFpXPFLBvp"; public static String VISITOR_UserTku = "T3gM31f18jAW2hicRDxbwHFSuwA4MMVLLeHZ5G4yvb3sz6YRdcqKfzRJ8dMnfqDmgS8EprRjhFpXPFLBvp";
// 钉钉机器人 线上-告警群 // 钉钉机器人 线上-告警群
public static final String dingTalkPath = "https://oapi.dingtalk.com/robot/send?access_token=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2"; public static final String dingTalkPath = "https://oapi.dingtalk.com/robot/send?access_token=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2";
// 180天打卡专用代理人 TKU (Jovia),sid :3591
public static String CASHBACK_TKU = "T3gM31f18jCeXXZ8mG3oRE5KGiKg8r7x3Kqf81G5TYpPDL2evLbGxhnkJpUxTr1LvrUd1ZGJqxf6jEHoUY";
// *************** 客集集域名 *************** // *************** 客集集域名 ***************
public static final String HOST = "https://kjj.m.duibatest.com.cn"; public static final String HOST = "https://kjj.m.duibatest.com.cn";
public static final String ACTIVITY_HOST = "https://kjj-activity.duibatest.com.cn"; public static final String ACTIVITY_HOST = "https://kjj-activity.duibatest.com.cn";
...@@ -823,7 +823,11 @@ public class BasicConfig { ...@@ -823,7 +823,11 @@ public class BasicConfig {
public static final String HOME_getPosterTemplateList = HOST + "/kjy/mp/posterTemplate/getPosterTemplateList"; public static final String HOME_getPosterTemplateList = HOST + "/kjy/mp/posterTemplate/getPosterTemplateList";
public static final String HOME_findPosterById = HOST + "/kjy/mp/posterTemplate/findPosterById"; public static final String HOME_findPosterById = HOST + "/kjy/mp/posterTemplate/findPosterById";
public static final String HOME_getExclusiveArea = HOST + "/kjy/mp/classify/getExclusiveArea"; public static final String HOME_getExclusiveArea = HOST + "/kjy/mp/classify/getExclusiveArea";
public static final String HOME_sellerContentHistory = HOST + "/kjy/mp/chat/sellerContentHistory";
public static final String HOME_feedBackSave = HOST + "/kjy/mp/seller/feedback/save";
public static final String HOME_dailyProgress = HOST + "/kjy/mp/clockIn/task/dailyProgress";
public static final String HOME_statistic = HOST + "/kjy/mp/clockIn/task/statistic";
public static final String HOME_record = HOST + "/kjy/mp/clockIn/task/record";
//******************个人中心********************** //******************个人中心**********************
public static final String USINGSTRATAGY_index = HOST + "/kjy/mp/usingStrategy/index"; public static final String USINGSTRATAGY_index = HOST + "/kjy/mp/usingStrategy/index";
public static final String USINGSTRATAGY_strategyList = HOST + "/kjy/mp/usingStrategy/strategyList"; public static final String USINGSTRATAGY_strategyList = HOST + "/kjy/mp/usingStrategy/strategyList";
...@@ -966,4 +970,5 @@ public class BasicConfig { ...@@ -966,4 +970,5 @@ public class BasicConfig {
public static final String MANAGER_addExclusiveArea = MANAGER_HOST + "/kjy/manager/exclusiveArea/add"; public static final String MANAGER_addExclusiveArea = MANAGER_HOST + "/kjy/manager/exclusiveArea/add";
public static final String MANAGER_searchTemplateList = MANAGER_HOST + "/kjy/manager/game/searchTemplateList"; public static final String MANAGER_searchTemplateList = MANAGER_HOST + "/kjy/manager/game/searchTemplateList";
public static final String MANAGER_getTemplateDetail = MANAGER_HOST + "/kjy/manager/game/getTemplateDetail"; public static final String MANAGER_getTemplateDetail = MANAGER_HOST + "/kjy/manager/game/getTemplateDetail";
public static final String MANAGER_feedBackList = MANAGER_HOST + "/kjy/manager/feedback/list";
} }
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