修改报告模板,新增报告模板的编译工程

Signed-off-by: deveco_xdevice <liguangjie1@huawei.com>
This commit is contained in:
deveco_xdevice 2024-09-05 17:02:27 +08:00
parent 6d97d03064
commit 0b78eb2425
16 changed files with 156 additions and 72512 deletions

View File

@ -25,14 +25,17 @@ XDevice consists of the following sub-modules:
```
xdevice
├── config # XDevice configuration
│ ├── user_config.xml # XDevice environment configuration
├── src # Source code
├── config # XDevice configuration
│ ├── user_config.xml # XDevice environment configuration
├── src # Source code
│ ├── xdevice
├── plugins # XDevice plugins
│ ├── ohos # OpenHarmony plugins
| ├── src # OpenHarmony plugins source code
│ └── setup.py # Installation script of the plugins
├── template # template files
│ ├── report # template files for test report
│ ├── build_report_template.py # build report template
├── plugins # XDevice plugins
│ ├── ohos # OpenHarmony plugins
| ├── src # OpenHarmony plugins source code
│ └── setup.py # Installation script of the plugins
```
## Constraints<a name="section118067583303"></a>
@ -45,6 +48,11 @@ The environment requirements for using this module are as follows:
- RSA version: 4.0 or later
## Usage<a name="section2036431583"></a>
- ** Build the xdevice test report template**
```cmd
python -m pip install requests
python build_report_template.py
```
- **Installing XDevice**
1. Go to the installation directory of XDevice.

View File

@ -25,16 +25,19 @@ xdevice主要包括以下几个主要模块
## 目录
```
xdevice
├── config # xdevice组件配置
│ ├── user_config.xml # xdevice环境配置
├── src # 组件源码目录
├── config # xdevice组件配置
│ ├── user_config.xml # xdevice环境配置
├── src # 组件源码目录
│ ├── xdevice
├── plugins # xdevice扩展模块
| |—— ohos # openharmony测试驱动插件
│ ├── src # 扩展模块源码
│ └── setup.py # ohos扩展模块安装脚本
| |--devicetest # devicetest测试驱动插件
| └── setup.py # deviectest扩展模块安装脚本
├── template # 模板文件
│ ├── report # 测试报告模板
│ ├── build_report_template.py # 测试报告模板构建脚本
├── plugins # xdevice扩展模块
| |—— ohos # openharmony测试驱动插件
│ ├── src # 扩展模块源码
│ └── setup.py # ohos扩展模块安装脚本
| |--devicetest # devicetest测试驱动插件
| └── setup.py # deviectest扩展模块安装脚本
```
@ -47,6 +50,12 @@ xdevice
- rsa>=4.0
## 使用
- **构建xdevice测试报告模板**
```cmd
python -m pip install requests
python build_report_template.py
```
- **安装xdevice**
1. 打开xdevice安装目录。

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,23 +0,0 @@
//MIT License
//
//Copyright (c) 2021 Jason Miller
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
!function (e, n) { "object" == typeof exports && "undefined" != typeof module ? module.exports = n() : "function" == typeof define && define.amd ? define(n) : (e = e || self).mitt = n() }(this, function () { return function (e) { return { all: e = e || new Map, on: function (n, t) { var f = e.get(n); f ? f.push(t) : e.set(n, [t]) }, off: function (n, t) { var f = e.get(n); f && (t ? f.splice(f.indexOf(t) >>> 0, 1) : e.set(n, [])) }, emit: function (n, t) { var f = e.get(n); f && f.slice().map(function (e) { e(t) }), (f = e.get("*")) && f.slice().map(function (e) { e(n, t) }) } } } });
//# sourceMappingURL=mitt.umd.js.map

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,105 @@
# coding=utf-8
#
# Copyright (c) 2020-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
import requests
import shutil
import sys
import urllib3
urllib3.disable_warnings()
def copy_folder(src, dst):
if not os.path.exists(src):
print(f"copy folder error, source path '{src}' does not exist")
return
if not os.path.exists(dst):
os.makedirs(dst)
for filename in os.listdir(src):
fr_path = os.path.join(src, filename)
to_path = os.path.join(dst, filename)
if os.path.isfile(fr_path):
shutil.copy(fr_path, to_path)
if os.path.isdir(fr_path):
if not os.path.exists(to_path):
os.makedirs(to_path)
copy_folder(fr_path, to_path)
def download(url, to_path):
cli = None
try:
cli = requests.get(url, timeout=5, verify=False)
if cli.status_code == 200:
with open(to_path, mode="wb+") as s_file:
for chunk in cli.iter_content(chunk_size=1024 * 4):
s_file.write(chunk)
s_file.flush()
finally:
if cli is not None:
cli.close()
def main():
sources = [
{
"file": "static/css/element-plus@2.3.4_index.css",
"url": "https://cdn.bootcdn.net/ajax/libs/element-plus/2.3.4/index.css"
},
{
"file": "static/element-plus@2.3.4_index.full.js",
"url": "https://cdn.bootcdn.net/ajax/libs/element-plus/2.3.4/index.full.js"
},
{
"file": "static/element-plus_icons-vue@2.0.10_index.iife.min.js",
"url": "https://cdn.bootcdn.net/ajax/libs/element-plus-icons-vue/2.0.10/index.iife.min.js"
},
{
"file": "static/EventEmitter.js",
"url": "https://cdn.bootcdn.net/ajax/libs/EventEmitter/5.2.8/EventEmitter.js"
},
{
"file": "static/vue@3.2.41_global.min.js",
"url": "https://cdn.bootcdn.net/ajax/libs/vue/3.2.41/vue.global.min.js"
}
]
cur_path = os.path.dirname(__file__)
template_src = os.path.join(cur_path, "report")
for source in sources:
file, url = source.get("file"), source.get("url")
to_path = os.path.join(template_src, file)
if os.path.exists(to_path):
continue
print(f"get report template resource {file} from {url}")
download(url, to_path)
if not os.path.exists(to_path):
raise Exception("get report template resource error")
print("copy template to xdevice")
template_dst = os.path.join(cur_path, "../src/xdevice/_core/resource/template")
copy_folder(template_src, template_dst)
if __name__ == "__main__":
exit_code = 0
try:
main()
except Exception as e:
print(e)
exit_code = 1
sys.exit(exit_code)

