文件
hyb-oa/scripts/qa/create-real-device-report.mjs
T

78 行
2.2 KiB
JavaScript
可执行文件

#!/usr/bin/env node
import { mkdirSync, writeFileSync } from "node:fs";
import path from "node:path";
function timestamp() {
const now = new Date();
const pad = (value) => String(value).padStart(2, "0");
return [
now.getFullYear(),
pad(now.getMonth() + 1),
pad(now.getDate()),
"-",
pad(now.getHours()),
pad(now.getMinutes()),
pad(now.getSeconds()),
].join("");
}
const rootDir = process.cwd();
const outputDir = process.env.QA_REAL_DEVICE_REPORT_DIR
? path.resolve(rootDir, process.env.QA_REAL_DEVICE_REPORT_DIR)
: path.join(rootDir, "artifacts/qa-flow", `real-device-public-${timestamp()}`);
const reportPath = path.join(outputDir, "report.md");
const checklist = [
"企业微信工作台入口直接进入移动工作台",
"已绑定账号不反复登录",
"手机浏览器可访问公网并登录",
"移动首页无 PC 侧边栏或桌面表格",
"报销草稿可新建、编辑、删除",
"报销详情不出现 draft/bound/费用类型 code/绑定整单/发票池/OCR",
"PDF 发票上传入口不打开摄像头并可选中文件",
"发票上传不出现拍照或图片入口",
"真实发票上传后有识别中、终态和耗时记录",
"重复、已使用或识别失败发票显示可理解原因",
"审批待办可查看并操作",
"通知可未读筛选、标记已读、全部已读",
"我的、个人设置、通知二级入口均为移动布局",
];
const rows = checklist.map((item, index) => `| ${index + 1} | ${item} | TODO | | |`).join("\n");
const content = `# 真机公网测试报告
- 测试日期:
- 测试人:
- 公网地址:https://oa.hyinda.com
- 账号角色:
- 设备:
- 系统版本:
- 企业微信版本:
- 浏览器:
- 网络:
- 测试发票样本:
## 结果
| # | 检查项 | 结果 | 证据 | 备注 |
| --- | --- | --- | --- | --- |
${rows}
## OCR 记录
| 文件名 | 类型 | 上传时间 | 终态 | 耗时 | 备注 |
| --- | --- | --- | --- | --- | --- |
| | | | | | |
## 失败记录
| 时间 | 页面 | 操作步骤 | 现象 | 证据 |
| --- | --- | --- | --- | --- |
| | | | | |
`;
mkdirSync(outputDir, { recursive: true });
writeFileSync(reportPath, content, "utf8");
console.log(reportPath);