Commit e4e4048f by DuJunLi

解决线上报错case,优化代码

parent 0046e234
...@@ -157,7 +157,7 @@ public class ReserveTools extends XMBaseTest { ...@@ -157,7 +157,7 @@ public class ReserveTools extends XMBaseTest {
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("current",0); body.put("current",0);
body.put("size",200); body.put("size",500);
if (!courseId.equals("")){ if (!courseId.equals("")){
body.put("courseId",courseId); body.put("courseId",courseId);
} }
......
...@@ -277,6 +277,31 @@ public class CampScheduleTools extends XMBaseTest { ...@@ -277,6 +277,31 @@ public class CampScheduleTools extends XMBaseTest {
} }
/**
* 选择匹配到对应规则ID的课次
* @param n
* @param ruldId
* @return
*/
public Set<String> getCampTableDate(int n,String ruldId) {
//查看下周训练营课表
getCampScheduleTable(CommUtil.oneKeyGetNextWeekStartDay(), CommUtil.oneKeyGetNextWeekEndDay());
String date = CommUtil.oneKeyGetNextWeekXDay(n);//下周N 日期时间戳
int count = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups").size();
if (count > 0) {
JSONArray array = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups");
Set<String> scheduleIds = array.toJavaList(JSONObject.class).stream()
.filter(e -> e.getString("date").equals(date))//过滤出日期等于下周N的数据
.flatMap(e -> e.getJSONArray("timetableList").toJavaList(JSONObject.class).stream())//对过滤出的数据再次取目标数据重新组合成一个新的数据流
.filter(e ->e.getString("ruleId").equals(ruldId))
.map(e -> e.getString("scheduleId"))//获取scheduleId
.collect(Collectors.toSet());
return scheduleIds; //如果当天没排课,则scheduleIds.size()==0
}
return null;
}
......
...@@ -58,7 +58,7 @@ public class TestEditCampRuleSchedule extends SelectTargetTrainingCampAndGetInfo ...@@ -58,7 +58,7 @@ public class TestEditCampRuleSchedule extends SelectTargetTrainingCampAndGetInfo
} }
@Test(description = "编辑训练营排课规则") @Test(description = "编辑训练营排课规则")
public void testEditCampRuleSchedule() { public void testEditCampRuleSchedule() throws InterruptedException {
//获取选择的训练营ID //获取选择的训练营ID
campId = super.campId; campId = super.campId;
//获取训练营活动的指定教练ID //获取训练营活动的指定教练ID
...@@ -89,6 +89,7 @@ public class TestEditCampRuleSchedule extends SelectTargetTrainingCampAndGetInfo ...@@ -89,6 +89,7 @@ public class TestEditCampRuleSchedule extends SelectTargetTrainingCampAndGetInfo
//给会员报名 //给会员报名
trainingTools.doSignCampOrder(memberId, this.price, this.campId); trainingTools.doSignCampOrder(memberId, this.price, this.campId);
orderId = XMJSONPath.readPath(dataApi.getApi_response(), "$.result"); orderId = XMJSONPath.readPath(dataApi.getApi_response(), "$.result");
Thread.sleep(2000);
//check 预约记录(训练营预约记录,根据训练营活动筛选) //check 预约记录(训练营预约记录,根据训练营活动筛选)
JSONArray reserverList= reserveTools.getPageByStudio("","","","",null, JSONArray reserverList= reserveTools.getPageByStudio("","","","",null,
......
...@@ -80,7 +80,7 @@ public class TestGetCampScheduleItemDetail extends SelectTargetTrainingCampAndGe ...@@ -80,7 +80,7 @@ public class TestGetCampScheduleItemDetail extends SelectTargetTrainingCampAndGe
ruldId = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").getJSONObject(0).getString("ruleId"); ruldId = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").getJSONObject(0).getString("ruleId");
//查看下周5的日课表,期望值无数据 //查看下周5的日课表,期望值无数据
Set<String> scheduleIds5 = campScheduleTools.getCampTableDate(11); Set<String> scheduleIds5 = campScheduleTools.getCampTableDate(11,ruldId);
Assert.assertTrue(scheduleIds5.size() == 0 || scheduleIds5 == null, "周五没排课,但是检查出有课次"); Assert.assertTrue(scheduleIds5.size() == 0 || scheduleIds5 == null, "周五没排课,但是检查出有课次");
//查看下周日的日课表,有数据,并查看课次详情 //查看下周日的日课表,有数据,并查看课次详情
......
...@@ -53,7 +53,7 @@ public class TestCreateGroupRuleSchedule extends BaseTestImpl { ...@@ -53,7 +53,7 @@ public class TestCreateGroupRuleSchedule extends BaseTestImpl {
} }
@Test(description = "测试新建团课排课") @Test(description = "测试新建团课排课")
public void testCreateGroupRuleSchedule() { public void testCreateGroupRuleSchedule() throws InterruptedException {
//查询今日待上课的数据 //查询今日待上课的数据
HomeTools homeTools = new HomeTools(); HomeTools homeTools = new HomeTools();
int num = homeTools.queryTodaySchedule().getJSONArray("result").size(); int num = homeTools.queryTodaySchedule().getJSONArray("result").size();
...@@ -91,6 +91,7 @@ public class TestCreateGroupRuleSchedule extends BaseTestImpl { ...@@ -91,6 +91,7 @@ public class TestCreateGroupRuleSchedule extends BaseTestImpl {
int size = result.size(); int size = result.size();
String ruldId = XMJSONPath.readPath(result.getJSONObject(0), "$.ruleId"); String ruldId = XMJSONPath.readPath(result.getJSONObject(0), "$.ruleId");
groupScheduleTools.delGroupRuleSchedule(ruldId,true); groupScheduleTools.delGroupRuleSchedule(ruldId,true);
Thread.sleep(1000);
JSONArray result2 = groupScheduleTools.getGroupRuleScheduleList(courseId, chiefCoachIdS); JSONArray result2 = groupScheduleTools.getGroupRuleScheduleList(courseId, chiefCoachIdS);
//删除成功后,统计查询到的目标日程数量是否-1 //删除成功后,统计查询到的目标日程数量是否-1
......
...@@ -152,9 +152,6 @@ public class TestEditGroupSchedule extends UniversalDataScheduling { ...@@ -152,9 +152,6 @@ public class TestEditGroupSchedule extends UniversalDataScheduling {
}); });
} }
} }
......
...@@ -64,7 +64,7 @@ public class TestDoForceOpenTraining extends BaseCreateTrainingData { ...@@ -64,7 +64,7 @@ public class TestDoForceOpenTraining extends BaseCreateTrainingData {
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").size() > 0, "活动创建后,根据活动名称全局搜索没有数据"); Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result").size() > 0, "活动创建后,根据活动名称全局搜索没有数据");
Thread.sleep(5000);//延迟5秒后,活动达到报名时间(可能状态没同步,定时任务没到时间执行,但是数据库中已是报名中) Thread.sleep(10000);//延迟10秒后,活动达到报名时间(可能状态没同步,定时任务没到时间执行,但是数据库中已是报名中)
//4.对报名中的活动操作立即成营 //4.对报名中的活动操作立即成营
JSONObject body1 = new JSONObject(); JSONObject body1 = new JSONObject();
body1.put("operatorId", dataApi.getLoginInfo().getAdminId()); body1.put("operatorId", dataApi.getLoginInfo().getAdminId());
......
...@@ -83,13 +83,14 @@ public class TestEditTraining extends BaseCreateTrainingData { ...@@ -83,13 +83,14 @@ public class TestEditTraining extends BaseCreateTrainingData {
} }
@Test(description = "编辑已发布训练营活动") @Test(description = "编辑已发布训练营活动",priority = 1)
public void editPublishTraining() { public void editPublishTraining() throws InterruptedException {
//1.查询关联对应课程的活动数据 //1.查询关联对应课程的活动数据
trainingTools.searchTrainingList(courseId, "",new ArrayList<>()); trainingTools.searchTrainingList(courseId, "",new ArrayList<>());
int listCountBefore = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").size(); int listCountBefore = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").size();
//2.创建已发布的训练营活动 //2.创建已发布的训练营活动
oneKeytTrainingId = trainingTools.oneKeyCreateTraining(courseId, trainerListIdS); oneKeytTrainingId = trainingTools.oneKeyCreateTraining(courseId, trainerListIdS);
Thread.sleep(2000);
//3.列表搜索数据check //3.列表搜索数据check
trainingTools.searchTrainingList(courseId,"", new ArrayList<>()); trainingTools.searchTrainingList(courseId,"", new ArrayList<>());
int listCountAfter = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").size(); int listCountAfter = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.records").size();
......
...@@ -26,8 +26,8 @@ public class TrainingTools extends XMBaseTest { ...@@ -26,8 +26,8 @@ public class TrainingTools extends XMBaseTest {
String openEndDate0 = CommUtil.getNDayEndTimeTamp(2);//后天23:59:59 String openEndDate0 = CommUtil.getNDayEndTimeTamp(2);//后天23:59:59
long currentTimestamp = System.currentTimeMillis(); long currentTimestamp = System.currentTimeMillis();
// 在当前时间的基础上,加上5秒(5000毫秒) // 在当前时间的基础上,加上10秒(10000毫秒)
long futureTimestamp = currentTimestamp + 5000; long futureTimestamp = currentTimestamp + 10000;
String futureTimestampS = String.valueOf(futureTimestamp); String futureTimestampS = String.valueOf(futureTimestamp);
...@@ -234,7 +234,7 @@ public class TrainingTools extends XMBaseTest { ...@@ -234,7 +234,7 @@ public class TrainingTools extends XMBaseTest {
body.put("studioId", dataApi.getLoginInfo().getStudioId()); body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId()); body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("current", 0); body.put("current", 0);
body.put("size", 20); body.put("size", 500);
body.put("courseId", courseId); body.put("courseId", courseId);
body.put("stateList", stateList); body.put("stateList", stateList);
if (!trainingName.isEmpty()) { if (!trainingName.isEmpty()) {
......
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