From 3d5d06ec030d4dbfbc4998f775651f7acffa03e6 Mon Sep 17 00:00:00 2001 From: ToWhiD073 Date: Tue, 3 Feb 2026 00:44:50 +0600 Subject: [PATCH 1/2] fix: step_exit in for loops now exits action loop only step_exit inside step-looped for loops now correctly exits only the current step's actions, allowing subsequent steps to execute for the same iteration. Added flag check after Run_Sequential_Actions call. --- .../Sequential_Actions/sequential_actions.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Framework/Built_In_Automation/Sequential_Actions/sequential_actions.py b/Framework/Built_In_Automation/Sequential_Actions/sequential_actions.py index 7a6fcc3cb..bd1d71f2c 100755 --- a/Framework/Built_In_Automation/Sequential_Actions/sequential_actions.py +++ b/Framework/Built_In_Automation/Sequential_Actions/sequential_actions.py @@ -747,6 +747,11 @@ def for_loop_action(step_data, data_set_no): inner_skip = list(set(inner_skip + skip)) outer_skip = list(set(outer_skip + inner_skip)) + if step_exit_pass_called or step_exit_fail_called: + step_exit_pass_called = False + step_exit_fail_called = False + break + if result == "passed" and data_set_index in exit_loop_and_cont["pass"][step_cnt]: step_exit_fail_called = False step_exit_pass_called = False @@ -819,10 +824,6 @@ def for_loop_action(step_data, data_set_no): cont_break = True break - if step_exit_fail_called or step_exit_pass_called: - die = True - break - if die or cont_break: break if die: From 883b5428db861f38580d72c4836a3a3502be4a93 Mon Sep 17 00:00:00 2001 From: ToWhiD073 Date: Tue, 10 Feb 2026 09:48:48 +0600 Subject: [PATCH 2/2] fix: Separated user-disabled steps from loop bookkeeping to fix disable_step not working inside step loop execution. --- .../Sequential_Actions/sequential_actions.py | 18 +++++++++++------- Framework/MainDriverApi.py | 3 ++- Framework/Utilities/CommonUtil.py | 5 +++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Framework/Built_In_Automation/Sequential_Actions/sequential_actions.py b/Framework/Built_In_Automation/Sequential_Actions/sequential_actions.py index bd1d71f2c..1459037d7 100755 --- a/Framework/Built_In_Automation/Sequential_Actions/sequential_actions.py +++ b/Framework/Built_In_Automation/Sequential_Actions/sequential_actions.py @@ -596,7 +596,7 @@ def for_loop_action(step_data, data_set_no): values = get_data_set_nums(sr.get_previous_response_variables_in_strings(row[2].strip()), step_loop) if step_loop: loop_steps = [list(range(len(CommonUtil.all_step_dataset[i]))) if i in values else [] for i in list(range(len(CommonUtil.all_step_dataset)))] - CommonUtil.disabled_step += [i+1 for i in values] + CommonUtil.loop_consumed_step += [i+1 for i in values] else: loop_steps[step_index] += values # outer_skip += loop_this_data_sets @@ -711,6 +711,13 @@ def for_loop_action(step_data, data_set_no): sr.Set_Shared_Variables(each_varname, each_val) for step_cnt, each_step in enumerate(loop_steps): if len(each_step) == 0: continue + if (step_cnt + 1) in CommonUtil.disabled_step: + CommonUtil.ExecLog( + sModuleInfo, + "STEP-%s is disabled. Skipping execution inside step loop" % (step_cnt + 1), + 2 + ) + continue inner_skip = [] outer_skip = each_step CommonUtil.current_step_no = str(step_cnt+1) @@ -747,11 +754,6 @@ def for_loop_action(step_data, data_set_no): inner_skip = list(set(inner_skip + skip)) outer_skip = list(set(outer_skip + inner_skip)) - if step_exit_pass_called or step_exit_fail_called: - step_exit_pass_called = False - step_exit_fail_called = False - break - if result == "passed" and data_set_index in exit_loop_and_cont["pass"][step_cnt]: step_exit_fail_called = False step_exit_pass_called = False @@ -823,7 +825,9 @@ def for_loop_action(step_data, data_set_no): CommonUtil.ExecLog(sModuleInfo, "Condition matched. Continuing to next iteration", 1) cont_break = True break - + if step_exit_fail_called or step_exit_pass_called: + die = True + break if die or cont_break: break if die: diff --git a/Framework/MainDriverApi.py b/Framework/MainDriverApi.py index f7734a5fe..54e9deec0 100644 --- a/Framework/MainDriverApi.py +++ b/Framework/MainDriverApi.py @@ -599,7 +599,7 @@ def run_all_test_steps_in_a_test_case( sTestStepStartTime = datetime.fromtimestamp(TestStepStartTime, tz=pytz.UTC).strftime("%Y-%m-%d %H:%M:%S.%f") WinMemBegin = CommonUtil.PhysicalAvailableMemory() # get available memory - if StepSeq in CommonUtil.disabled_step or not this_step['step_enable']: + if StepSeq in CommonUtil.disabled_step or StepSeq in CommonUtil.loop_consumed_step or not this_step['step_enable']: CommonUtil.ExecLog(sModuleInfo, "STEP-%s is disabled" % StepSeq, 2) sStepResult = "skipped" elif CommonUtil.testcase_exit: @@ -2008,6 +2008,7 @@ def main(device_dict, all_run_id_info): } set_device_info_according_to_user_order(device_order, device_dict, test_case_no, test_case_name, user_info_object, Userid, run_id=run_id) CommonUtil.disabled_step = [] + CommonUtil.loop_consumed_step = [] CommonUtil.testcase_exit = "" # Download test case and step attachments diff --git a/Framework/Utilities/CommonUtil.py b/Framework/Utilities/CommonUtil.py index b68c3df78..2fc3bc370 100644 --- a/Framework/Utilities/CommonUtil.py +++ b/Framework/Utilities/CommonUtil.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # -*- coding: cp1252 -*- import selenium @@ -147,7 +147,8 @@ jwt_token = "" run_cancel = "" run_cancelled = False -disabled_step = [] # 1 based indexing +disabled_step = [] # 1 based indexing (user requested step disable) +loop_consumed_step = [] # 1 based indexing (steps executed via step loop) testcase_exit = "" max_char = 0 compare_action_varnames = {"left":"Left", "right":"Right"} # for labelling left and right variable names of compare action