1
1
const plan_cache = { }
2
2
3
- function addComponent ( object_id , _input , to_table ) {
3
+ function addComponent ( object_id , _input , to_table ) {
4
4
const _name = _input . value
5
5
6
6
if ( _name . length > 0 ) {
@@ -15,7 +15,7 @@ function addComponent (object_id, _input, to_table) {
15
15
}
16
16
}
17
17
18
- function addTestPlanToTestCase ( case_id , plans_table ) {
18
+ function addTestPlanToTestCase ( case_id , plans_table ) {
19
19
const plan_name = $ ( '#input-add-plan' ) [ 0 ] . value
20
20
const plan = plan_cache [ plan_name ]
21
21
@@ -31,7 +31,7 @@ function addTestPlanToTestCase (case_id, plans_table) {
31
31
} )
32
32
}
33
33
34
- function initAddPlan ( case_id , plans_table ) {
34
+ function initAddPlan ( case_id , plans_table ) {
35
35
// + button
36
36
$ ( '#btn-add-plan' ) . click ( function ( ) {
37
37
addTestPlanToTestCase ( case_id , plans_table )
@@ -210,6 +210,45 @@ $(document).ready(function () {
210
210
} )
211
211
} )
212
212
213
+ jsonRPC ( 'Testing.individual_test_case_health' , { case_id : case_id } , ress => {
214
+
215
+ let res = { } ;
216
+ let planId = 0 ;
217
+ ress . forEach ( r => {
218
+ let positive = 0 ;
219
+ let negative = 0 ;
220
+ let allCount = 0 ;
221
+ if ( r . status__weight > 0 ) {
222
+ positive ++
223
+ } else if ( r . status__weight < 0 ) {
224
+ negative ++
225
+ }
226
+ allCount ++
227
+
228
+ if ( r . run__plan !== planId ) {
229
+ planId = r . run__plan ;
230
+ res [ planId ] = {
231
+ "completion_rate" : allCount > 0 ? ( ( positive + negative ) / allCount ) : 0 ,
232
+ "failure_rate" : allCount > 0 ? ( negative / allCount ) : 0 ,
233
+ }
234
+ positive = 0 ;
235
+ negative = 0 ;
236
+ allCount = 0 ;
237
+ }
238
+ } )
239
+
240
+ Object . entries ( res ) . forEach ( ( [ runId , data ] ) => {
241
+ const executionRow = $ ( `#execution-for-plan-${ runId } ` )
242
+ executionRow . find ( '.completion-rate' ) . html ( data . completion_rate )
243
+ executionRow . find ( '.completion-rate-container .progress-bar-danger' ) . css ( 'width' , `${ ( 1 - data . completion_rate ) * 100 } %` )
244
+ executionRow . find ( '.completion-rate-container .progress-bar-success' ) . css ( 'width' , `${ ( data . completion_rate ) * 100 } %` )
245
+
246
+ executionRow . find ( '.failure-rate' ) . html ( data . failure_rate )
247
+ executionRow . find ( '.failure-rate-container .progress-bar-danger' ) . css ( 'width' , `${ ( data . failure_rate ) * 100 } %` )
248
+ executionRow . find ( '.failure-rate-container .progress-bar-success' ) . css ( 'width' , `${ ( 1 - data . failure_rate ) * 100 } %` )
249
+ } )
250
+ } )
251
+
213
252
// bind add TP to TC widget
214
253
initAddPlan ( case_id , plans_table )
215
254
0 commit comments