From 4e1f1488e2a68de4cd8f894f8944a7d98e4548f8 Mon Sep 17 00:00:00 2001 From: Patrick Delcroix Date: Thu, 25 Mar 2021 10:32:50 +0100 Subject: [PATCH 1/2] Copy the steps and execution notes for failed tc if the test is failed, if the step is not passed or there is an execution note then this is added to the "note/description" Step (): --- gui/javascript/execSetResults.js | 39 ++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/gui/javascript/execSetResults.js b/gui/javascript/execSetResults.js index b7a4f55585..2dfbba9998 100644 --- a/gui/javascript/execSetResults.js +++ b/gui/javascript/execSetResults.js @@ -26,22 +26,43 @@ function doSubmitForHTML5() { * */ function saveExecStatus(tcvID, status, msg, goNext) { - /* Init */ jQuery('#save_and_next').val(0); - jQuery('#save_results').val(0); - jQuery('#save_partial_steps_exec').val(0); + jQuery('#save_results').val(0); + jQuery('#save_partial_steps_exec').val(0); jQuery('#save_button_clicked').val(tcvID); jQuery('#statusSingle_' + tcvID).val(status); + if(status == 'f'){ + // Get all steps status + var myRegexp = /step_row_(\d+)/g; + var stepresult = document.querySelectorAll('[id^=step_row_]') + var tcNotes = document.getElementById('notes['+tcvID+']'); + stepresult.forEach(function(item){ + match = myRegexp.exec(item.id); + myRegexp.lastIndex = 0; + stepNum = document.getElementById('tcstep_'+match[1]); + var row = stepNum.innerHTML; + var note = ''; + var statusTc = '' + + + if ( item.getElementsByClassName('step_status').length > 0 ) + statusTc = item.getElementsByClassName('step_status')[0].value; + if ( item.getElementsByClassName('step_note_textarea').length > 0 ) + note = item.getElementsByClassName('step_note_textarea')[0].value; + if (statusTc == 'f' ||statusTc == 'b' || note != ''){ + tcNotes.value = tcNotes.value + '\nStep '+ row + ' ('+ statusTc+'):' + note ; + } + }) + } if( goNext == undefined || goNext == 0 ) { - jQuery('#save_results').val(1); + jQuery('#save_results').val(1); } else { - if( goNext == 1 ) { - jQuery('#save_and_next').val(1); - } + if( goNext == 1 ) { + jQuery('#save_and_next').val(1); + } } - doSubmitForHTML5(); } @@ -152,4 +173,4 @@ function checkSubmitForStatusCombo(oid,statusCode2block) { saveStepsPartialExecClicked = false; $("#saveStepsPartialExec").click(function() { saveStepsPartialExecClicked = true; -}); \ No newline at end of file +}); From 25a6c2c71e030b1d3d417b793df536e765d0086a Mon Sep 17 00:00:00 2001 From: Patrick Delcroix Date: Mon, 19 Jul 2021 11:22:55 +0200 Subject: [PATCH 2/2] add config for step note concat --- config.inc.php | 6 ++ gui/javascript/execSetResults.js | 56 ++++++++++--------- .../execute/inc_exec_img_controls.tpl | 4 +- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/config.inc.php b/config.inc.php index 02d3bd5342..192e4bbb76 100644 --- a/config.inc.php +++ b/config.inc.php @@ -1078,6 +1078,12 @@ // 'latest' => latest execution notes. $tlCfg->exec_cfg->steps_exec_status_default = 'empty'; +/** + * Concatenate execution steps note in the execution notes (the later is attached to the test run) + **/ + +$tlCfg->exec_cfg->steps_notes_concat = false; + // Parameters to show notes/details when entering test execution feature // EXPAND: show expanded/open // COLLAPSE: show collapsed/closede diff --git a/gui/javascript/execSetResults.js b/gui/javascript/execSetResults.js index 2dfbba9998..ad2dd3f2e6 100644 --- a/gui/javascript/execSetResults.js +++ b/gui/javascript/execSetResults.js @@ -22,39 +22,41 @@ function doSubmitForHTML5() { /** * Submit Executions status. - * Used - * + * @param tcvID int test case id + * @param status test status + * @param notesConcat concatenate step note in exec notes + * @param goNext open next test case + * */ -function saveExecStatus(tcvID, status, msg, goNext) { +function saveExecStatus(tcvID, status, notesConcat, goNext) { /* Init */ jQuery('#save_and_next').val(0); - jQuery('#save_results').val(0); - jQuery('#save_partial_steps_exec').val(0); - + jQuery('#save_results').val(0); + jQuery('#save_partial_steps_exec').val(0); jQuery('#save_button_clicked').val(tcvID); jQuery('#statusSingle_' + tcvID).val(status); - if(status == 'f'){ - // Get all steps status - var myRegexp = /step_row_(\d+)/g; - var stepresult = document.querySelectorAll('[id^=step_row_]') - var tcNotes = document.getElementById('notes['+tcvID+']'); - stepresult.forEach(function(item){ - match = myRegexp.exec(item.id); - myRegexp.lastIndex = 0; - stepNum = document.getElementById('tcstep_'+match[1]); - var row = stepNum.innerHTML; - var note = ''; - var statusTc = '' - + if(notesConcat == true){ + // Get all steps status + var myRegexp = /step_row_(\d+)/g; + var stepresult = document.querySelectorAll('[id^=step_row_]') + var tcNotes = document.getElementById('notes['+tcvID+']'); + stepresult.forEach(function(item){ + match = myRegexp.exec(item.id); + myRegexp.lastIndex = 0; + stepNum = document.getElementById('tcstep_'+match[1]); + var row = stepNum.innerHTML; + var note = ''; + var statusTc = '' + - if ( item.getElementsByClassName('step_status').length > 0 ) - statusTc = item.getElementsByClassName('step_status')[0].value; - if ( item.getElementsByClassName('step_note_textarea').length > 0 ) - note = item.getElementsByClassName('step_note_textarea')[0].value; - if (statusTc == 'f' ||statusTc == 'b' || note != ''){ - tcNotes.value = tcNotes.value + '\nStep '+ row + ' ('+ statusTc+'):' + note ; - } - }) + if ( item.getElementsByClassName('step_status').length > 0 ) + statusTc = item.getElementsByClassName('step_status')[0].value; + if ( item.getElementsByClassName('step_note_textarea').length > 0 ) + note = item.getElementsByClassName('step_note_textarea')[0].value; + if (statusTc == 'f' ||statusTc == 'b' || note != ''){ + tcNotes.value = tcNotes.value + '\nStep '+ row + ' ('+ statusTc+'):' + note ; + } + }) } if( goNext == undefined || goNext == 0 ) { jQuery('#save_results').val(1); diff --git a/gui/templates/tl-classic/execute/inc_exec_img_controls.tpl b/gui/templates/tl-classic/execute/inc_exec_img_controls.tpl index 553d62c757..aed72cfdfb 100644 --- a/gui/templates/tl-classic/execute/inc_exec_img_controls.tpl +++ b/gui/templates/tl-classic/execute/inc_exec_img_controls.tpl @@ -109,7 +109,7 @@ Author : franciscom   + onclick="javascript:saveExecStatus({$tcvID},'{$kode}',{$tlCfg->exec_cfg->steps_notes_concat});">  {/foreach}

@@ -121,7 +121,7 @@ Author : franciscom   + onclick="javascript:saveExecStatus({$tcvID},'{$kode}',{$tlCfg->exec_cfg->steps_notes_concat},1);">  {/foreach}