View File

@ -57,9 +57,9 @@ const popoverCheckBox = {
props: ["headername", "options", "type"],
mounted() {
if (!window.emitter) {
window.emitter = window.mitt();
window.emitter = new window.EventEmitter();
}
window.emitter.on("filter-name", (data) => {
window.emitter.addListener("filter-name", (data) => {
if (this.type === data.type) {
this.checkedValues.length = 0;
this.isIndeterminate = false;

View File

@ -119,7 +119,7 @@ const suiteTable = {
handleRowClick(row) {
this.$emit("view-detail",row);
setTimeout(() => {
window.emitter.emit("filter-name", {
window.emitter.emitEvent("filter-name", {
type: "suite",
value: row.name,
});

View File

Before

Width:  |  Height:  |  Size: 511 B

After

Width:  |  Height:  |  Size: 511 B

View File

@ -4,17 +4,17 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="./favicon.ico">
<link rel="icon" href="favicon.ico">
<title id="pageTitle"></title>
<link rel="stylesheet" href="css/element-plus@2.3.4_index.css">
<script src="./vue.global.js"></script>
<script src="./element-plus@2.3.4_index.full.js"></script>
<script src="./element-plus_icons-vue@2.0.10_index.iife.min.js"></script>
<script src="./mitt@3.0.0_mitt.umd.js"></script>
<script src="./components/popoverCheckBox.js"></script>
<script src="./components/suiteTable.js"></script>
<script src="./components/caseTable.js"></script>
<script src="./data.js"></script>
<script src="vue@3.2.41_global.min.js"></script>
<script src="element-plus@2.3.4_index.full.js"></script>
<script src="element-plus_icons-vue@2.0.10_index.iife.min.js"></script>
<script src="EventEmitter.js"></script>
<script src="components/caseTable.js"></script>
<script src="components/popoverCheckBox.js"></script>
<script src="components/suiteTable.js"></script>
<script src="data.js"></script>
<style>
#app {
margin: 0 100px 50px;

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -8,12 +8,12 @@
<title>xDevice Report</title>
<link rel="stylesheet" href="static/css/element-plus@2.3.4_index.css">
<link rel="stylesheet" href="static/css/index.css">
<script src="./static/vue.global.js"></script>
<script src="./static/element-plus@2.3.4_index.full.js"></script>
<script src="./static/element-plus_icons-vue@2.0.10_index.iife.min.js"></script>
<script src="./static/mitt@3.0.0_mitt.umd.js"></script>
<script src="./static/components/popoverCheckBox.js"></script>
<script src="./static/data.js"></script>
<script src="static/vue@3.2.41_global.min.js"></script>
<script src="static/element-plus@2.3.4_index.full.js"></script>
<script src="static/element-plus_icons-vue@2.0.10_index.iife.min.js"></script>
<script src="static/EventEmitter.js"></script>
<script src="static/components/popoverCheckBox.js"></script>
<script src="static/data.js"></script>
</head>
<body>