Commit baf1ca9b authored by 钱雯君's avatar 钱雯君

Merge branch 'mabo' into qwj_181029

parents cd870206 10d35dcb
...@@ -58,8 +58,14 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{ ...@@ -58,8 +58,14 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
}; };
}else
if(method.getName().equals("新建自有手动开奖活动")){
result = new Object[][]{
new Object[]{1,"10","everyday","5","everyday","//yun.duiba.com.cn/upload/mhty76ri9b.png","新建自有手动开奖--每日次数"},
};
} }
return result; return result;
} }
...@@ -223,6 +229,52 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{ ...@@ -223,6 +229,52 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
} }
/**
* @param caseNum 用例编号
* @param consumerDrawLimit 用户抽奖限制次数
* @param consumerDrawLimitScope 用户抽奖限制类型
* @param freeLimit 免费抽奖次数
* @param freeLimitScope 免费抽奖次数类型
* @param bannerImgNew 新版banner图
* @param caseName 用例名称
* @throws Exception
*/
@Test(dataProvider = "providerMethod")
public void 新建自有手动开奖活动(int caseNum,String consumerDrawLimit,String consumerDrawLimitScope,String freeLimit,String freeLimitScope,String bannerImgNew,String caseName) throws Exception{
logger.info("-----------------------------"+caseName+"-----------------------------");
String data = PublicMethod.data();
String title = "【自动化】自有手动开奖"+data;
//新建自有手动开奖
developerService.saveManualLottery(title,consumerDrawLimit,consumerDrawLimitScope,freeLimit,freeLimitScope,bannerImgNew);
//获取活动id
Response listResponse = developerService.list2(title);
String id = String.valueOf(listResponse.jsonPath().getString("data.list[0].activityId"));
//编辑活动,校验活动内容
Response editResponse = developerService.editManualLottery(id);
switch (caseNum){
case 1:
Assert.assertEquals(editResponse.jsonPath().getString("data.credits"),"50","校验活动积分失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimit"),"5","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimitScope"),"everyday","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.consumerDrawLimit"),"10","校验用户抽奖限制次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.consumerDrawLimitScope"),"everyday","校验用户抽奖限制类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.bannerImgNew"),"//yun.duiba.com.cn/upload/mhty76ri9b.png","校验活动新版banner图失败");
logger.info("校验新建自有手动开奖-1内容成功");
break;
case 2:
break;
}
//删除测试数据
this.删除自有活动(title);
}
//删除自有活动 //删除自有活动
......
...@@ -47,9 +47,9 @@ public class ObjectExchange_ExchangeTest extends CheckTemplet { ...@@ -47,9 +47,9 @@ public class ObjectExchange_ExchangeTest extends CheckTemplet {
@BeforeClass @BeforeClass
public void before() { public void before() {
managerService.update(uid,"5555555");
// jdbc = MysqlUtils.mysqlDuiba("orders_consumer"); // jdbc = MysqlUtils.mysqlDuiba("orders_consumer");
try { try {
managerService.update(uid,"5555555");
jdbc.update("delete from orders_consumer.orders_0614 where consumer_id = 100011622 and biz_params = 'DUIBA_SELF'", null); jdbc.update("delete from orders_consumer.orders_0614 where consumer_id = 100011622 and biz_params = 'DUIBA_SELF'", null);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -66,9 +66,9 @@ public class 异常订单测试_ExchangeTest extends DuibaTestBase { ...@@ -66,9 +66,9 @@ public class 异常订单测试_ExchangeTest extends DuibaTestBase {
@Test(description = "实物兑换无库存") @Test(description = "实物兑换无库存")
public void 无库存() throws Exception { public void 无库存() throws Exception {
Response response = mobileService.detail(authorization.dafuwengLogin(3661), "31051");//uid3661 Response response = mobileService.detail(authorization.dafuwengLogin(4819), "31051");//uid3661
// response.prettyPrint(); // response.prettyPrint();
Map<String, String> map = authorization.dafuwengLogin(3661, true); Map<String, String> map = authorization.dafuwengLogin(4819);
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "活动详情页请求异常"); Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "活动详情页请求异常");
//实物兑换 //实物兑换
Response response2 = couponExchangeService.objectExchange2(map, "179139", "null", "null", "z9sydmcs", "null"); Response response2 = couponExchangeService.objectExchange2(map, "179139", "null", "null", "z9sydmcs", "null");
......
...@@ -152,7 +152,11 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase { ...@@ -152,7 +152,11 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
//获取未登录场景cookie //获取未登录场景cookie
Response responses = authorization.autoLogin(); Response responses = authorization.autoLogin();
//进行接口测试传参 //进行接口测试传参
Response response = newActivityService.doJoin(responses.getDetailedCookies(),data.get("token"),data.get("activityId")); Map<String,String> map = responses.getCookies();
logger.info("cookies:"+map.toString());
if(responses.getDetailedCookies()==null)logger.info("cookies = = null");
Response response = newActivityService.doJoinMap(map,data.get("token"),data.get("activityId"));
// Response response = newActivityService.doJoin(responses.getDetailedCookies(),data.get("token"),data.get("activityId"));
response.prettyPrint(); response.prettyPrint();
String success = String.valueOf(response.jsonPath().getString("success")); String success = String.valueOf(response.jsonPath().getString("success"));
//根据case选择校验项 //根据case选择校验项
......
package http.cases.SignTest;
import base.DuibaLog;
import base.DuibaTestBase;
import base.MysqlConnPool;
import base.MysqlUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Activity.ManagerService;
import http.service.Activity.ContractSignService;
import http.service.Authorization;
import http.service.hd.SigninService;
import io.restassured.response.Response;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import static io.restassured.RestAssured.given;
@Service
public class ContractSignCommon extends DuibaTestBase{
@Autowired
SigninService signinService;
@Autowired
Authorization authorization;
@Autowired
ContractSignService ContractSignService;
@Autowired
ManagerService managerService;
@Value("${activity.host}")
String activityHost;
private DuibaLog logger = DuibaLog.getLogger();
public Map<String, String> doJoinResult(String activityId, String betAmount, int uid) throws Exception {
Response doJoinRes = ContractSignService.doJoin(activityId, betAmount, uid);
String contractId = doJoinRes.jsonPath().getString("data.contractId");
Map<String, String> map = new HashMap<>();
map.put("totalCount", doJoinRes.jsonPath().getString("data.betCount"));
map.put("buyers", doJoinRes.jsonPath().getString("data.buyers"));
map.put("cycle", doJoinRes.jsonPath().getString("data.contractCycle"));
map.put("contractId", doJoinRes.jsonPath().getString("data.contractId"));
map.put("issueId", doJoinRes.jsonPath().getString("data.issueId"));
map.put("startTime", doJoinRes.jsonPath().getString("data.startTime"));
map.put("endTime", doJoinRes.jsonPath().getString("data.endTime"));
int count = 15;
Response betStatusRes = ContractSignService.betStatus(contractId, uid);
map.put("betCount", betStatusRes.jsonPath().getString("data.betCount"));
String status = "INIT";
String statusDesc = "";
while (count > 0 && status.equals("INIT")){
Thread.sleep(500);
betStatusRes = ContractSignService.betStatus(contractId, uid);
status = betStatusRes.jsonPath().getString("data.doneStatus");
statusDesc = betStatusRes.jsonPath().getString("data.doneStatusDesc");
count --;
}
map.put("doneStatus", status);
logger.info("报名status:" + status);
map.put("doneStatusDesc", statusDesc);
return map;
}
public void clearIssue(String consumerId, String actId, MysqlConnPool jdbc){
try {
Map<String, Object> result = jdbc.findSimpleResult("select id, issue_id from credits_sign.tb_sign_contract_bet where consumer_id="+ consumerId+" and act_id="+ actId);
if(!result.isEmpty()) {
String issueId = result.get("issue_id").toString();
//String contractId = result.get("id").toString();
jdbc.update("delete from credits_sign.tb_sign_contract_issue where id=" + issueId);
jdbc.update("delete from credits_sign.tb_sign_contract_bet where issue_id=" + issueId);
jdbc.update("delete from credits_sign.tb_sign_contract_log where issue_id=" + issueId);
}
}catch (SQLException e){
logger.info("数据库更新异常");
}
}
public void modifyJoinTime(String actId, String date, String startTime, String endTime) throws Exception{
Map<String, Object> map = new HashMap<>();
map.put("title", "自动化_报名截止时间");
map.put("betCount", "1000");
map.put("bonusType","0");
map.put("betType","2");
map.put("bankerBonus", "10000");
map.put("ruleDesc:", "<p>bao ming&nbsp;截止时间</p>");
map.put("contractCycle","7");
map.put("joinTimeLimit", false);
map.put("fakeLimit", false);
map.put("rankPeriod","1");
map.put("joinTimeStart", startTime);
map.put("joinTimeEnd", endTime);
map.put("joinDeadLine", date);
map.put("actId", actId);
map.put("openStatus", true);
map.put("gradientAmountList","");
map.put("freeJoinLimit", "0");
map.put("enableAmpifyCard",false);
map.put("openType", "0");
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(map));
Response response = given().contentType("application/json;charset=UTF-8").cookies(authorization.ssoLogin()).body(jsonObject).post("https://mng.duibatest.com.cn/newmanager/signContract/save");
response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("success"), "true", "/signContract/save接口失败");
} catch (Exception e) {
throw new Exception("/signContract/save接口失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("/signContract/save接口失败,返回信息:" + response.asString());
}
}
public void modifyIssuePeriod(String issueId, int num) throws Exception{
String sql = "select start_time,end_time from credits_sign.tb_sign_contract_issue where id=" + issueId;
Map<String, Object> result = jdbc.findSimpleResult(sql);
String issueStartTime = result.get("start_time").toString();
String issueEndTime = result.get("end_time").toString();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//SimpleDateFormat sdf2 = new SimpleDateFormat("MM-dd");
try {
Date startDate=sdf.parse(issueStartTime);
Date endDate=sdf.parse(issueEndTime);
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
calendar.add(Calendar.DAY_OF_YEAR, num);
String startTime = sdf.format(calendar.getTime());
calendar.setTime(endDate);
calendar.add(Calendar.DAY_OF_YEAR, num);
String endTime = sdf.format(calendar.getTime());
String sql2 = "update credits_sign.tb_sign_contract_issue set start_time='" +startTime +"', end_time='"+endTime+"' where id="+ issueId;
try{
jdbc.update(sql2);
}catch (SQLException e) {
logger.info("数据库更新异常");
}
} catch(ParseException px) {
px.printStackTrace();
}
}
/**
* 补签今日之前的日期
* @param actId
* @param uid
* @param num 当前所在周期内第几天
* @param isBlock 不补签昨天
* @throws Exception
*/
public void contractResign(String actId, int uid, int num, boolean isBlock) throws Exception{
//查询issueId,contractId
Response res = ContractSignService.getContracts(actId, uid);
// 接口返回的第一条信息为最近参与的记录
String issueId = res.jsonPath().getString("data.list[0].issueId");
String contractId = res.jsonPath().getString("data.list[0].contractId");
if (StringUtils.isNotBlank(issueId) && StringUtils.isNotBlank(contractId)) {
// 查询签到历史记录
String queryLog = "select sign_date from credits_sign.tb_sign_contract_log where contract_id=" + contractId;
List<Map<String, Object>> result = jdbc.findModeResult(queryLog);
String signedDate;
List<String> dateList = new ArrayList<>();
for (int i = 0; i < result.size(); i++) {
signedDate = result.get(i).get("sign_date").toString();
dateList.add(signedDate);
}
String queryBet = "select consumer_id from credits_sign.tb_sign_contract_bet where id=" + contractId;
Map<String, Object> betResult = jdbc.findSimpleResult(queryBet);
String consumerId = betResult.get("consumer_id").toString();
// 查询期次开始时间
String queryPeriod = "select start_time, end_time, contract_cycle, winners from credits_sign.tb_sign_contract_issue where id=" + issueId;
Map<String, Object> issueResult = jdbc.findSimpleResult(queryPeriod);
String startDate = issueResult.get("start_time").toString();
String endDate = issueResult.get("end_time").toString();
int cycle = Integer.valueOf(issueResult.get("contract_cycle").toString());
String winners = issueResult.get("winners").toString();
//需要打卡的日期
int period = num;
int flag = 0;
if (num > cycle) {
period = cycle + 1;
}
if (isBlock && result.size() == 0) {
flag = 1;
}
List<String> signDateList = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date startTime = sdf.parse(startDate);
Calendar calendar = Calendar.getInstance();
calendar.setTime(startTime);
String signDate;
for (int i = 1; i < period - flag; i++) {
signDate = sdf.format(calendar.getTime());
if (!dateList.contains(signDate)) {
signDateList.add(signDate);
}
calendar.add(Calendar.DAY_OF_YEAR, 1);
}
String updateBet;
String updateLog;
if (num <= cycle) {
updateBet = "update credits_sign.tb_sign_contract_bet set done_days=" + String.valueOf(num - 1 - flag) + " where id=" + contractId;
try {
jdbc.update(updateBet);
if (signDateList.size() > 0) {
for (int i = 0; i < signDateList.size(); i++) {
updateLog = String.format("INSERT INTO credits_sign.tb_sign_contract_log(consumer_id, contract_id, act_id, issue_id, sign_date) VALUES (%s, %s, %s, %s, \'%s\')", consumerId, contractId, actId, issueId, signDateList.get(i));
jdbc.update(updateLog);
logger.info("补签成功");
}
}
} catch (SQLException e) {
logger.info("数据库更新异常");
}
}
}else{
logger.info("未执行补签");
}
}
}
package http.cases.SignTest;
import base.DuibaTestBase;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.hd.SigninService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.Test;
import io.restassured.response.Response;
import java.net.SocketImpl;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import utils.RedisUtil;
import static io.restassured.RestAssured.given;
public class ContractSign_Multi_signTest extends DuibaTestBase {
@Autowired
ContractSignCommon ContractSignCommon;
@Autowired
SigninService signinService;
@Autowired
Authorization authorization;
@Autowired
http.service.Activity.ContractSignService ContractSignService;
@Autowired
ManagerService managerService;
@Value("${activity.host}")
String activityHost;
private static int uid1,uid2,uid3,uid4,uid5,uid6;
static {
uid1 = 4628;//100104096;
uid2 = 4629;//100104097
uid3 = 4630;//100104098
uid4 = 4631;//100104099
uid5 = 4632;//100104101
uid6 = 4633;//100104100
}
private static String actId,betAmount1,betAmount2,betAmount3;
static {
actId = "5";
betAmount1 = "1000";
betAmount2 = "500";
betAmount3 = "100";
}
private String issueId;
private String period;
private String contractId1,contractId2,contractId3,contractId4,contractId5,contractId6;
//@Test(description = "契约签到多梯度报名,活动id=5",priority = 1)
public void 多梯度报名() throws Exception{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat format2 = new SimpleDateFormat("MMdd");
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_YEAR, 1);
date = calendar.getTime();
// 期次开始的时间 yyyy-MM-dd格式
String startTime = format.format(date);
// 期次号 MMDD格式
period = format2.format(date);
calendar.add(Calendar.DAY_OF_YEAR, 6);
date = calendar.getTime();
// 期次结束时间
String endTime = format.format(date);
// uid1 uid2 报名梯度1
Map<String, String> map1 = ContractSignCommon.doJoinResult(actId,betAmount1,uid1);
issueId = map1.get("issueId");
String doneStatus = map1.get("doneStatus");
Assert.assertEquals(doneStatus,"DOING","uid1报名失败:" + doneStatus);
Map<String, String> map2 = ContractSignCommon.doJoinResult(actId,betAmount1,uid2);
doneStatus = map2.get("doneStatus");
Assert.assertEquals(doneStatus,"DOING","uid2报名失败:" + doneStatus);
// uid3 uid4 报名梯度2
Map<String, String> map3 = ContractSignCommon.doJoinResult(actId,betAmount2,uid3);
doneStatus = map3.get("doneStatus");
Assert.assertEquals(doneStatus,"DOING","uid3报名失败:" + doneStatus);
Map<String, String> map4 = ContractSignCommon.doJoinResult(actId,betAmount2,uid4);
doneStatus = map4.get("doneStatusDesc");
Assert.assertEquals(doneStatus,"DOING","uid4报名失败:" + doneStatus);
//uid5 uid6 报名梯度3
Map<String, String> map5 = ContractSignCommon.doJoinResult(actId,betAmount3,uid5);
doneStatus = map5.get("doneStatusDesc");
Assert.assertEquals(doneStatus,"DOING","uid5报名失败:" + doneStatus);
Map<String, String> map6 = ContractSignCommon.doJoinResult(actId,betAmount3,uid6);
doneStatus = map6.get("doneStatusDesc");
Assert.assertEquals(doneStatus,"DOING","uid6报名失败:" + doneStatus);
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
homeInfoRes.prettyPrint();
String betCount = homeInfoRes.jsonPath().getString("data.betCount");
Assert.assertEquals(betCount, betAmount1, "uid1报名额度显示不正确");
int buyers = homeInfoRes.jsonPath().getInt("data.buyers");
Assert.assertEquals(buyers, 6, "报名后的总人数不正确");
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period, "参与期次号不正确");
String currentPeriod = homeInfoRes.jsonPath().getString("data.currentPeriod");
Assert.assertEquals(currentPeriod, "0", "当前期次进度不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "2", "当前参与状态不正确");
String bankerBonus = homeInfoRes.jsonPath().getString("data.bankerBonus");
Assert.assertEquals(bankerBonus, "10000", "保底奖池数量不正确");
int totalCount = homeInfoRes.jsonPath().getInt("data.betTotalCount");
Assert.assertEquals(totalCount, 13200, "报名后总奖池数量不正确");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid3);
betCount = homeInfoRes.jsonPath().getString("data.betCount");
Assert.assertEquals(betCount,betAmount2,"uid3报名额度显示不正确");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid5);
betCount = homeInfoRes.jsonPath().getString("data.betCount");
Assert.assertEquals(betCount, betAmount3, "uid5报名额度显示不正确");
}
//@Test(description = "多梯度签到,uid1,uid3,uid5, 活动ID=5", priority = 2)
public void 多梯度签到() throws Exception{
//修改期次,今日为打卡第一天
ContractSignCommon.modifyIssuePeriod(issueId, -1);
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MMdd");
SimpleDateFormat sdf2 = new SimpleDateFormat("yy-MM-dd");
period = sdf.format(now);
String today = sdf2.format(now);
// uid1打卡前请求homeInfo接口
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
String currentPeriod = homeInfoRes.jsonPath().getString("data.currentPeriod");
Assert.assertEquals(currentPeriod,"1","当前非打卡第一天");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "3", "未打卡前打卡状态不正确");
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period, "期次号不正确");
int rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 1320, "未打卡前瓜分比例不正确");
//uid1打卡
Response signRes = ContractSignService.doSign("2", uid1);
String success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "打卡失败");
//查询redis打卡金额
String K030= String.format("SIGNCENTER_K030_%s_%s", issueId, today);
int value = Integer.valueOf(RedisUtil.getKey(K030));
Assert.assertEquals(value, 1000, "当前打卡奖池总额不正确");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 1320, "未打卡前瓜分比例不正确");
String daySuccCount = homeInfoRes.jsonPath().getString("data.daySuccCount");
Assert.assertEquals(daySuccCount, "1", "打卡后,打卡成功人数不正确");
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "4", "打卡完成后状态不正确");
// uid3打卡前请求homeInfo接口
homeInfoRes = ContractSignService.getHomeInfo(actId, uid3);
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "3", "未打卡前打卡状态不正确");
rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 880, "打卡后瓜分比例不正确");
//uid3打卡
signRes = ContractSignService.doSign("2", uid3);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "打卡失败");
value = Integer.valueOf(RedisUtil.getKey(K030));
Assert.assertEquals(value, 1500, "当前打卡奖池总额不正确");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid3);
rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 880, "打卡后前瓜分比例不正确");
daySuccCount = homeInfoRes.jsonPath().getString("data.daySuccCount");
Assert.assertEquals(daySuccCount, "2", "打卡后,打卡成功人数不正确");
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "4", "打卡完成后状态不正确");
// uid5打卡前请求homeInfo接口
homeInfoRes = ContractSignService.getHomeInfo(actId, uid5);
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "3", "未打卡前打卡状态不正确");
rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 825, "打卡后瓜分比例不正确");
//uid5打卡
signRes = ContractSignService.doSign("2", uid5);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "打卡失败");
value = Integer.valueOf(RedisUtil.getKey(K030));
Assert.assertEquals(value, 1600, "当前打卡奖池总额不正确");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid5);
rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 825, "打卡后前瓜分比例不正确");
daySuccCount = homeInfoRes.jsonPath().getString("data.daySuccCount");
Assert.assertEquals(daySuccCount, "3", "打卡后,打卡成功人数不正确");
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "4", "打卡完成后状态不正确");
}
//@Test(description = "多梯度完成打卡",priority = 3)
public void 多梯度完成打卡() throws Exception{
//修改期次,周期再往前移6天
ContractSignCommon.modifyIssuePeriod(actId, -6);
//补签前6天
ContractSignCommon.contractResign(actId, uid2, 7, false);
ContractSignCommon.contractResign(actId, uid4, 7, false);
ContractSignCommon.contractResign(actId, uid6, 7, false);
//今日打卡
Response signRes = ContractSignService.doSign(actId, uid2);
String success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid2第7日打卡失败");
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid2);
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "完成7日打卡状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
String hasRewardTomorrow = homeInfoRes.jsonPath().getString("data.hasRewardTomorrow");
Assert.assertEquals(hasReward, "false", "uid2是否有奖励状态不正确");
Assert.assertEquals(hasRewardTomorrow, "true", "uid2明日是否有奖励状态不正确");
Response recordRes = ContractSignService.getContracts(actId, uid2);
String doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "DONE", "uid2参与记录中完成状态不正确");
signRes = ContractSignService.doSign(actId, uid4);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid4第7日打卡失败");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid4);
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "完成7日打卡状态不正确");
hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
hasRewardTomorrow = homeInfoRes.jsonPath().getString("data.hasRewardTomorrow");
Assert.assertEquals(hasReward, "false", "uid4是否有奖励状态不正确");
Assert.assertEquals(hasRewardTomorrow, "true", "uid4明日是否有奖励状态不正确");
recordRes = ContractSignService.getContracts(actId, uid2);
doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "DONE", "uid4参与记录中完成状态不正确");
signRes = ContractSignService.doSign(actId, uid6);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid6第7日打卡失败");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid6);
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "完成7日打卡状态不正确");
hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
hasRewardTomorrow = homeInfoRes.jsonPath().getString("data.hasRewardTomorrow");
Assert.assertEquals(hasReward, "false", "uid6是否有奖励状态不正确");
Assert.assertEquals(hasRewardTomorrow, "true", "uid6明日是否有奖励状态不正确");
recordRes = ContractSignService.getContracts(actId, uid2);
doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "DONE", "uid6参与记录中完成状态不正确");
int daySuccCount = homeInfoRes.jsonPath().getInt("data.daySuccCount");
Assert.assertEquals(daySuccCount, 3, "第7日打卡完成人数不正确");
int currentPeriod = homeInfoRes.jsonPath().getInt("data.currentPeriod");
Assert.assertEquals(currentPeriod, 7, "当前期次进度天数不正确");
}
//@Test(description = "开奖", priority = 4)
public void 多梯度开奖() throws Exception{
ContractSignCommon.modifyIssuePeriod(issueId, -1);
//修改redis的打卡日期键值
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd");
String today = sdf.format(now);
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
calendar.add(Calendar.DAY_OF_YEAR, -1);
String yestertoday = sdf.format(calendar.getTime());
String oldKey = String.format("SIGNCENTER_K030_%s_%s", issueId, today);
String newKey = String.format("SIGNCENTER_k030_%s_%s", issueId, yestertoday);
Map<String, String> map = new HashMap<>();
map.put("key", oldKey);
map.put("newKey", newKey);
Response response = given().params(map).get(activityHost + "/signtest/redis/renameKey");
String result = response.jsonPath().getString("success");
Assert.assertEquals(result, "true", "重命名redis键值失败");
// 查询首页信息
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid2);
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period, "参与期次号不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "当前参与状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
Assert.assertEquals(hasReward, "true", "今日是否有奖励状态不正确");
//查询uid2参与记录
Response recordRes = ContractSignService.getContracts(actId, uid2);
contractId2 = recordRes.jsonPath().getString("data.list[0].contractId");
String doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "WAIT_REWARD", "uid2当前期次完成状态不正确");
String winCount = recordRes.jsonPath().getString("data.list[0].winCount");
Assert.assertEquals(winCount, "8250", "uid2瓜分奖励金额不正确");
//查询uid4参与记录
recordRes = ContractSignService.getContracts(actId, uid4);
contractId4 = recordRes.jsonPath().getString("data.list[0].contractId");
doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "WAIT_REWARD", "uid4当前期次完成状态不正确");
winCount = recordRes.jsonPath().getString("data.list[0].winCount");
Assert.assertEquals(winCount, "4125", "uid4瓜分奖励金额不正确");
//查询uid6参与记录
recordRes = ContractSignService.getContracts(actId, uid6);
contractId6 = recordRes.jsonPath().getString("data.list[0].contractId");
doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "WAIT_REWARD", "uid6当前期次完成状态不正确");
winCount = recordRes.jsonPath().getString("data.list[0].winCount");
Assert.assertEquals(winCount, "825", "uid6瓜分奖励金额不正确");
}
//@Test(description = "多梯度断签",priority = 5)
public void 多梯度断签() throws Exception{
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period, "参与期次号不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "4", "当前参与状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
Assert.assertEquals(hasReward, "false", "今日是否有奖励状态不正确");
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
calendar.add(Calendar.DAY_OF_YEAR, -7);
String startTime = sdf.format(calendar.getTime());
String failDate = homeInfoRes.jsonPath().getString("data.failDate");
// todo del
logger.info(failDate);
Assert.assertEquals(failDate,startTime,"uid1断签日期不正确");
}
//@Test(description = "多梯度领奖",priority = 6)
public void 多梯度领奖() throws Exception{
//uid2领奖
Response rewardRes = ContractSignService.getReward(contractId2,uid2);
int rewardCount = rewardRes.jsonPath().getInt("data");
Assert.assertEquals(rewardCount, 8250, "uid2领取奖励数不正确");
// uid4领奖
rewardRes = ContractSignService.getReward(contractId4,uid4);
rewardCount = rewardRes.jsonPath().getInt("data");
Assert.assertEquals(rewardCount, 4125, "uid4领取奖励数不正确");
// uid6领奖
rewardRes = ContractSignService.getReward(contractId6,uid6);
rewardCount = rewardRes.jsonPath().getInt("data");
Assert.assertEquals(rewardCount, 825, "uid6领取奖励数不正确");
//断签用户uid1领奖
Map<String, String> map = new HashMap<>();
map.put("contractId", contractId1);
rewardRes = given().cookies(authorization.dafuwengLogin(uid1)).params(map).post(activityHost+"/sign/contract/getReward");
String success = rewardRes.jsonPath().getString("success");
String desc = rewardRes.jsonPath().getString("desc");
Assert.assertEquals(success, "false", "uid1领取结果不正确");
Assert.assertEquals(desc,"领奖处理失败","uid1领取描述不正确");
}
//@Test(description = "多梯度中奖轮播",priority = 7)
public void 多梯度中奖轮播() throws Exception{
//删除redis key
String carouselKey = String.format("SIGNCENTER_K034_%s_%s", actId, issueId);
Map<String, String> keyMap = new HashMap<>();
keyMap.put("key", carouselKey);
Response redisResponse = given().params(keyMap).get(activityHost + "/signtest/redis/delKey");
String redisResult = redisResponse.jsonPath().getString("success");
Assert.assertEquals(redisResult, "true", "删除redis键值失败");
Response CarouselRes = ContractSignService.getRewardTodayLimit200(actId,uid2);
String cid2 = CarouselRes.jsonPath().getString("data[0].consumerId");
String partnerUserId2 = CarouselRes.jsonPath().getString("data[0].uid");
String nickname2 = CarouselRes.jsonPath().getString("data[0].nickName");
String winCount2 = CarouselRes.jsonPath().getString("data[0].winCount");
Assert.assertEquals(cid2,"100104097");
Assert.assertEquals(partnerUserId2, String.valueOf(uid2));
Assert.assertEquals(nickname2, "Auto4629");
Assert.assertEquals(winCount2, "8250");
CarouselRes = ContractSignService.getRewardTodayLimit200(actId,uid4);
String cid4 = CarouselRes.jsonPath().getString("data[1].consumerId");
String partnerUserId4 = CarouselRes.jsonPath().getString("data[1].uid");
String nickname4 = CarouselRes.jsonPath().getString("data[1].nickName");
String winCount4 = CarouselRes.jsonPath().getString("data[1].winCount");
Assert.assertEquals(cid4,"100104099");
Assert.assertEquals(partnerUserId4, String.valueOf(uid4));
Assert.assertEquals(nickname4, "Auto4631");
Assert.assertEquals(winCount4, "4125");
CarouselRes = ContractSignService.getRewardTodayLimit200(actId,uid6);
String cid6 = CarouselRes.jsonPath().getString("data[2].consumerId");
String partnerUserId6 = CarouselRes.jsonPath().getString("data[2].uid");
String nickname6 = CarouselRes.jsonPath().getString("data[2].nickName");
String winCount6 = CarouselRes.jsonPath().getString("data[2].winCount");
Assert.assertEquals(cid6,"100104100");
Assert.assertEquals(partnerUserId6, String.valueOf(uid6));
Assert.assertEquals(nickname6, "Auto4633");
Assert.assertEquals(winCount6, "825");
}
}
...@@ -74,7 +74,6 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -74,7 +74,6 @@ public class ContractSign_signTest extends DuibaTestBase {
String success = doJoinRes.jsonPath().getString("success"); String success = doJoinRes.jsonPath().getString("success");
Assert.assertEquals(success, "false", "报名成功状态不正确"); Assert.assertEquals(success, "false", "报名成功状态不正确");
Assert.assertEquals(code, "200001","报名失败的错误码不正确"); Assert.assertEquals(code, "200001","报名失败的错误码不正确");
Response homeInfoRes = ContractSignService.getHomeInfo("3", uid1); Response homeInfoRes = ContractSignService.getHomeInfo("3", uid1);
String suspend = homeInfoRes.jsonPath().getString("data.suspend"); String suspend = homeInfoRes.jsonPath().getString("data.suspend");
Assert.assertEquals(suspend,"true", "活动报名截止状态不正确"); Assert.assertEquals(suspend,"true", "活动报名截止状态不正确");
...@@ -92,12 +91,39 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -92,12 +91,39 @@ public class ContractSign_signTest extends DuibaTestBase {
Assert.assertEquals(deadLine,"2018-01-01 14:00:00.0","设置报名截止时间失败"); Assert.assertEquals(deadLine,"2018-01-01 14:00:00.0","设置报名截止时间失败");
} }
@Test(description = "契约签到报名测试, 活动ID=2" ,priority = 1) @Test(description = "签到信息查询,活动ID=2",priority = 1)
public void 契约签到报名() throws Exception { public void 签到活动信息() throws Exception{
String actId = "2";
String betAmount = "1000";
SimpleDateFormat format = new SimpleDateFormat("MMdd");
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_YEAR, 1);
date = calendar.getTime();
// 期次号 MMDD格式
period = format.format(date);
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
int contractCycle = homeInfoRes.jsonPath().getInt("data.contractCycle");
Assert.assertEquals(contractCycle, 7, "周期天数不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "0", "当前参与状态不正确");
String bankerBonus = homeInfoRes.jsonPath().getString("data.bankerBonus");
Assert.assertEquals(bankerBonus, "10000", "保底奖池数量不正确");
String betCount = homeInfoRes.jsonPath().getString("data.betCount");
Assert.assertEquals(betCount,betAmount, "报名的额度不正确");
int buyers = homeInfoRes.jsonPath().getInt("data.buyers");
Assert.assertEquals(buyers, 0,"报名人数不正确");
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period, "活动期次号不正确");
}
@Test(description = "契约签到报名测试, 活动ID=2" ,priority = 2)
public void 固定额度报名() throws Exception {
String actId = "2"; String actId = "2";
String betAmount = "1000"; String betAmount = "1000";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat format2 = new SimpleDateFormat("MMdd");
Date date = new Date(); Date date = new Date();
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(date); calendar.setTime(date);
...@@ -105,8 +131,6 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -105,8 +131,6 @@ public class ContractSign_signTest extends DuibaTestBase {
date = calendar.getTime(); date = calendar.getTime();
// 期次开始的时间 yyyy-MM-dd格式 // 期次开始的时间 yyyy-MM-dd格式
String startTime = format.format(date); String startTime = format.format(date);
// 期次号 MMDD格式
period = format2.format(date);
calendar.add(Calendar.DAY_OF_YEAR, 6); calendar.add(Calendar.DAY_OF_YEAR, 6);
date = calendar.getTime(); date = calendar.getTime();
// 期次结束时间 // 期次结束时间
...@@ -130,7 +154,7 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -130,7 +154,7 @@ public class ContractSign_signTest extends DuibaTestBase {
map = this.doJoinResult(actId, betAmount, uid4); map = this.doJoinResult(actId, betAmount, uid4);
Assert.assertEquals(map.get("doneStatus"), "DOING", String.format("%d join failed, %s", uid4, doneStatusDesc)); Assert.assertEquals(map.get("doneStatus"), "DOING", String.format("%d join failed, %s", uid4, doneStatusDesc));
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1); Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
homeInfoRes.prettyPrint(); //homeInfoRes.prettyPrint();
// String joinTimeLimit = homeInfoRes.jsonPath().getString("data.joinTimeLimit"); // String joinTimeLimit = homeInfoRes.jsonPath().getString("data.joinTimeLimit");
// Assert.assertEquals(joinTimeLimit,"true", "参与时间限制校验失败"); // Assert.assertEquals(joinTimeLimit,"true", "参与时间限制校验失败");
String betCount = homeInfoRes.jsonPath().getString("data.betCount"); String betCount = homeInfoRes.jsonPath().getString("data.betCount");
...@@ -144,14 +168,13 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -144,14 +168,13 @@ public class ContractSign_signTest extends DuibaTestBase {
//0-未报名 1-报名中 2-已报名,打卡未开始 3-未打卡:打卡开始,当天未打卡 4-已打卡:当天已打卡(非最后一天) 5-失败:出现断卡(未报名新一期) 6-成功: 已成功(未报名新一期) //0-未报名 1-报名中 2-已报名,打卡未开始 3-未打卡:打卡开始,当天未打卡 4-已打卡:当天已打卡(非最后一天) 5-失败:出现断卡(未报名新一期) 6-成功: 已成功(未报名新一期)
String status = homeInfoRes.jsonPath().getString("data.status"); String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "2", "当前参与状态不正确"); Assert.assertEquals(status, "2", "当前参与状态不正确");
String bankerBonus = homeInfoRes.jsonPath().getString("data.bankerBonus");
Assert.assertEquals(bankerBonus, "10000", "保底奖池数量不正确");
int totalCount_new = Integer.valueOf(homeInfoRes.jsonPath().getString("data.betTotalCount")); int totalCount_new = Integer.valueOf(homeInfoRes.jsonPath().getString("data.betTotalCount"));
Assert.assertEquals(totalCount_new, 10000+Integer.valueOf(betAmount)*4, "报名后奖池数量不正确"); Assert.assertEquals(totalCount_new, 10000+Integer.valueOf(betAmount)*4, "报名后奖池数量不正确");
} }
@Test(description = "活动ID=2, uid1打卡", priority = 2) @Test(description = "活动ID=2, uid1打卡", priority = 3)
public void 签到打卡() throws Exception{ public void 固定额度签到打卡() throws Exception{
String actId = "2"; String actId = "2";
//修改期次,今日为打卡日 //修改期次,今日为打卡日
modifyIssuePeriod(issueId,-1); modifyIssuePeriod(issueId,-1);
...@@ -178,8 +201,8 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -178,8 +201,8 @@ public class ContractSign_signTest extends DuibaTestBase {
Assert.assertEquals(status, "4", "打卡完成后状态不正确"); Assert.assertEquals(status, "4", "打卡完成后状态不正确");
} }
@Test(description = "活动ID=2,uid2第六天断签", priority = 3) @Test(description = "活动ID=2,uid2第六天断签", priority = 4)
public void 契约签到断签() throws Exception{ public void 固定额度断签() throws Exception{
String actId = "2"; String actId = "2";
//当天为周期第一天,周期往前再挪6天 //当天为周期第一天,周期往前再挪6天
modifyIssuePeriod(issueId,-6); modifyIssuePeriod(issueId,-6);
...@@ -200,8 +223,8 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -200,8 +223,8 @@ public class ContractSign_signTest extends DuibaTestBase {
} }
@Test(description = "uid3 uid4打卡完成,活动ID=2",priority = 4) @Test(description = "uid3 uid4打卡完成,活动ID=2",priority = 5)
public void 契约签到整期打卡完成() throws Exception{ public void 固定额度_整期打卡完成() throws Exception{
String actId = "2"; String actId = "2";
//补签前6天 //补签前6天
this.contractResign(actId, uid3, 7,false); this.contractResign(actId, uid3, 7,false);
...@@ -217,34 +240,40 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -217,34 +240,40 @@ public class ContractSign_signTest extends DuibaTestBase {
logger.info("uid3七日打卡成功"); logger.info("uid3七日打卡成功");
signRes = ContractSignService.doSign("2", uid4); signRes = ContractSignService.doSign("2", uid4);
homeInfoRes = ContractSignService.getHomeInfo(actId,uid3);
success = signRes.jsonPath().getString("success"); success = signRes.jsonPath().getString("success");
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(success, "true", "uid4打卡失败"); Assert.assertEquals(success, "true", "uid4打卡失败");
Assert.assertEquals(status,"6","完成7日打卡状态不正确");
logger.info("uid4七日打卡成功"); logger.info("uid4七日打卡成功");
homeInfoRes = ContractSignService.getHomeInfo(actId,uid4);
homeInfoRes.prettyPrint();
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status,"6","完成7日打卡状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
String hasRewardTomorrow = homeInfoRes.jsonPath().getString("data.hasRewardTomorrow");
Assert.assertEquals(hasReward, "false", "是否有带领取奖励不正确");
Assert.assertEquals(hasRewardTomorrow, "true", "明日是否有奖励状态不正确");
} }
@Test(description = "开奖,活动ID=2",priority = 5) @Test(description = "开奖,活动ID=2",priority = 6)
public void 契约开奖() throws Exception{ public void 契约开奖_固定额度() throws Exception{
modifyIssuePeriod(issueId, -1); modifyIssuePeriod(issueId, -1);
//修改redis的打卡日期键值 //修改redis的打卡日期键值
String actId = "2"; String actId = "2";
Date now = new Date(); // Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd"); // SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd");
String today = sdf.format(now); // String today = sdf.format(now);
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.setTime(now); // calendar.setTime(now);
calendar.add(Calendar.DAY_OF_YEAR, -1); // calendar.add(Calendar.DAY_OF_YEAR, -1);
String yestertoday = sdf.format(calendar.getTime()); // String yestertoday = sdf.format(calendar.getTime());
String oldKey = String.format("SIGNCENTER_K030_%s_%s", issueId, today); // String oldKey = String.format("SIGNCENTER_K030_%s_%s", issueId, today);
String newKey = String.format("SIGNCENTER_k030_%s_%s", issueId, yestertoday); // String newKey = String.format("SIGNCENTER_k030_%s_%s", issueId, yestertoday);
Map<String, String> map = new HashMap<>(); // Map<String, String> map = new HashMap<>();
map.put("key", oldKey); // map.put("key", oldKey);
map.put("newKey", newKey); // map.put("newKey", newKey);
Response response = given().params(map).get(activityHost + "/signtest/redis/renameKey"); // Response response = given().params(map).get(activityHost + "/signtest/redis/renameKey");
String result = response.jsonPath().getString("success"); // String result = response.jsonPath().getString("success");
Assert.assertEquals(result, "true", "重命名redis键值失败"); // Assert.assertEquals(result, "true", "重命名redis键值失败");
// 查询下期是否开始 // 查询下期是否开始
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid3); Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid3);
...@@ -253,6 +282,8 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -253,6 +282,8 @@ public class ContractSign_signTest extends DuibaTestBase {
Assert.assertEquals(periodShow, period, "参与期次号不正确"); Assert.assertEquals(periodShow, period, "参与期次号不正确");
String status = homeInfoRes.jsonPath().getString("data.status"); String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "当前参与状态不正确"); Assert.assertEquals(status, "6", "当前参与状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
Assert.assertEquals(hasReward, "true", "今日是否有奖励状态不正确");
// 查询参与记录 // 查询参与记录
Response recordRes = ContractSignService.getContracts(actId, uid3); Response recordRes = ContractSignService.getContracts(actId, uid3);
String contractId = recordRes.jsonPath().getString("data.list[0].contractId"); String contractId = recordRes.jsonPath().getString("data.list[0].contractId");
...@@ -279,7 +310,7 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -279,7 +310,7 @@ public class ContractSign_signTest extends DuibaTestBase {
ContractSignService.getReward(contractId,uid4); ContractSignService.getReward(contractId,uid4);
} }
@Test(description = "打卡/收益排行榜,活动ID=2",priority = 6) @Test(description = "打卡/收益排行榜,活动ID=2",priority = 7)
public void 参与记录() throws Exception{ public void 参与记录() throws Exception{
// 查询断签用户参与记录 // 查询断签用户参与记录
Response recordRes = ContractSignService.getContracts("2", uid2); Response recordRes = ContractSignService.getContracts("2", uid2);
...@@ -313,7 +344,7 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -313,7 +344,7 @@ public class ContractSign_signTest extends DuibaTestBase {
Assert.assertEquals(totalProfit, 7000,"累计收益不正确"); Assert.assertEquals(totalProfit, 7000,"累计收益不正确");
} }
@Test(description = "打卡/收益排行榜,活动ID=2",priority = 7) @Test(description = "打卡/收益排行榜,活动ID=2",priority = 8)
public void 排行榜() throws Exception{ public void 排行榜() throws Exception{
String actId = "2"; String actId = "2";
//查询签到次数排行榜 //查询签到次数排行榜
...@@ -348,8 +379,8 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -348,8 +379,8 @@ public class ContractSign_signTest extends DuibaTestBase {
Assert.assertEquals(nickName2,"Auto3720","用户名不正确"); Assert.assertEquals(nickName2,"Auto3720","用户名不正确");
} }
@Test(description = "中奖轮播",priority = 8) @Test(description = "中奖轮播",priority = 9)
public void 中奖轮播() throws Exception{ public void 中奖轮播_固定额度() throws Exception{
//删除redis key //删除redis key
// Map<String, String> carouselMap = new HashMap<>(); // Map<String, String> carouselMap = new HashMap<>();
// carouselMap.put("key", ); // carouselMap.put("key", );
...@@ -415,7 +446,7 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -415,7 +446,7 @@ public class ContractSign_signTest extends DuibaTestBase {
} }
} }
private void modifyJoinTime(String actId, String date, String startTime, String endTime) throws Exception{ public void modifyJoinTime(String actId, String date, String startTime, String endTime) throws Exception{
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("title", "自动化_报名截止时间"); map.put("title", "自动化_报名截止时间");
map.put("betCount", "1000"); map.put("betCount", "1000");
...@@ -438,7 +469,7 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -438,7 +469,7 @@ public class ContractSign_signTest extends DuibaTestBase {
map.put("openType", "0"); map.put("openType", "0");
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(map)); JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(map));
Response response = given().contentType("application/json;charset=UTF-8").cookies(authorization.ssoLogin()).body(jsonObject).post("https://mng.duibatest.com.cn/newmanager/signContract/save"); Response response = given().contentType("application/json;charset=UTF-8").cookies(authorization.ssoLogin()).body(jsonObject).post("https://mng.duibatest.com.cn/newmanager/signContract/save");
response.prettyPrint(); //response.prettyPrint();
try { try {
Assert.assertEquals(response.jsonPath().getString("success"), "true", "/signContract/save接口失败"); Assert.assertEquals(response.jsonPath().getString("success"), "true", "/signContract/save接口失败");
} catch (Exception e) { } catch (Exception e) {
......
...@@ -61,13 +61,15 @@ public class 周期签到测试_signTest extends DuibaTestBase { ...@@ -61,13 +61,15 @@ public class 周期签到测试_signTest extends DuibaTestBase {
// } // }
@Test(description = "活动id:79,规则:周期2天,签到第3天循环第一天奖励,加一次抽奖机会,加10积分") //@Test(description = "活动id:79,规则:周期2天,签到第3天循环第一天奖励,加一次抽奖机会,加10积分")
public void 周期签到测试() throws Exception { public void 周期签到测试() throws Exception {
logger.info("Current Thread Id: " + Thread.currentThread().getId()); logger.info("Current Thread Id: " + Thread.currentThread().getId());
//补签前天,凑足连续签到2天 //补签前天,凑足连续签到2天
Response response_1 = this.resign("79",-2); Response response_1 = this.resign("79",-2);
Thread.sleep(1000);
Response response_2 = this.resign("79",-1); Response response_2 = this.resign("79",-1);
// response_2.prettyPrint(); response_1.prettyPrint();
response_2.prettyPrint();
//当日签到之前插件信息查询 //当日签到之前插件信息查询
Response response_plug = activityPlugDrawInfoService.getPrizeInfo(map,"1179"); Response response_plug = activityPlugDrawInfoService.getPrizeInfo(map,"1179");
...@@ -97,6 +99,7 @@ public class 周期签到测试_signTest extends DuibaTestBase { ...@@ -97,6 +99,7 @@ public class 周期签到测试_signTest extends DuibaTestBase {
String lastDays = response.jsonPath().getString("signInfoVO.lastDays");//连续签到天数 String lastDays = response.jsonPath().getString("signInfoVO.lastDays");//连续签到天数
String todaySigned = response.jsonPath().getString("signInfoVO.todaySigned"); //今日是否签到 String todaySigned = response.jsonPath().getString("signInfoVO.todaySigned"); //今日是否签到
response.prettyPrint();
Assert.assertEquals(acmDay,"2","历史累积签到次数不正确"); Assert.assertEquals(acmDay,"2","历史累积签到次数不正确");
Assert.assertEquals(acmDays,"2","周期内累计签到天数不正确"); Assert.assertEquals(acmDays,"2","周期内累计签到天数不正确");
Assert.assertEquals(activityCount,"1","今日奖励抽奖次数不正确"); Assert.assertEquals(activityCount,"1","今日奖励抽奖次数不正确");
......
...@@ -265,6 +265,7 @@ public class 补签测试_signTest extends DuibaTestBase { ...@@ -265,6 +265,7 @@ public class 补签测试_signTest extends DuibaTestBase {
map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward", "{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("fullSignReward", "{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
...@@ -318,6 +319,7 @@ public class 补签测试_signTest extends DuibaTestBase { ...@@ -318,6 +319,7 @@ public class 补签测试_signTest extends DuibaTestBase {
map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
...@@ -366,6 +368,7 @@ public class 补签测试_signTest extends DuibaTestBase { ...@@ -366,6 +368,7 @@ public class 补签测试_signTest extends DuibaTestBase {
map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
......
...@@ -30,7 +30,7 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{ ...@@ -30,7 +30,7 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
//指定用户 //指定用户
private static int uid = 4689; private static int uid = 4689;
private static int uid2 = 4552; private static int uid2 = 4552;
private static int uid3 = 3590; private static int uid3 = 4793;
private static int uid4 = 4386; private static int uid4 = 4386;
@Test @Test
public void 出券衰减开关校验_() throws Exception { public void 出券衰减开关校验_() throws Exception {
...@@ -108,13 +108,11 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{ ...@@ -108,13 +108,11 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
//dafuweng登陆获取cookies //dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid4); Map cookies = authorization.dafuwengLogin(uid4);
//调用种植seed //调用种植seed
Response response = seedRedPacketService.seed(cookies,"1","424","1"); Response response = seedRedPacketService.seed(cookies,"6","424","1");
//种子号 //种子号
String orderId = response.jsonPath().getString("data.orderNum"); String orderId = response.jsonPath().getString("data.orderNum");
Assert.assertNotNull(orderId,"订单号为空"); Assert.assertNotNull(orderId,"订单号为空");
logger.info("红包订单为:"+orderId); logger.info("红包订单为:"+orderId);
//红包衰减
Thread.sleep(65000);
//获取种植结果状态getOrderStatus,异步接口,while循环,status为2处理完成,1处理中 //获取种植结果状态getOrderStatus,异步接口,while循环,status为2处理完成,1处理中
response = seedRedPacketService.getOrderStatus(cookies,orderId); response = seedRedPacketService.getOrderStatus(cookies,orderId);
String status = response.jsonPath().getString("data"); String status = response.jsonPath().getString("data");
...@@ -125,7 +123,9 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{ ...@@ -125,7 +123,9 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
i--; i--;
} }
//获取种植获得金额 //获取种植获得金额
response = seedRedPacketService.reap(cookies,"1",orderId); //红包衰减
Thread.sleep(70000);
response = seedRedPacketService.reap(cookies,"6",orderId);
response.prettyPrint(); response.prettyPrint();
String isDecr = response.jsonPath().getString("data.isDecr"); String isDecr = response.jsonPath().getString("data.isDecr");
Assert.assertEquals(isDecr,"true","红包衰减标识校验失败"); Assert.assertEquals(isDecr,"true","红包衰减标识校验失败");
......
...@@ -108,11 +108,12 @@ public class 账户余额清零_AccessTest extends DuibaTestBase { ...@@ -108,11 +108,12 @@ public class 账户余额清零_AccessTest extends DuibaTestBase {
//获取最新的提现记录 //获取最新的提现记录
Thread.sleep(3000);
Map cookies = authorization.dafuwengLogin(uid); Map cookies = authorization.dafuwengLogin(uid);
Response response = walletAccountService.walletDetail(cookies); Response response = walletAccountService.walletDetail(cookies);
String money = response.jsonPath().getString("data[1].money"); String money = response.jsonPath().getString("data[0].money");
String subType = response.jsonPath().getString("data[1].subType"); String subType = response.jsonPath().getString("data[0].subType");
String description = response.jsonPath().getString("data[1].description"); String description = response.jsonPath().getString("data[0].description");
Assert.assertTrue(new BigDecimal(money).compareTo(new BigDecimal("100"))==0,"扣款金额校验失败"); Assert.assertTrue(new BigDecimal(money).compareTo(new BigDecimal("100"))==0,"扣款金额校验失败");
Assert.assertEquals(subType, "0", "日志类型校验失败"); Assert.assertEquals(subType, "0", "日志类型校验失败");
......
...@@ -42,10 +42,10 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -42,10 +42,10 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
//指定用户 //指定用户
private static int uid = 4459; private static int uid = 4459;
private static String consumerId = "100098000"; private static String consumerId = "100098000";
private static int uid2 = 4460; private static int uid2 = 4822;
private static String consumerId2 = "100098001"; private static String consumerId2 = "100108125";
private static int uid3 = 4461; private static int uid3 = 4793;
private static String consumerId3 = "100098002"; private static String consumerId3 = "100108076";
private static int uid4 = 4474; private static int uid4 = 4474;
private static String consumerId4 = "100098031"; private static String consumerId4 = "100098031";
@AfterClass @AfterClass
...@@ -103,9 +103,11 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -103,9 +103,11 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
@Test @Test
public void 提现账号已使用() throws Exception { public void 提现账号已使用() throws Exception {
//修改账户过期时间,确保账户余额不会过期清零
jdbc.update("update consumer_account_log.tb_expire_consumer_account set gmt_modified ='"+getTime(1)+"' where account_id = '"+consumerId2+"_6_0'");
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0977 where account_id = '"+consumerId2+"_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0861 where account_id = '"+consumerId2+"_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -119,7 +121,7 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -119,7 +121,7 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
Assert.assertEquals(response.jsonPath().getString("message"),"一个支付宝账户仅允许一个账户提现","/walletAccount/doTakePrize接口失败"); Assert.assertEquals(response.jsonPath().getString("message"),"一个支付宝账户仅允许一个账户提现","/walletAccount/doTakePrize接口失败");
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0977 where account_id = '"+consumerId2+"_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0861 where account_id = '"+consumerId2+"_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
...@@ -132,7 +134,7 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -132,7 +134,7 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
public void 开发者账户余额不足() throws Exception { public void 开发者账户余额不足() throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0978 where account_id = '"+consumerId3+"_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0812 where account_id = '"+consumerId3+"_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -147,14 +149,14 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -147,14 +149,14 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
Assert.assertEquals(response.jsonPath().getString("message"),"扣app余额失败","/walletAccount/doTakePrize接口失败"); Assert.assertEquals(response.jsonPath().getString("message"),"扣app余额失败","/walletAccount/doTakePrize接口失败");
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0978 where account_id = '"+consumerId3+"_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0812 where account_id = '"+consumerId3+"_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败"); Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败");
logger.info("用户账户余额校验成功"); logger.info("用户账户余额校验成功");
this.checkRecord(uid3,"0.01"); this.checkRecord(uid3,"100");
} }
@Test @Test
...@@ -239,12 +241,21 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -239,12 +241,21 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
String description1 = response.jsonPath().getString("data[1].description"); String description1 = response.jsonPath().getString("data[1].description");
String subType1 = response.jsonPath().getString("data[1].subType"); String subType1 = response.jsonPath().getString("data[1].subType");
if(subType.equals("0")){
Assert.assertEquals(money,Exmoney,"扣款金额校验失败"); Assert.assertEquals(money,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description,"提现","明细描述失败"); Assert.assertEquals(description,"提现","明细描述失败");
Assert.assertEquals(subType,"0","日志类型校验失败"); }else{
Assert.assertEquals(money,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description,"提现 - 返还","明细描述失败");
}
if(subType1.equals("0")){
Assert.assertEquals(money1,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description1,"提现","明细描述失败");
}else{
Assert.assertEquals(money1,Exmoney,"扣款金额校验失败"); Assert.assertEquals(money1,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description1,"提现 - 返还","明细描述失败"); Assert.assertEquals(description1,"提现 - 返还","明细描述失败");
Assert.assertEquals(subType1,"1","日志类型校验失败"); }
logger.info("账户余额明细校验成功"); logger.info("账户余额明细校验成功");
} }
......
...@@ -38,8 +38,8 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -38,8 +38,8 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
HbaseService hbaseService; HbaseService hbaseService;
private DuibaLog logger = DuibaLog.getLogger(); private DuibaLog logger = DuibaLog.getLogger();
//指定用户 //指定用户
private static int uid = 4244; private static int uid = 4823;
private static String consumerId = "100092758"; private static String consumerId = "100108126";
private static String orderId; private static String orderId;
@AfterClass @AfterClass
public void afterclass() { public void afterclass() {
...@@ -77,7 +77,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -77,7 +77,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
public void a_提现失败_账户错误(int caseNum,String alipay,String realname) throws Exception { public void a_提现失败_账户错误(int caseNum,String alipay,String realname) throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -101,7 +101,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -101,7 +101,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
} }
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
...@@ -113,7 +113,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -113,7 +113,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
public void b_正常提现() throws Exception { public void b_正常提现() throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
balance = balance - 1; balance = balance - 1;
...@@ -123,7 +123,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -123,7 +123,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
this.账户提现(cookies,"peeulk6392@sandbox.com","沙箱环境"); this.账户提现(cookies,"peeulk6392@sandbox.com","沙箱环境");
Thread.sleep(2000); Thread.sleep(2000);
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败"); Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败");
...@@ -169,7 +169,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -169,7 +169,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
public void d_提现失败_登录次数不足() throws Exception { public void d_提现失败_登录次数不足() throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -183,7 +183,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -183,7 +183,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
Assert.assertEquals(response.jsonPath().getString("message"),"连续登录天数不足","/walletAccount/doTakePrize接口失败"); Assert.assertEquals(response.jsonPath().getString("message"),"连续登录天数不足","/walletAccount/doTakePrize接口失败");
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
......
...@@ -68,6 +68,26 @@ public class NewActivityService { ...@@ -68,6 +68,26 @@ public class NewActivityService {
map.put("oaId",activityId); map.put("oaId",activityId);
logger.info("请求/hdtool/doJoin接口,activityId="+activityId); logger.info("请求/hdtool/doJoin接口,activityId="+activityId);
logger.info("url:"+url+"/hdtool/doJoin");
Response response = given().cookies(cookies).params(map).post(url+"/hdtool/doJoin");
try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200");
logger.info("/hdtool/doJoin接口成功,返回信息:"+response.asString());
}catch(Exception e){
throw new Exception("/hdtool/doJoin接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/hdtool/doJoin接口失败,返回信息:"+response.asString());
}
return response;
}
public Response doJoinMap(Map cookies, String token,String activityId) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("token",token);
map.put("activityId",activityId);
map.put("oaId",activityId);
logger.info("请求/hdtool/doJoin接口,activityId="+activityId);
logger.info("url:"+url+"/hdtool/doJoin");
Response response = given().cookies(cookies).params(map).post(url+"/hdtool/doJoin"); Response response = given().cookies(cookies).params(map).post(url+"/hdtool/doJoin");
try{ try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200"); Assert.assertEquals(String.valueOf(response.getStatusCode()),"200");
......
...@@ -164,6 +164,7 @@ public class SignactivityService { ...@@ -164,6 +164,7 @@ public class SignactivityService {
map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":1154,\"items\":[{\"days\":2,\"credits\":10,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":1154,\"items\":[{\"days\":2,\"credits\":10,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}"); map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+hdHost+"/signin/configEdit"); Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+hdHost+"/signin/configEdit");
......
...@@ -167,6 +167,9 @@ public class Authorization { ...@@ -167,6 +167,9 @@ public class Authorization {
String url=tool.buildUrlWithSign("http://activity.m.duibatest.com.cn/autoLogin/autologin?",params); String url=tool.buildUrlWithSign("http://activity.m.duibatest.com.cn/autoLogin/autologin?",params);
logger.info("dafuweng免登陆url为:"+url); logger.info("dafuweng免登陆url为:"+url);
Response response=given().redirects().follow(false).get(url); Response response=given().redirects().follow(false).get(url);
logger.info("dafuweng免登陆,响应数据:"+response.asString());
logger.info("dafuweng免登陆,响应状态码:"+response.getStatusCode());
return response; return response;
} }
public Map generateSignAutoLogin(String appKey, int uid){ public Map generateSignAutoLogin(String appKey, int uid){
......
...@@ -142,6 +142,7 @@ public class SignService { ...@@ -142,6 +142,7 @@ public class SignService {
map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}"); map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}"); map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":100,\"activityCount\":100}],\"plSkinOpen2Dev\":true,\"open\":true}"); map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":100,\"activityCount\":100}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("firstSignReward","[]"); map.put("firstSignReward","[]");
......
...@@ -915,7 +915,7 @@ public class DeveloperService { ...@@ -915,7 +915,7 @@ public class DeveloperService {
} }
//创建自有活动工具-所有字段 //保存自有活动工具-所有字段
public Response saveHdAll(String id,String creditsType,String title,String limitCount,String limitScope,String freeLimit,String freeScope,String awards,String bannerImgNew) throws Exception { public Response saveHdAll(String id,String creditsType,String title,String limitCount,String limitScope,String freeLimit,String freeScope,String awards,String bannerImgNew) throws Exception {
String url=hdHost+"/launch/save"; String url=hdHost+"/launch/save";
...@@ -976,7 +976,7 @@ public class DeveloperService { ...@@ -976,7 +976,7 @@ public class DeveloperService {
return response; return response;
} }
//创建保存自有单品抽奖 //保存自有单品抽奖--所有字段
public Response saveDpAll(String id,String title,String mainAppItemId,String appItemTitle,String appItemType, String mainAppItemRemaining,String freeDrawLimit,String freeDrawLimitScope,String bannerImgNew,String vipLimitType,String vipLimits,String exchangeLimit) throws Exception { public Response saveDpAll(String id,String title,String mainAppItemId,String appItemTitle,String appItemType, String mainAppItemRemaining,String freeDrawLimit,String freeDrawLimitScope,String bannerImgNew,String vipLimitType,String vipLimits,String exchangeLimit) throws Exception {
String url=hdHost+"/appSingleLottery/saveOrUpdate"; String url=hdHost+"/appSingleLottery/saveOrUpdate";
...@@ -1053,5 +1053,61 @@ public class DeveloperService { ...@@ -1053,5 +1053,61 @@ public class DeveloperService {
return response; return response;
} }
//保存自有手动开奖--所有字段
public Response saveManualLottery(String title,String consumerDrawLimit,String consumerDrawLimitScope,String freeLimit,String freeLimitScope,String bannerImgNew) throws Exception {
String url=hdHost+"/appManualLottery/create";
Map<String,String> map = new HashMap<>();
map.put("title",title);
map.put("credits","50");
map.put("bannerImage","//yun.duiba.com.cn/upload/buctmou88a.png");
map.put("smallImage","//yun.duiba.com.cn/upload/wf0u6dtq7e.png");
map.put("image","//yun.duiba.com.cn/upload/nwmcomavqu.png");
map.put("bannerImgNew",bannerImgNew);
map.put("appId","2239");
map.put("marketPrice","10");
map.put("introduction","测试奖品说明");
map.put("consumerDrawLimit",consumerDrawLimit);
map.put("consumerDrawLimitScope",consumerDrawLimitScope);
map.put("freeLimit",freeLimit);
map.put("freeLimitScope",freeLimitScope);
map.put("overDate","2020-11-01");
logger.info("请求创建自有手动开奖url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建自有手动开奖接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建自有手动开奖接口失败,返回信息:"+response.asString());
}
return response;
}
//编辑自有手动开奖
public Response editManualLottery(String manualLotteryId) throws Exception {
String url=hdHost+"/appManualLottery/edit";
Map<String,String> map = new HashMap<>();
map.put("appId","2239");
map.put("manualLotteryId",manualLotteryId);
logger.info("请求编辑自有手动开奖url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).get("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("编辑自有手动开奖接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("编辑自有手动开奖接口失败,返回信息:"+response.asString());
}
return response;
}
} }
...@@ -13,7 +13,7 @@ import static com.codeborne.selenide.Selenide.open; ...@@ -13,7 +13,7 @@ import static com.codeborne.selenide.Selenide.open;
public class 优惠券_ExchangeTest_ui extends DuibaBaseUi{ public class 优惠券_ExchangeTest_ui extends DuibaBaseUi{
@Test @Test
public void 优惠券兑换_正常流程() throws Exception { public void 优惠券兑换_正常流程() throws Exception {
open("http://47.97.214.108/user/index"); open("http://dafuweng.duibatest.com.cn/user/index");
clickByTextEqual("4762"); clickByTextEqual("4762");
switchWindow(); switchWindow();
sleep(2); sleep(2);
......
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