From ae0f1097bc38fa4c11984769dadb6dffb511bfdd Mon Sep 17 00:00:00 2001 From: zhaoke Date: Tue, 28 Mar 2023 14:57:27 +0800 Subject: [PATCH] * Fix step group missing when sync case from ztf to zentao. --- api/v1/entries/testcase.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/v1/entries/testcase.php b/api/v1/entries/testcase.php index 6d0c75cbde..e0a1bd7ab2 100644 --- a/api/v1/entries/testcase.php +++ b/api/v1/entries/testcase.php @@ -56,11 +56,16 @@ class testcaseEntry extends entry $stepType = array(); if(isset($this->requestBody->steps)) { - foreach($this->requestBody->steps as $step) + foreach($this->requestBody->steps as $key => $step) { + if(empty($step->type)) $step->type = 'step'; + if(!in_array($step->type, array('step', 'item', 'group'))) $step->type = 'step'; + + if($step->type == 'group' && (empty($this->requestBody->steps[$key + 1]->type) || $this->requestBody->steps[$key + 1]->type != 'item')) $step->type = 'step'; + $steps[] = $step->desc; $expects[] = $step->expect; - $stepType[] = 'item'; + $stepType[] = $step->type; } }