From 91503e8bbbee4111179bcf14ec0d65306a794c6f Mon Sep 17 00:00:00 2001 From: lixiaoyu Date: Wed, 6 Aug 2025 08:55:19 +0800 Subject: [PATCH] *[task#146965,doing,0.2h,3h]batchcreate story in lite --- .../test/lib/batchcreateinlite.ui.class.php | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 module/projectstory/test/lib/batchcreateinlite.ui.class.php diff --git a/module/projectstory/test/lib/batchcreateinlite.ui.class.php b/module/projectstory/test/lib/batchcreateinlite.ui.class.php new file mode 100755 index 0000000000..638022dc88 --- /dev/null +++ b/module/projectstory/test/lib/batchcreateinlite.ui.class.php @@ -0,0 +1,71 @@ +switchVision('lite', 5); + $this->page->waitElement('//*[@id="app-project"]', 5); + $this->openURL('projectstory', 'story', $project, 'appIframe-project'); + $this->page->waitElement('//*[@id="app-project"]', 5); + $form = $this->initForm('story', 'batchCreate', $storyUrl, 'appIframe-project'); + $form->wait(2); + //设置表单内容 + if (isset($story->name)) $form->dom->title_0->setValue($story->name); + if (isset($story->reviewer)) $form->dom->reviewerPick->multiPicker($story->reviewer); + $form->dom->btn($this->lang->story->saveDraft)->click(); + $form->wait(2); + return $this->checkBatchCreate($project, $storyUrl, $story, $form); + } + + /** + * 检查批量创建目标的结果 + * Check the result of batch create story + * + * @param array $project + * @param array $storyUrl + * @param object $story + * @param object $form + * + * @return mixed + */ + public function checkBatchCreate($project, $storyUrl, $story, $form) + { + //创建失败时的校验 + if ($this->response('method') == 'batchCreate') + { + if (!isset($story->name) || $story->name == '') + { + $nameTip = $this->lang->story->errorEmptyStory; + return ($form->dom->alertModal('text') == $nameTip) + ? $this->success('目标名称必填提示信息正确') + : $this->failed('目标名称必填提示信息不正确'); + } + if (!isset($story->reviewer) || $story->reviewer == '') + { + $reviewerTip = sprintf($this->lang->error->notempty, $this->lang->story->reviewer); + return ($reviewerTip == $form->dom->reviewerTip->getText()) + ? $this->success('评审人必填提示信息正确') + : $this->failed('评审人必填提示信息不正确'); + } + } + else + { + $storyList = $this->initForm('projectstory', 'story', $project, 'appIframe-project'); + $storyList->dom->search(array("{$this->lang->story->name},=,{$story->name}")); + return ($storyList->dom->firstStory->getText() == $story->name) + ? $this->success('批量创建目标成功') + : $this->failed('批量创建目标失败'); + } + } +}