From 3d29d9c753c59f624af507aeb1b2535670ffebf4 Mon Sep 17 00:00:00 2001 From: yulujie Date: Wed, 4 Dec 2024 17:07:29 +0800 Subject: [PATCH] * [task#134046,doing,0.5h,4,5h] Add create child function. --- module/tree/test/lib/browsetask.ui.class.php | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/module/tree/test/lib/browsetask.ui.class.php b/module/tree/test/lib/browsetask.ui.class.php index 5a836ed6c5..b602842957 100644 --- a/module/tree/test/lib/browsetask.ui.class.php +++ b/module/tree/test/lib/browsetask.ui.class.php @@ -32,4 +32,43 @@ class browsetaskTester extends tester if($form->dom->lastModule->getText() == $moduleName) return $this->success('创建模块成功'); return $this->failed('创建模块失败'); } + + /** + * 检查执行下创建子模块。 + * Check the creation of child modules under the execution. + * + * @param string $childModuleName + * @param bool $checkRepeat + * @access public + * @return object + */ + public function createChildModule($childModuleName, $checkRepeat = false) + { + $form = $this->initForm('tree', 'browsetask', array('rootID' => '2'), 'appIframe-execution'); + if(!is_object($form->dom->firstViewBtn)) return $this->failed('不能创建子模块'); + $form->dom->firstViewBtn->click(); + $form->wait(1); + if($checkRepeat) $childModuleName = $form->dom->firstChildModule->getText(); + $form->dom->firsrNullModule->setValue($childModuleName); + $form->dom->submitBtn->click(); + $form->wait(1); + + $form = $this->loadPage(); + $form->wait(1); + + if($checkRepeat) + { + if($form->dom->modalText->getText() == sprintf($this->lang->tree->repeatName, $childModuleName)) return $this->success('创建子模块时子模块已存在,提示正确'); + return $this->failed('创建子模块时子模块已存在,提示错误'); + } + if(preg_match('/\s/', $childModuleName)) + { + if($form->dom->modalText->getText() == $this->lang->tree->shouldNotBlank) return $this->success('创建子模块时子模块名包含空格,提示正确'); + return $this->failed('创建子模块时子模块名包含空格,提示错误'); + } + if($form->dom->firstCaret->attr('class') == 'caret-right') $form->dom->firstCaret->click(); + $form->wait(1); + if($form->dom->lastChildModule->getText() == $childModuleName) return $this->success('创建子模块成功'); + return $this->failed('创建子模块失败'); + } }