Commit 0046e234 by xuyamei

代码优化提交

parent d4180702
......@@ -62,7 +62,7 @@ public class TestAddStudioAdmin extends BaseTestImpl {
}
try {
Thread.sleep(10000);
Thread.sleep(15000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
......@@ -105,7 +105,7 @@ public class TestAddStudioAdmin extends BaseTestImpl {
}
try {
Thread.sleep(10000);
Thread.sleep(15000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
......
......@@ -87,7 +87,7 @@ public class TestStudioRoleEdit extends BaseTestImpl {
Assert.assertEquals(response.getJSONObject("result").getString("name"),"编辑角色名称","编辑角色名称失败");
try {
Thread.sleep(4000);
Thread.sleep(15000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
......
......@@ -423,6 +423,11 @@ public class ReserveTools extends XMBaseTest {
body.put("normalTimeInfoRequests",normalTimeInfoRequests);
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return dataApi.getBodyInJSON().getJSONArray("result");
}
......@@ -534,6 +539,33 @@ public class ReserveTools extends XMBaseTest {
}
/**
* @description: 获取私教课程的可约时间块
* @author: xuyamei
* @date: 2024/7/24 17:17
* @param coachId 教练id
* @param courseId 课程id
* @param selectedDate 选中日期
* @param userInfos
* @return: com.alibaba.fastjson.JSONArray
**/
public JSONArray getPersonalTimeBlocks(String coachId,String courseId,Long selectedDate,DataUserInfo...userInfos){
setUp("API_getPersonalTimeBlocks",userInfos);
JSONObject body = new JSONObject();
body.put("brandId", dataApi.getLoginInfo().getBrandId());
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("coachId", coachId);
body.put("courseId", courseId);
body.put("selectedDate", selectedDate);
dataApi.doRequest(RequestType.JSON,dataparams,body.toString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONArray("result");
}
......
......@@ -98,7 +98,7 @@ public class TestAddMemberReserve extends BaseTestImpl {
throw new RuntimeException(e);
}
// 查询课次id
JSONArray getGroupScheduleTable = groupScheduleTools.getGroupScheduleTable(scheduleStartTime, scheduleEndTime);
JSONArray getGroupScheduleTable = groupScheduleTools.getGroupScheduleTable(scheduleStartTime, scheduleEndTime,courseId);
for (int i = 0; i < getGroupScheduleTable.size(); i++){
if (getGroupScheduleTable.getJSONObject(i).getString("ruleId").equals(ruldId)){
scheduleId = getGroupScheduleTable.getJSONObject(i).getString("scheduleId");
......
......@@ -276,7 +276,7 @@ public class TestAddToQueue extends BaseTestImpl {
throw new RuntimeException(e);
}
// 查询课次id
JSONArray getGroupScheduleTable = groupScheduleTools.getGroupScheduleTable(Long.valueOf(todayStartTimeTamp), scheduleEndTime);
JSONArray getGroupScheduleTable = groupScheduleTools.getGroupScheduleTable(Long.valueOf(todayStartTimeTamp), scheduleEndTime,courseId);
for (int i = 0; i < getGroupScheduleTable.size(); i++){
if (getGroupScheduleTable.getJSONObject(i).getString("ruleId").equals(ruldId)){
scheduleId = getGroupScheduleTable.getJSONObject(i).getString("scheduleId");
......
package com.xiaomai.cases.polar.reserve;
package com.xiaomai.cases.polar.reserve.group;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -7,6 +7,7 @@ import com.xiaomai.cases.polar.course.CourseTools;
import com.xiaomai.cases.polar.finance.order.OrderTools;
import com.xiaomai.cases.polar.member.Tools;
import com.xiaomai.cases.polar.memberCard.CardTools;
import com.xiaomai.cases.polar.reserve.ReserveTools;
import com.xiaomai.cases.polar.schedule.group.GroupScheduleTools;
import com.xiaomai.cases.polar.setting.courseCategory.CourseCategoryTools;
import com.xiaomai.enums.ApiModule;
......@@ -236,7 +237,12 @@ public class TestSignIn extends BaseTestImpl {
int[] minuteOffset = {60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900, 960, 1020, 1080, 1140, 1200, 1260};
Random random = new Random();
//1.1-创建排课日程(前一天的课程)
groupScheduleTools.createGroupRuleSchedule(courseId, xmAppApi.getLoginInfo().getAdminId(), todayStartTimeTamp, todayEndDateTimeTamp, new ArrayList(), new ArrayList(), false, 1,minuteOffset[random.nextInt(20)]);
groupScheduleTools.createGroupRuleSchedule(courseId, xmAppApi.getLoginInfo().getAdminId(), todayStartTimeTamp, todayEndDateTimeTamp, new ArrayList(), new ArrayList(), true, 1,minuteOffset[random.nextInt(20)]);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
//1.2-查询排课日程
JSONArray getGroupRuleScheduleList = groupScheduleTools.getGroupRuleScheduleList(courseId, xmAppApi.getLoginInfo().getAdminId());
//统计查询到的目标日程数量
......@@ -248,7 +254,7 @@ public class TestSignIn extends BaseTestImpl {
throw new RuntimeException(e);
}
// 查询课次id
JSONArray getGroupScheduleTable = groupScheduleTools.getGroupScheduleTable(Long.valueOf(todayStartTimeTamp), scheduleEndTime);
JSONArray getGroupScheduleTable = groupScheduleTools.getGroupScheduleTable(Long.valueOf(todayStartTimeTamp), scheduleEndTime,courseId);
for (int i = 0; i < getGroupScheduleTable.size(); i++){
if (getGroupScheduleTable.getJSONObject(i).getString("ruleId").equals(ruldId)){
scheduleId = getGroupScheduleTable.getJSONObject(i).getString("scheduleId");
......
......@@ -28,7 +28,6 @@ public class TestCreateBatchSpecialDate extends BaseTestImpl {
@Resource(name = "reserveTools")
ReserveTools reserveTools;
JSONArray coachIds = new JSONArray();
JSONArray records = new JSONArray();
@BeforeClass
public void beforeTest(){
......
......@@ -260,12 +260,15 @@ public class GroupScheduleTools extends XMBaseTest {
* @date: 2024/6/23 17:46
* @return: com.alibaba.fastjson.JSONArray
**/
public JSONArray getGroupScheduleTable(Long startDate, Long endDate) {
public JSONArray getGroupScheduleTable(Long startDate, Long endDate,String courseId) {
setUP("API_getGroupScheduleTable");
JSONObject body = new JSONObject();
body.put("operatorId", dataApi.getLoginInfo().getAdminId());
body.put("studioId", dataApi.getLoginInfo().getStudioId());
body.put("brandId", dataApi.getLoginInfo().getBrandId());
if (courseId.equals("")){
body.put("courseId", courseId);
}
body.put("startDate", startDate);
body.put("endDate", endDate);
dataApi.doRequest(RequestType.JSON, dataparams, body.toString(), dataheadrs).assetsSuccess(true);
......@@ -338,7 +341,7 @@ public class GroupScheduleTools extends XMBaseTest {
*/
public Set<String> getTableDate(int n) {
//查看团课课表
getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekStartDay()), Long.valueOf(CommUtil.oneKeyGetNextWeekEndDay()));
getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekStartDay()), Long.valueOf(CommUtil.oneKeyGetNextWeekEndDay()),"");
//获取下周周N及后续的课次
String date = CommUtil.oneKeyGetNextWeekXDay(n);//下周N 日期时间戳
int count = XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.timetableGroups").size();
......
......@@ -51,7 +51,7 @@ public class TestDelGroupScheduleItem extends UniversalDataScheduling {
});
//删除成功后check 下周四课表是否有数据
groupScheduleTools.getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekXDay(10)), Long.valueOf(CommUtil.oneKeyGetNextWeekEndXDay(4)));
groupScheduleTools.getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekXDay(10)), Long.valueOf(CommUtil.oneKeyGetNextWeekEndXDay(4)),courseId);
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.totalCount"), "0");
}
......@@ -75,7 +75,7 @@ public class TestDelGroupScheduleItem extends UniversalDataScheduling {
});
//删除成功后check 从下周三到下周日课表是否有数据
groupScheduleTools.getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekXDay(9)), Long.valueOf(CommUtil.oneKeyGetNextWeekEndDay()));
groupScheduleTools.getGroupScheduleTable(Long.valueOf(CommUtil.oneKeyGetNextWeekXDay(9)), Long.valueOf(CommUtil.oneKeyGetNextWeekEndDay()),courseId);
Assert.assertEquals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.totalCount"), "0");
}
}
......
......@@ -4,5 +4,5 @@
"title":"接口自动化测试",
"text": "### 自动化测试报告\n> ![screenshot](http://47.98.129.121:5060/job/xm-sportstest/ws/src/main/resources/lAHPDeC2umcJGVBKzQFq_362_74.gif)\n> #### [本报告仅支持内网查看,传送门DMXY>>](http://jenkins-test.ixm5.cn/job/xm-sportstest/HTML_20Report/) \n"
}
}
\ No newline at end of file
# 数据库配置
#jdbc.name=TestGetAdmin
#jdbc.url=jdbc:mysql://10.158.0.123:3306/xm_data?characterEncoding=UTF-8
#jdbc.url=jdbc:mysql://10.158.0.123:3306/xm_sports?characterEncoding=UTF-8
jdbc.username=qaman
jdbc.password=qaman
jdbc.url=jdbc:mysql://120.27.248.253:3306/xm_sports?characterEncoding=UTF-8
......
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