Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xm-sportstest
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiamai-test
xm-sportstest
Commits
59e96537
Commit
59e96537
authored
Jul 13, 2024
by
DuJunLi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加注释
parent
079e6625
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
29 deletions
+31
-29
src/main/java/com/xiaomai/cases/polar/schedule/camp/TestEditCampScheduleItem.java
+31
-29
No files found.
src/main/java/com/xiaomai/cases/polar/schedule/camp/TestEditCampScheduleItem.java
View file @
59e96537
...
...
@@ -40,13 +40,13 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo
//获取下周日某个时间点的开始时间戳
String
startStamp
=
CommUtil
.
getWholeHourTimeStamp
(
13
,
"13:30"
);
public
String
sDateBefore
;
public
String
eDateBefore
=
""
;
public
int
scheduleClassHourEditBefore
=
0
;
public
String
sDateBefore
;
public
String
eDateBefore
=
""
;
public
int
scheduleClassHourEditBefore
=
0
;
public
int
scheduleClassHourEditAfter
=
0
;
public
List
<
String
>
venueAreaIdsEditAfter
;
public
Boolean
flag
;
public
int
scheduleClassHourEditAfter
=
0
;
public
List
<
String
>
venueAreaIdsEditAfter
;
public
Boolean
flag
;
@BeforeClass
public
void
beforeTest
()
{
...
...
@@ -70,7 +70,8 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo
campScheduleTools
.
getCampRuleScheduleList
(
campId
,
super
.
courseId
,
""
);
Assert
.
assertTrue
(
XMJSONPath
.
getJSONArrayByReadPath
(
dataApi
.
getApi_response
(),
"$.result"
).
size
()
==
1
,
"排课创建成功后,日程中没查询到对应数据"
);
ruldId
=
XMJSONPath
.
getJSONArrayByReadPath
(
dataApi
.
getApi_response
(),
"$.result"
).
getJSONObject
(
0
).
getString
(
"ruleId"
);
scheduleClassHourEditBefore
=
XMJSONPath
.
getJSONArrayByReadPath
(
dataApi
.
getApi_response
(),
"$.result"
).
getJSONObject
(
0
).
getJSONObject
(
"campVO"
).
getIntValue
(
"scheduleClassHour"
);
//获取训练营活动已排课课次数
scheduleClassHourEditBefore
=
XMJSONPath
.
getJSONArrayByReadPath
(
dataApi
.
getApi_response
(),
"$.result"
).
getJSONObject
(
0
).
getJSONObject
(
"campVO"
).
getIntValue
(
"scheduleClassHour"
);
}
...
...
@@ -121,10 +122,10 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo
List
<
String
>
venueAreaIds
=
groupScheduleTools
.
getStockArea
(
"流星花园秘密基地"
);
//获取下下周二的课次ID
//获取下下周二的开始时间和结束时间
String
targetStartDate
=
CommUtil
.
getXStartOfDateNextXWeek
(
1
,
2
);
String
targetendDate
=
CommUtil
.
getXEndOfDateNextXWeek
(-
5
,
2
);
String
targetStartDate
=
CommUtil
.
getXStartOfDateNextXWeek
(
1
,
2
);
String
targetendDate
=
CommUtil
.
getXEndOfDateNextXWeek
(-
5
,
2
);
Set
<
String
>
scheduleId22
;
campScheduleTools
.
getCampScheduleTable
(
targetStartDate
,
targetendDate
);
campScheduleTools
.
getCampScheduleTable
(
targetStartDate
,
targetendDate
);
int
count
=
XMJSONPath
.
getJSONArrayByReadPath
(
dataApi
.
getApi_response
(),
"$.result.timetableGroups"
).
size
();
if
(
count
>
0
)
{
JSONArray
array
=
XMJSONPath
.
getJSONArrayByReadPath
(
dataApi
.
getApi_response
(),
"$.result.timetableGroups"
);
...
...
@@ -180,25 +181,27 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo
campScheduleTools
.
getCampRuleScheduleList
(
campId
,
""
,
""
);
Assert
.
assertTrue
(
XMJSONPath
.
getJSONArrayByReadPath
(
dataApi
.
getApi_response
(),
"$.result"
).
size
()
==
2
,
"编辑当前及后续课次成功后,日程中没查询到2条对应数据"
);
//1.1获取到新生成的排课日程ID
//过滤出刚创建的
课次
//过滤出刚创建的
日程
JSONArray
array
=
XMJSONPath
.
getJSONArrayByReadPath
(
dataApi
.
getApi_response
(),
"$.result"
);
newRuldId
=
array
.
toJavaList
(
JSONObject
.
class
).
stream
()
.
filter
(
e
->
!
e
.
getString
(
"ruleId"
).
equals
(
ruldId
))
//过滤出新规则
.
map
(
e
->
e
.
getString
(
"ruleId"
))
//获取新规则ID
.
findFirst
().
orElse
(
null
);
//1.2查看新规则
array
.
toJavaList
(
JSONObject
.
class
).
stream
().
forEach
(
obj
->{
if
(
newRuldId
.
equals
(
obj
.
getString
(
"ruleId"
)))
{
sDateBefore
=
obj
.
getString
(
"startDate"
);
eDateBefore
=
obj
.
getString
(
"endDate"
);
scheduleClassHourEditAfter
=
Integer
.
parseInt
(
obj
.
getJSONObject
(
"campVO"
).
getString
(
"scheduleClassHour"
));
flag
=
obj
.
getJSONArray
(
"venueAreaIds"
).
containsAll
(
venueAreaIds
);
}
//1.2查看新规则
,check修改的字段是否生效
array
.
toJavaList
(
JSONObject
.
class
).
stream
().
forEach
(
obj
->
{
if
(
newRuldId
.
equals
(
obj
.
getString
(
"ruleId"
)))
{
sDateBefore
=
obj
.
getString
(
"startDate"
);
eDateBefore
=
obj
.
getString
(
"endDate"
);
scheduleClassHourEditAfter
=
Integer
.
parseInt
(
obj
.
getJSONObject
(
"campVO"
).
getString
(
"scheduleClassHour"
));
flag
=
obj
.
getJSONArray
(
"venueAreaIds"
).
containsAll
(
venueAreaIds
);
}
});
Assert
.
assertTrue
(
flag
==
true
,
"新规则的场地数据为空了"
);
Assert
.
assertTrue
(
scheduleClassHourEditBefore
+
1
==
scheduleClassHourEditAfter
,
"编辑当前及后续课次后,训练营已排课次数+1(独立出去的课次 又生成新的一个课次;之前删除的课次,也生成新的课次了)"
);
Assert
.
assertEquals
(
sDateBefore
,
CommUtil
.
getXStartOfDateNextXWeek
(
5
,
1
),
"新规则的开始日期不对,应该是下周六的时间"
);
Assert
.
assertEquals
(
eDateBefore
.
substring
(
0
,
9
),
super
.
openEndDate
.
substring
(
0
,
9
),
"新规则的结束日期不对"
);
Assert
.
assertTrue
(
flag
==
true
,
"新规则的场地数据为空了"
);
//编辑当前及后续课次后,已排课次数量变更check
Assert
.
assertTrue
(
scheduleClassHourEditBefore
+
1
==
scheduleClassHourEditAfter
,
"编辑当前及后续课次后,训练营已排课次数+1(独立出去的课次 又生成新的一个课次;之前删除的课次,也生成新的课次了)"
);
//新日程的开始日期check
Assert
.
assertEquals
(
sDateBefore
,
CommUtil
.
getXStartOfDateNextXWeek
(
5
,
1
),
"新规则的开始日期不对,应该是下周六的时间"
);
Assert
.
assertEquals
(
eDateBefore
.
substring
(
0
,
9
),
super
.
openEndDate
.
substring
(
0
,
9
),
"新规则的结束日期不对"
);
//2.断言check:获取下周四的课次,check是否还是原来的数据(不会受到影响)
Set
<
String
>
scheduleIds4
=
campScheduleTools
.
getCampTableDate
(
10
);
...
...
@@ -224,10 +227,10 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo
}
//4.check 下周日是否又生成一条新的课次
Set
<
String
>
scheduleIds77
=
campScheduleTools
.
getCampTableDate
(
13
);
Assert
.
assertTrue
(
scheduleIds77
.
size
()
==(
scheduleIdsN
.
size
()+
1
));
Set
<
String
>
scheduleIds77
=
campScheduleTools
.
getCampTableDate
(
13
);
Assert
.
assertTrue
(
scheduleIds77
.
size
()
==
(
scheduleIdsN
.
size
()
+
1
));
scheduleIds77
.
removeAll
(
scheduleIdsN
);
// System.out.println(JSON.toJSONString(scheduleIds77));
// System.out.println(JSON.toJSONString(scheduleIds77));
if
(
scheduleIds77
.
size
()
!=
0
&&
scheduleIds77
!=
null
)
{
scheduleIds77
.
stream
().
forEach
(
scheduleId
->
{
campScheduleTools
.
getCampScheduleItemDetail
(
scheduleId
);
...
...
@@ -236,8 +239,8 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo
}
//5.check 下下周二是否生成一条新的课次
campScheduleTools
.
getCampScheduleTable
(
targetStartDate
,
targetendDate
);
Assert
.
assertTrue
(
Integer
.
valueOf
(
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result.totalCount"
))==
1
,
"课次被删除后,编辑当前及后续,后续删除的课次没重新生成新的课次"
);
campScheduleTools
.
getCampScheduleTable
(
targetStartDate
,
targetendDate
);
Assert
.
assertTrue
(
Integer
.
valueOf
(
XMJSONPath
.
readPath
(
dataApi
.
getApi_response
(),
"$.result.totalCount"
))
==
1
,
"课次被删除后,编辑当前及后续,后续删除的课次没重新生成新的课次"
);
}
...
...
@@ -261,7 +264,6 @@ public class TestEditCampScheduleItem extends SelectTargetTrainingCampAndGetInfo
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment