恢复点(restore point)。别人改崩后可 git reset --hard 回到此提交。 == 此快照内容 == - 后端 oa-backend: 734 控制器 / 711 实体 (Spring Boot 3.2.5 + SQLite, 端口8091) - 前端 modern-ui/app: Vue3+Vite, 约700页 (构建产物已在 oa-backend/src/main/resources/static) - 数据库 oa-backend/data/oa.db: 含全部演示数据 (强制入库, 6.6MB) - 交接文档 go.md + go-code-reference/endpoints/entities/database.md - 多代理建设脚本 .claude/wf-*.js == 状态 == - 对 凯迪科技ERP_20260507.xlsx 合规 MET ~73.3% (PARTIAL 75: 34可建+6种子/bug+35外部硬天花板) - 安全: 5轮红队+5轮复检, default-deny分级鉴权, 连续零可利用 - W3~W7 累计补完436缺口; W8末轮(40缺口)为半成品(源码树可编译但未集成) - 运行: cd oa-backend; java -jar build/libs/oa-backend-0.1.0.jar --server.port=8091; admin/123456 == 排除(gitignore, 可再生) == node_modules / oa-backend/build / .jdks / *.log / Backup-ERP-* / 弃用的OFBiz核心(只保留modern-ui) 完整文件夹备份见同目录 Backup-ERP-20260615-191517/ (含上述全部, 仅缺 node_modules) 时间戳: 20260615-191517 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1442 lines
68 KiB
JavaScript
1442 lines
68 KiB
JavaScript
#!/usr/bin/env node
|
|
/*
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
* or more contributor license agreements. See the NOTICE file
|
|
* distributed with this work for additional information
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
* to you 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 { mkdir, writeFile } from 'node:fs/promises'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import {
|
|
CdpConnection,
|
|
browserExecutionContext,
|
|
chromeCandidates,
|
|
closeChrome,
|
|
commandExists,
|
|
createBrowserSetupTracker,
|
|
evaluate,
|
|
installConsoleErrorCapture,
|
|
installApiMock,
|
|
installSessionMock,
|
|
isRetryableBrowserSetupError,
|
|
launchChrome,
|
|
runtimeDiagnostics,
|
|
summarizeBrowserSetupFailure,
|
|
waitForExpression
|
|
} from './lib/chrome-cdp.mjs'
|
|
import { fetchFailureDetail, localNetworkHint } from './lib/runtime-network.mjs'
|
|
import { actionableConsoleErrors } from './lib/runtime-console.mjs'
|
|
import {
|
|
adminRuntimePolicySnapshotExpression,
|
|
assertAdminRuntimePolicy,
|
|
runtimeRouteHashWaitExpression
|
|
} from './verify-admin-runtime-policy.mjs'
|
|
|
|
const scriptPath = fileURLToPath(import.meta.url)
|
|
const appRoot = path.resolve(path.dirname(scriptPath), '..')
|
|
const repoRoot = path.resolve(appRoot, '../../..')
|
|
const screenshotDir = path.join(repoRoot, 'plugins/modern-ui/verification/screenshots')
|
|
const screenshotReportFile = path.join(repoRoot, 'plugins/modern-ui/verification/screenshots-report.json')
|
|
const baseUrl = process.env.MODERN_UI_BASE_URL || 'http://127.0.0.1:8080/modern/app/'
|
|
const cdpCommandTimeoutMs = Number(process.env.MODERN_UI_CDP_TIMEOUT_MS || 10000)
|
|
const chromeStartupTimeoutMs = Number(process.env.MODERN_UI_CHROME_STARTUP_TIMEOUT_MS || 15000)
|
|
const baseUrlTimeoutMs = Number(process.env.MODERN_UI_BASE_URL_TIMEOUT_MS || 8000)
|
|
const baseUrlCheckAttempts = positiveIntegerEnv('MODERN_UI_BASE_URL_ATTEMPTS', 1)
|
|
const overallTimeoutMs = Number(process.env.MODERN_UI_SCREENSHOT_TIMEOUT_MS || 180000)
|
|
const browserLaunchAttempts = positiveIntegerEnv('MODERN_UI_BROWSER_ATTEMPTS', 1)
|
|
const requestedScreenshotIds = splitList(process.env.MODERN_UI_SCREENSHOT_IDS)
|
|
const apiBaseUrl = normalizeApiBaseUrl(process.env.MODERN_UI_API_BASE_URL || baseUrl)
|
|
const adminUsername = process.env.MODERN_UI_ADMIN_USERNAME || 'admin'
|
|
const adminPassword = process.env.MODERN_UI_ADMIN_PASSWORD || 'ofbiz'
|
|
const allowMockFallback = ['1', 'true', 'yes'].includes(String(process.env.MODERN_UI_SCREENSHOT_ALLOW_MOCK_FALLBACK || '').toLowerCase())
|
|
|
|
const coreAdminScreenshotIds = [
|
|
'login-door',
|
|
'admin-workbench',
|
|
'order-admin',
|
|
'party-admin',
|
|
'product-admin',
|
|
'accounting-admin',
|
|
'inventory-admin',
|
|
'manufacturing-admin',
|
|
'humanres-admin',
|
|
'sales-admin',
|
|
'procurement-admin',
|
|
'scrum-admin',
|
|
'operations-admin',
|
|
'content-admin',
|
|
'marketing-admin',
|
|
'commerce-admin',
|
|
'pos-admin',
|
|
'marketplace-admin',
|
|
'analytics-admin',
|
|
'extension-admin',
|
|
'global-business-center',
|
|
'system-tools',
|
|
'security-admin',
|
|
'system-operations'
|
|
]
|
|
|
|
const screenshots = [
|
|
{
|
|
id: 'login-door',
|
|
route: '#/login',
|
|
file: 'login-door.png',
|
|
waitFor: "document.body.innerText.includes('登录后进入完整 ERP 后台') && document.body.innerText.includes('登录 ERP 后台')"
|
|
},
|
|
{
|
|
id: 'admin-workbench',
|
|
route: '#/',
|
|
file: 'admin-workbench.png',
|
|
waitFor: "document.body.innerText.includes('ERP 管理员工作台') && document.body.innerText.includes('今日运营') && document.body.innerText.includes('待办队列') && document.body.innerText.includes('当班状态') && document.body.innerText.includes('最近记录') && document.body.innerText.includes('快捷动作')"
|
|
},
|
|
{
|
|
id: 'global-business-center',
|
|
route: '#/business',
|
|
file: 'global-business-center.png',
|
|
waitFor: "document.body.innerText.includes('统一业务中心') && document.body.innerText.includes('业务受理台') && document.body.innerText.includes('当前班次') && document.body.innerText.includes('当前办理口径') && document.body.innerText.includes('待办队列') && document.body.innerText.includes('今日承接') && document.body.innerText.includes('优先处理') && document.body.innerText.includes('异常队列') && document.body.innerText.includes('续办记录') && document.body.innerText.includes('进入处理')"
|
|
},
|
|
{
|
|
id: 'system-tools',
|
|
route: '#/system',
|
|
file: 'system-tools.png',
|
|
waitFor: "document.body.innerText.includes('系统维护') && document.body.innerText.includes('安全与会话') && document.body.innerText.includes('运行任务') && document.body.innerText.includes('扩展与参数')"
|
|
},
|
|
{
|
|
id: 'order-workspace',
|
|
route: '#/module/order',
|
|
file: 'order-workspace.png',
|
|
waitFor: "document.body.innerText.includes('订单工作台') && document.body.innerText.includes('业务处理中枢') && document.body.innerText.includes('交接记录') && document.body.innerText.includes('处理流') && document.body.innerText.includes('执行动作') && document.body.innerText.includes('异常交接')"
|
|
},
|
|
{
|
|
id: 'order-admin',
|
|
route: '#/orders',
|
|
file: 'order-admin.png',
|
|
waitFor: "document.body.innerText.includes('订单运营台') && document.body.innerText.includes('订单执行台') && document.body.innerText.includes('订单业务数据') && document.body.innerText.includes('订单队列') && document.body.innerText.includes('订单明细') && document.body.innerText.includes('履约与发运') && document.body.innerText.includes('退货授权')"
|
|
},
|
|
{
|
|
id: 'party-admin',
|
|
route: '#/parties',
|
|
file: 'party-admin.png',
|
|
waitFor: "document.body.innerText.includes('客户与组织管理台') && document.body.innerText.includes('客户主体') && document.body.innerText.includes('个人档案') && document.body.innerText.includes('组织档案') && document.body.innerText.includes('角色关系') && document.body.innerText.includes('客户业务数据')"
|
|
},
|
|
{
|
|
id: 'product-admin',
|
|
route: '#/catalog/products',
|
|
file: 'product-admin.png',
|
|
waitFor: "document.body.innerText.includes('商品管理台') && document.body.innerText.includes('商品资料') && document.body.innerText.includes('目录分类') && document.body.innerText.includes('价格规则') && document.body.innerText.includes('促销活动') && document.body.innerText.includes('库存状态') && document.body.innerText.includes('商品业务数据') && document.body.innerText.includes('商品执行台') && document.body.innerText.includes('处理队列') && document.body.innerText.includes('复核交接')"
|
|
},
|
|
{
|
|
id: 'accounting-admin',
|
|
route: '#/accounting',
|
|
file: 'accounting-admin.png',
|
|
waitFor: "document.body.innerText.includes('财务管理台') && document.body.innerText.includes('财务结账台') && document.body.innerText.includes('应收跟进') && document.body.innerText.includes('应付安排') && document.body.innerText.includes('收付款匹配') && document.body.innerText.includes('核销队列') && document.body.innerText.includes('财务业务数据')"
|
|
},
|
|
{
|
|
id: 'inventory-admin',
|
|
route: '#/facility',
|
|
file: 'inventory-admin.png',
|
|
waitFor: "document.body.innerText.includes('库存管理台') && document.body.innerText.includes('库存执行台') && document.body.innerText.includes('收货上架') && document.body.innerText.includes('可用量关注') && document.body.innerText.includes('调拨跟进') && document.body.innerText.includes('盘点差异') && document.body.innerText.includes('库存异常') && document.body.innerText.includes('库位交接') && document.body.innerText.includes('库存业务数据')"
|
|
},
|
|
{
|
|
id: 'manufacturing-admin',
|
|
route: '#/manufacturing',
|
|
file: 'manufacturing-admin.png',
|
|
waitFor: "document.body.innerText.includes('生产管理台') && document.body.innerText.includes('生产调度台') && document.body.innerText.includes('排产跟进') && document.body.innerText.includes('物料缺口') && document.body.innerText.includes('工序准备') && document.body.innerText.includes('发料领用') && document.body.innerText.includes('成本关注') && document.body.innerText.includes('生产异常') && document.body.innerText.includes('生产业务数据')"
|
|
},
|
|
{
|
|
id: 'humanres-admin',
|
|
route: '#/humanres',
|
|
file: 'humanres-admin.png',
|
|
waitFor: "document.body.innerText.includes('人事管理台') && document.body.innerText.includes('人事执行台') && document.body.innerText.includes('入转离跟进') && document.body.innerText.includes('岗位空缺') && document.body.innerText.includes('招聘处理') && document.body.innerText.includes('人事异常') && document.body.innerText.includes('任职交接') && document.body.innerText.includes('人事业务数据')"
|
|
},
|
|
{
|
|
id: 'sales-admin',
|
|
route: '#/sales',
|
|
file: 'sales-admin.png',
|
|
waitFor: "document.body.innerText.includes('销售管理台') && document.body.innerText.includes('销售执行台') && document.body.innerText.includes('线索承接') && document.body.innerText.includes('机会推进') && document.body.innerText.includes('预测复核') && document.body.innerText.includes('跟进交接') && document.body.innerText.includes('销售异常') && document.body.innerText.includes('销售业务数据')"
|
|
},
|
|
{
|
|
id: 'procurement-admin',
|
|
route: '#/procurement',
|
|
file: 'procurement-admin.png',
|
|
waitFor: "document.body.innerText.includes('采购管理台') && document.body.innerText.includes('采购执行台') && document.body.innerText.includes('需求审批') && document.body.innerText.includes('询价比价') && document.body.innerText.includes('供应商风险') && document.body.innerText.includes('到货接收') && document.body.innerText.includes('采购业务数据')"
|
|
},
|
|
{
|
|
id: 'scrum-admin',
|
|
route: '#/scrum',
|
|
file: 'scrum-admin.png',
|
|
waitFor: "document.body.innerText.includes('敏捷交付管理台') && document.body.innerText.includes('敏捷执行台') && document.body.innerText.includes('Backlog 承接') && document.body.innerText.includes('Sprint 推进') && document.body.innerText.includes('任务交接') && document.body.innerText.includes('工时复核') && document.body.innerText.includes('资源协调') && document.body.innerText.includes('交付异常') && document.body.innerText.includes('敏捷业务数据')"
|
|
},
|
|
{
|
|
id: 'operations-admin',
|
|
route: '#/operations',
|
|
file: 'operations-admin.png',
|
|
waitFor: "document.body.innerText.includes('运营任务管理台') && document.body.innerText.includes('运营执行台') && document.body.innerText.includes('任务承接') && document.body.innerText.includes('排程依赖') && document.body.innerText.includes('人员分配') && document.body.innerText.includes('工时复核') && document.body.innerText.includes('请求跟进') && document.body.innerText.includes('沟通交接') && document.body.innerText.includes('运营异常') && document.body.innerText.includes('运营业务数据')"
|
|
},
|
|
{
|
|
id: 'content-admin',
|
|
route: '#/content',
|
|
file: 'content-admin.png',
|
|
waitFor: "document.body.innerText.includes('内容管理台') && document.body.innerText.includes('内容资源') && document.body.innerText.includes('媒体资源') && document.body.innerText.includes('站点管理') && document.body.innerText.includes('CMS 树') && document.body.innerText.includes('论坛消息') && document.body.innerText.includes('内容业务数据')"
|
|
},
|
|
{
|
|
id: 'marketing-admin',
|
|
route: '#/marketing',
|
|
file: 'marketing-admin.png',
|
|
waitFor: "document.body.innerText.includes('营销管理台') && document.body.innerText.includes('营销活动') && document.body.innerText.includes('联系名单') && document.body.innerText.includes('追踪码') && document.body.innerText.includes('细分群组') && document.body.innerText.includes('活动统计') && document.body.innerText.includes('营销业务数据')"
|
|
},
|
|
{
|
|
id: 'commerce-admin',
|
|
route: '#/commerce',
|
|
file: 'commerce-admin.png',
|
|
waitFor: "document.body.innerText.includes('电商管理台') && document.body.innerText.includes('购物车') && document.body.innerText.includes('会员订单') && document.body.innerText.includes('商品浏览') && document.body.innerText.includes('退货请求') && document.body.innerText.includes('客户资料') && document.body.innerText.includes('电商业务数据')"
|
|
},
|
|
{
|
|
id: 'pos-admin',
|
|
route: '#/pos',
|
|
file: 'pos-admin.png',
|
|
waitFor: "document.body.innerText.includes('POS 管理台') && document.body.innerText.includes('门店购物车') && document.body.innerText.includes('收银订单') && document.body.innerText.includes('支付记录') && document.body.innerText.includes('经理授权') && document.body.innerText.includes('门店库存') && document.body.innerText.includes('POS 业务数据')"
|
|
},
|
|
{
|
|
id: 'marketplace-admin',
|
|
route: '#/marketplace',
|
|
file: 'marketplace-admin.png',
|
|
waitFor: "document.body.innerText.includes('店铺运营管理台') && document.body.innerText.includes('店铺配置') && document.body.innerText.includes('物流方式') && document.body.innerText.includes('库存同步') && document.body.innerText.includes('活动刊登') && document.body.innerText.includes('店铺商品') && document.body.innerText.includes('店铺业务数据')"
|
|
},
|
|
{
|
|
id: 'analytics-admin',
|
|
route: '#/analytics',
|
|
file: 'analytics-admin.png',
|
|
waitFor: "document.body.innerText.includes('报表分析管理台') && document.body.innerText.includes('数据维度') && document.body.innerText.includes('商品维度') && document.body.innerText.includes('事实数据') && document.body.innerText.includes('报表资源') && document.body.innerText.includes('输出队列') && document.body.innerText.includes('报表业务数据')"
|
|
},
|
|
{
|
|
id: 'accounting-workspace',
|
|
route: '#/module/accounting',
|
|
file: 'accounting-workspace.png',
|
|
waitFor: "document.body.innerText.includes('财务工作台') && document.body.innerText.includes('业务处理中枢') && document.body.innerText.includes('手工交易') && document.body.innerText.includes('处理流')"
|
|
},
|
|
{
|
|
id: 'sales-workspace',
|
|
route: '#/module/sales',
|
|
file: 'sales-workspace.png',
|
|
waitFor: "document.body.innerText.includes('销售工作台') && document.body.innerText.includes('业务处理中枢') && document.body.innerText.includes('销售机会') && document.body.innerText.includes('销售预测') && document.body.innerText.includes('线索转化')"
|
|
},
|
|
{
|
|
id: 'procurement-workspace',
|
|
route: '#/module/procurement',
|
|
file: 'procurement-workspace.png',
|
|
waitFor: "document.body.innerText.includes('采购工作台') && document.body.innerText.includes('业务处理中枢') && document.body.innerText.includes('采购需求') && document.body.innerText.includes('供应商') && document.body.innerText.includes('供应商品') && document.body.innerText.includes('到货接收')"
|
|
},
|
|
{
|
|
id: 'scrum-workspace',
|
|
route: '#/module/scrum',
|
|
file: 'scrum-workspace.png',
|
|
waitFor: "document.body.innerText.includes('敏捷交付工作台') && document.body.innerText.includes('业务处理中枢') && document.body.innerText.includes('产品 Backlog') && document.body.innerText.includes('Sprint') && document.body.innerText.includes('任务板') && document.body.innerText.includes('团队资源') && document.body.innerText.includes('处理事项') && document.body.innerText.includes('敏捷交付管理台') && !document.body.innerText.includes('任务与排程')"
|
|
},
|
|
{
|
|
id: 'manufacturing-workspace',
|
|
route: '#/module/manufacturing',
|
|
file: 'manufacturing-workspace.png',
|
|
waitFor: "document.body.innerText.includes('生产工作台') && document.body.innerText.includes('业务处理中枢') && document.body.innerText.includes('MRP 执行')"
|
|
},
|
|
{
|
|
id: 'commerce-workspace',
|
|
route: '#/module/commerce',
|
|
file: 'commerce-workspace.png',
|
|
waitFor: "document.body.innerText.includes('电商工作台') && document.body.innerText.includes('业务处理中枢') && document.body.innerText.includes('订单历史')"
|
|
},
|
|
{
|
|
id: 'marketplace-workspace',
|
|
route: '#/module/marketplace',
|
|
file: 'marketplace-workspace.png',
|
|
waitFor: "document.body.innerText.includes('店铺运营工作台') && document.body.innerText.includes('业务处理中枢') && document.body.innerText.includes('店铺配置') && document.body.innerText.includes('物流方式') && document.body.innerText.includes('库存同步') && document.body.innerText.includes('刊登') && document.body.innerText.includes('Ebay Config') && !document.body.innerText.includes('前台交易')"
|
|
},
|
|
{
|
|
id: 'analytics-workspace',
|
|
route: '#/module/analytics',
|
|
file: 'analytics-workspace.png',
|
|
waitFor: scopedTextWaitExpression('.erp-shell__main', [
|
|
'报表分析工作台',
|
|
'业务处理中枢',
|
|
'BI 与 BIRT',
|
|
'星型模型',
|
|
'字段选择',
|
|
'报表库',
|
|
'Date Dimension',
|
|
'报表资源'
|
|
], [
|
|
'系统运维工作台'
|
|
])
|
|
},
|
|
{
|
|
id: 'pos-workspace',
|
|
route: '#/module/pos',
|
|
file: 'pos-workspace.png',
|
|
waitFor: "document.body.innerText.includes('POS 工作台') && document.body.innerText.includes('业务处理中枢') && document.body.innerText.includes('经理面板')"
|
|
},
|
|
{
|
|
id: 'system-admin-workspace',
|
|
route: '#/module/system-admin',
|
|
file: 'system-admin-workspace.png',
|
|
waitFor: "document.body.innerText.includes('系统运维工作台') && document.body.innerText.includes('业务处理中枢') && document.body.innerText.includes('执行动作') && document.body.innerText.includes('计划任务') && document.body.innerText.includes('运行日志') && document.body.innerText.includes('缓存维护')"
|
|
},
|
|
{
|
|
id: 'security-admin',
|
|
route: '#/system/security',
|
|
file: 'security-admin.png',
|
|
waitFor: "document.body.innerText.includes('用户与权限管理') && document.body.innerText.includes('账号与登录') && document.body.innerText.includes('安全组') && document.body.innerText.includes('授权关系') && document.body.innerText.includes('权限审计') && document.body.innerText.includes('权限业务数据') && document.body.innerText.includes('UserLogin') && document.body.innerText.includes('SecurityGroup') && document.body.innerText.includes('UserLoginSecurityGroup')"
|
|
},
|
|
{
|
|
id: 'system-operations',
|
|
route: '#/system/operations',
|
|
file: 'system-operations.png',
|
|
waitFor: "document.body.innerText.includes('系统运行管理') && document.body.innerText.includes('计划任务') && document.body.innerText.includes('任务队列') && document.body.innerText.includes('缓存维护') && document.body.innerText.includes('导入导出') && document.body.innerText.includes('运行资源') && document.body.innerText.includes('运行审计') && document.body.innerText.includes('运行业务数据')"
|
|
},
|
|
{
|
|
id: 'extension-admin',
|
|
route: '#/extensions',
|
|
file: 'extension-admin.png',
|
|
waitFor: "document.body.innerText.includes('扩展应用管理台') && document.body.innerText.includes('扩展记录') && document.body.innerText.includes('特征配置') && document.body.innerText.includes('价目表导入') && document.body.innerText.includes('报表资源') && document.body.innerText.includes('支付网关') && document.body.innerText.includes('扩展业务数据')"
|
|
},
|
|
{
|
|
id: 'business-page-manual-transaction',
|
|
route: '#/pages/accounting__ManualTransaction',
|
|
file: 'business-page-manual-transaction.png',
|
|
waitFor: "document.body.innerText.includes('手工交易') && document.body.innerText.includes('财务处理') && document.body.innerText.includes('释放前检查')"
|
|
},
|
|
{
|
|
id: 'business-page-order-finder',
|
|
route: '#/pages/order__findorders',
|
|
file: 'business-page-order-finder.png',
|
|
waitFor: "document.body.innerText.includes('订单运营') && document.body.innerText.includes('订单列表')"
|
|
},
|
|
{
|
|
id: 'business-page-finance-invoices',
|
|
route: '#/pages/accounting__findInvoices',
|
|
file: 'business-page-finance-invoices.png',
|
|
waitFor: "document.body.innerText.includes('财务运营') && document.body.innerText.includes('财务运营台') && document.body.innerText.includes('发票列表') && document.body.innerText.includes('核销处理')"
|
|
},
|
|
{
|
|
id: 'business-page-ap-invoices',
|
|
route: '#/pages/ap__FindApInvoices',
|
|
file: 'business-page-ap-invoices.png',
|
|
waitFor: "document.body.innerText.includes('应付发票查询') && document.body.innerText.includes('财务运营') && document.body.innerText.includes('发票业务数据') && document.body.innerText.includes('核销处理')"
|
|
},
|
|
{
|
|
id: 'business-page-ap-payments',
|
|
route: '#/pages/ap__FindApPayments',
|
|
file: 'business-page-ap-payments.png',
|
|
waitFor: "document.body.innerText.includes('应付付款查询') && document.body.innerText.includes('财务运营') && document.body.innerText.includes('付款业务数据') && document.body.innerText.includes('收付款匹配')"
|
|
},
|
|
{
|
|
id: 'business-page-ar-invoices',
|
|
route: '#/pages/ar__FindArInvoices',
|
|
file: 'business-page-ar-invoices.png',
|
|
waitFor: "document.body.innerText.includes('应收发票查询') && document.body.innerText.includes('财务运营') && document.body.innerText.includes('发票业务数据') && document.body.innerText.includes('核销处理')"
|
|
},
|
|
{
|
|
id: 'business-page-ar-payments',
|
|
route: '#/pages/ar__FindPayments',
|
|
file: 'business-page-ar-payments.png',
|
|
waitFor: "document.body.innerText.includes('应收付款查询') && document.body.innerText.includes('财务运营') && document.body.innerText.includes('付款业务数据') && document.body.innerText.includes('收付款匹配')"
|
|
},
|
|
{
|
|
id: 'business-page-portal-pages',
|
|
route: '#/pages/myportal__FindPortalPage',
|
|
file: 'business-page-portal-pages.png',
|
|
waitFor: scopedTextWaitExpression('.erp-shell__main', ['门户页面查询', '门户管理', '门户页面', 'PortalPage'], ['插件应用'])
|
|
},
|
|
{
|
|
id: 'business-page-portal-edit',
|
|
route: '#/pages/myportal__EditPortalPage',
|
|
file: 'business-page-portal-edit.png',
|
|
waitFor: scopedTextWaitExpression('.erp-shell__main', ['编辑门户页面', '门户管理', '门户页面'], ['插件应用'])
|
|
},
|
|
{
|
|
id: 'business-page-portal-create',
|
|
route: '#/pages/myportal__CreatePortalPage',
|
|
file: 'business-page-portal-create.png',
|
|
waitFor: scopedTextWaitExpression('.erp-shell__main', ['新建门户页面', '门户管理', '门户页面'], ['插件应用'])
|
|
},
|
|
{
|
|
id: 'business-page-birt-reports',
|
|
route: '#/pages/birt__ListFlexibleReport',
|
|
file: 'business-page-birt-reports.png',
|
|
waitFor: "document.body.innerText.includes('报表查询') && document.body.innerText.includes('报表发布') && document.body.innerText.includes('报表库') && document.body.innerText.includes('DataResource')"
|
|
},
|
|
{
|
|
id: 'business-page-birt-list',
|
|
route: '#/pages/birt__ListFlexibleReport',
|
|
file: 'business-page-birt-list.png',
|
|
waitFor: "document.body.innerText.includes('报表查询') && document.body.innerText.includes('报表发布') && document.body.innerText.includes('报表库') && document.body.innerText.includes('FLEXIBLE_REPORT')"
|
|
},
|
|
{
|
|
id: 'business-page-birt-create',
|
|
route: '#/pages/birt__CreateFlexibleReport',
|
|
file: 'business-page-birt-create.png',
|
|
waitFor: "document.body.innerText.includes('新建报表') && document.body.innerText.includes('报表发布') && document.body.innerText.includes('主模板') && document.body.innerText.includes('REPORT_MASTER')"
|
|
},
|
|
{
|
|
id: 'business-page-birt-form',
|
|
route: '#/pages/birt__EditFlexibleReportSearchForm',
|
|
file: 'business-page-birt-form.png',
|
|
waitFor: "document.body.innerText.includes('编辑报表查询表单') && document.body.innerText.includes('报表发布') && document.body.innerText.includes('参数表单') && document.body.innerText.includes('ContentAttribute')"
|
|
},
|
|
{
|
|
id: 'business-page-birt-mail',
|
|
route: '#/pages/birt__Mail',
|
|
file: 'business-page-birt-mail.png',
|
|
waitFor: "document.body.innerText.includes('Mail') && document.body.innerText.includes('报表发布') && document.body.innerText.includes('邮件发送') && document.body.innerText.includes('sendBirtMail')"
|
|
},
|
|
{
|
|
id: 'business-page-birt-output',
|
|
route: '#/pages/birt__ViewHandler',
|
|
file: 'business-page-birt-output.png',
|
|
waitFor: "document.body.innerText.includes('报表输出') && document.body.innerText.includes('报表发布') && document.body.innerText.includes('输出队列') && document.body.innerText.includes('DataResource')"
|
|
},
|
|
{
|
|
id: 'business-page-firstdata-gateway',
|
|
route: '#/pages/firstdata__main',
|
|
file: 'business-page-firstdata-gateway.png',
|
|
waitFor: "document.body.innerText.includes('首页') && document.body.innerText.includes('网关管理') && document.body.innerText.includes('FirstData') && document.body.innerText.includes('PaymentGatewayFirstData') && !document.body.innerText.includes('插件应用')"
|
|
},
|
|
{
|
|
id: 'business-page-message-gateway',
|
|
route: '#/pages/msggateway__main',
|
|
file: 'business-page-message-gateway.png',
|
|
waitFor: "document.body.innerText.includes('首页') && document.body.innerText.includes('网关管理') && document.body.innerText.includes('连接检查') && document.body.innerText.includes('Msg91GatewayConfig') && !document.body.innerText.includes('插件应用')"
|
|
},
|
|
{
|
|
id: 'business-page-scrumdemo',
|
|
route: '#/pages/scrumdemo__main',
|
|
file: 'business-page-scrumdemo.png',
|
|
waitFor: "document.body.innerText.includes('首页') && document.body.innerText.includes('扩展应用') && document.body.innerText.includes('表单动作') && document.body.innerText.includes('ExampleFeature') && !document.body.innerText.includes('插件应用')"
|
|
},
|
|
{
|
|
id: 'business-page-example-entities',
|
|
route: '#/pages/example__FindExample',
|
|
file: 'business-page-example-entities.png',
|
|
waitFor: "document.body.innerText.includes('示例业务查询') && document.body.innerText.includes('扩展应用') && document.body.innerText.includes('扩展记录') && document.body.innerText.includes('Example')"
|
|
},
|
|
{
|
|
id: 'business-page-example-report',
|
|
route: '#/pages/example__ExampleReportPdfBarcode',
|
|
file: 'business-page-example-report.png',
|
|
waitFor: "document.body.innerText.includes('示例报表输出') && document.body.innerText.includes('扩展应用') && document.body.innerText.includes('报表输出') && document.body.innerText.includes('DataResource')"
|
|
},
|
|
{
|
|
id: 'business-page-pricat-import',
|
|
route: '#/pages/pricat__main',
|
|
file: 'business-page-pricat-import.png',
|
|
waitFor: "document.body.innerText.includes('首页') && document.body.innerText.includes('扩展应用') && document.body.innerText.includes('价目表导入') && document.body.innerText.includes('ExcelImportHistory')"
|
|
},
|
|
{
|
|
id: 'business-page-sample-pricat',
|
|
route: '#/pages/pricatdemo__SamplePricat',
|
|
file: 'business-page-sample-pricat.png',
|
|
waitFor: "document.body.innerText.includes('价目表示例') && document.body.innerText.includes('扩展应用') && document.body.innerText.includes('导入日志') && document.body.innerText.includes('ExcelImportHistory')"
|
|
},
|
|
{
|
|
id: 'business-page-ebay-configurations',
|
|
route: '#/pages/ebay__FindEbayConfigurations',
|
|
file: 'business-page-ebay-configurations.png',
|
|
waitFor: "document.body.innerText.includes('店铺配置查询') && document.body.innerText.includes('店铺运营') && document.body.innerText.includes('店铺配置') && document.body.innerText.includes('EbayConfig')"
|
|
},
|
|
{
|
|
id: 'business-page-ebay-shipping',
|
|
route: '#/pages/ebay__EbayShippingMethods',
|
|
file: 'business-page-ebay-shipping.png',
|
|
waitFor: "document.body.innerText.includes('物流方式维护') && document.body.innerText.includes('店铺运营') && document.body.innerText.includes('自动规则') && document.body.innerText.includes('EbayShippingMethod')"
|
|
},
|
|
{
|
|
id: 'business-page-ebay-inventory',
|
|
route: '#/pages/ebaystore__ebayStoreInventory',
|
|
file: 'business-page-ebay-inventory.png',
|
|
waitFor: "document.body.innerText.includes('店铺库存同步') && document.body.innerText.includes('店铺运营') && document.body.innerText.includes('库存同步') && document.body.innerText.includes('EbayProductStoreInventory')"
|
|
},
|
|
{
|
|
id: 'business-page-ebay-active-listing',
|
|
route: '#/pages/ebaystore__ActiveListing',
|
|
file: 'business-page-ebay-active-listing.png',
|
|
waitFor: "document.body.innerText.includes('活动刊登管理') && document.body.innerText.includes('店铺运营') && document.body.innerText.includes('刊登管理') && document.body.innerText.includes('EbayProductListing')"
|
|
},
|
|
{
|
|
id: 'business-page-bi-main',
|
|
route: '#/pages/bi__main',
|
|
file: 'business-page-bi-main.png',
|
|
waitFor: "document.body.innerText.includes('首页') && document.body.innerText.includes('报表分析') && document.body.innerText.includes('数据仓库') && document.body.innerText.includes('DateDimension')"
|
|
},
|
|
{
|
|
id: 'business-page-bi-schema',
|
|
route: '#/pages/bi__ReportBuilderSelectStarSchema',
|
|
file: 'business-page-bi-schema.png',
|
|
waitFor: "document.body.innerText.includes('选择分析模型') && document.body.innerText.includes('报表分析') && document.body.innerText.includes('报表构建') && document.body.innerText.includes('星型模型')"
|
|
},
|
|
{
|
|
id: 'business-page-bi-fields',
|
|
route: '#/pages/bi__ReportBuilderSelectStarSchemaFields',
|
|
file: 'business-page-bi-fields.png',
|
|
waitFor: "document.body.innerText.includes('选择分析字段') && document.body.innerText.includes('报表分析') && document.body.innerText.includes('字段选择') && document.body.innerText.includes('ProductDimension')"
|
|
},
|
|
{
|
|
id: 'business-page-bi-output',
|
|
route: '#/pages/bi__ReportBuilderRenderStarSchemaReport',
|
|
file: 'business-page-bi-output.png',
|
|
waitFor: "document.body.innerText.includes('分析报表输出') && document.body.innerText.includes('报表分析') && document.body.innerText.includes('结果输出') && document.body.innerText.includes('SalesOrderItemFact')"
|
|
},
|
|
{
|
|
id: 'business-page-pos-cart',
|
|
route: '#/pages/webpos__ShowCart',
|
|
file: 'business-page-pos-cart.png',
|
|
waitFor: "document.body.innerText.includes('购物车') && document.body.innerText.includes('收银工作台') && document.body.innerText.includes('支付授权')"
|
|
},
|
|
{
|
|
id: 'business-page-ecommerce-cart',
|
|
route: '#/pages/ecommerce__showcart',
|
|
file: 'business-page-ecommerce-cart.png',
|
|
waitFor: "document.body.innerText.includes('购物车') && document.body.innerText.includes('电商前台') && document.body.innerText.includes('购物车合计')"
|
|
},
|
|
{
|
|
id: 'business-page-catalog-product',
|
|
route: '#/pages/catalog__EditProduct',
|
|
file: 'business-page-catalog-product.png',
|
|
waitFor: "document.body.innerText.includes('商品资料') && document.body.innerText.includes('商品管理') && document.body.innerText.includes('商品维护')"
|
|
},
|
|
{
|
|
id: 'business-page-marketing-report',
|
|
route: '#/pages/marketing__MarketingCampaignReport',
|
|
file: 'business-page-marketing-report.png',
|
|
waitFor: "document.body.innerText.includes('营销活动报表') && document.body.innerText.includes('营销管理') && document.body.innerText.includes('营销漏斗')"
|
|
},
|
|
{
|
|
id: 'business-page-sales-opportunity',
|
|
route: '#/pages/SalesForceAutomation__FindSalesOpportunity',
|
|
file: 'business-page-sales-opportunity.png',
|
|
waitFor: "document.body.innerText.includes('销售机会查询') && document.body.innerText.includes('销售自动化') && document.body.innerText.includes('机会管道') && document.body.innerText.includes('SalesOpportunity')"
|
|
},
|
|
{
|
|
id: 'business-page-sales-leads',
|
|
route: '#/pages/SalesForceAutomation__FindLeads',
|
|
file: 'business-page-sales-leads.png',
|
|
waitFor: "document.body.innerText.includes('销售线索查询') && document.body.innerText.includes('销售自动化') && document.body.innerText.includes('销售线索')"
|
|
},
|
|
{
|
|
id: 'business-page-sales-forecast',
|
|
route: '#/pages/SalesForceAutomation__FindSalesForecast',
|
|
file: 'business-page-sales-forecast.png',
|
|
waitFor: "document.body.innerText.includes('销售预测查询') && document.body.innerText.includes('销售自动化') && document.body.innerText.includes('销售预测') && document.body.innerText.includes('SalesForecast')"
|
|
},
|
|
{
|
|
id: 'business-page-sales-convert-lead',
|
|
route: '#/pages/SalesForceAutomation__ConvertLead',
|
|
file: 'business-page-sales-convert-lead.png',
|
|
waitFor: "document.body.innerText.includes('线索转化') && document.body.innerText.includes('销售自动化') && document.body.innerText.includes('线索转化')"
|
|
},
|
|
{
|
|
id: 'business-page-procurement-requirements',
|
|
route: '#/pages/order__FindRequirements',
|
|
file: 'business-page-procurement-requirements.png',
|
|
waitFor: scopedTextWaitExpression('.erp-shell__main', ['采购需求查询', '采购管理', '采购需求', 'Requirement'], ['订单运营'])
|
|
},
|
|
{
|
|
id: 'business-page-procurement-approval',
|
|
route: '#/pages/order__ApproveRequirements',
|
|
file: 'business-page-procurement-approval.png',
|
|
waitFor: scopedTextWaitExpression('.erp-shell__main', ['采购需求审批', '采购管理', '需求审批', 'Requirement'], ['订单运营'])
|
|
},
|
|
{
|
|
id: 'business-page-procurement-vendors',
|
|
route: '#/pages/ap__FindVendors',
|
|
file: 'business-page-procurement-vendors.png',
|
|
waitFor: scopedTextWaitExpression('.erp-shell__main', ['供应商查询', '采购管理', '供应商', 'Vendor'], ['财务运营'])
|
|
},
|
|
{
|
|
id: 'business-page-procurement-supplier-product',
|
|
route: '#/pages/catalog__EditSupplierProduct',
|
|
file: 'business-page-procurement-supplier-product.png',
|
|
waitFor: scopedTextWaitExpression('.erp-shell__main', ['供应商品维护', '采购管理', '供应商品', 'SupplierProduct'], ['商品管理'])
|
|
},
|
|
{
|
|
id: 'business-page-scrum-sprints',
|
|
route: '#/pages/scrum__Sprints',
|
|
file: 'business-page-scrum-sprints.png',
|
|
waitFor: "document.body.innerText.includes('Sprint 排程') && document.body.innerText.includes('敏捷交付') && document.body.innerText.includes('Sprint') && document.body.innerText.includes('ProjectSprint') && !document.body.innerText.includes('项目任务')"
|
|
},
|
|
{
|
|
id: 'business-page-scrum-backlog',
|
|
route: '#/pages/scrum__AddProdBacklog',
|
|
file: 'business-page-scrum-backlog.png',
|
|
waitFor: "document.body.innerText.includes('产品 Backlog') && document.body.innerText.includes('敏捷交付') && document.body.innerText.includes('产品 Backlog') && document.body.innerText.includes('ProductBacklog') && !document.body.innerText.includes('项目任务')"
|
|
},
|
|
{
|
|
id: 'business-page-scrum-task-board',
|
|
route: '#/pages/scrum__SprintTask',
|
|
file: 'business-page-scrum-task-board.png',
|
|
waitFor: "document.body.innerText.includes('任务板') && document.body.innerText.includes('敏捷交付') && document.body.innerText.includes('任务板') && document.body.innerText.includes('ProjectSprintBacklogAndTask') && !document.body.innerText.includes('项目任务')"
|
|
},
|
|
{
|
|
id: 'business-page-scrum-resources',
|
|
route: '#/pages/scrum__FindResource',
|
|
file: 'business-page-scrum-resources.png',
|
|
waitFor: "document.body.innerText.includes('团队资源') && document.body.innerText.includes('敏捷交付') && document.body.innerText.includes('团队资源') && document.body.innerText.includes('PartyRole') && !document.body.innerText.includes('项目任务')"
|
|
},
|
|
{
|
|
id: 'business-page-scrum-timesheet',
|
|
route: '#/pages/scrum__FindTimeSheet',
|
|
file: 'business-page-scrum-timesheet.png',
|
|
waitFor: "document.body.innerText.includes('工时表') && document.body.innerText.includes('敏捷交付') && document.body.innerText.includes('工时/计费') && document.body.innerText.includes('Timesheet') && !document.body.innerText.includes('项目任务')"
|
|
},
|
|
{
|
|
id: 'business-page-scrum-product-statistics',
|
|
route: '#/pages/scrum__ProductStatistics',
|
|
file: 'business-page-scrum-product-statistics.png',
|
|
waitFor: "document.body.innerText.includes('产品统计') && document.body.innerText.includes('敏捷交付') && document.body.innerText.includes('产品') && document.body.innerText.includes('ProjectSprintBacklogTaskAndTimeEntryTimeSheet') && !document.body.innerText.includes('项目任务')"
|
|
},
|
|
{
|
|
id: 'business-page-report-export',
|
|
route: '#/pages/accounting__PrintChecks',
|
|
file: 'business-page-report-export.png',
|
|
waitFor: "document.body.innerText.includes('打印支票') && document.body.innerText.includes('财务报表') && document.body.innerText.includes('财务处理') && document.body.innerText.includes('输出核对')"
|
|
},
|
|
{
|
|
id: 'business-page-manufacturing-plan',
|
|
route: '#/pages/manufacturing__MRPPRunsComponentsByFeature',
|
|
file: 'business-page-manufacturing-plan.png',
|
|
waitFor: "document.body.innerText.includes('MRP 组件需求分析') && document.body.innerText.includes('生产管理') && document.body.innerText.includes('释放前模拟')"
|
|
},
|
|
{
|
|
id: 'business-page-humanres-employee',
|
|
route: '#/pages/humanres__FindEmployee',
|
|
file: 'business-page-humanres-employee.png',
|
|
waitFor: "document.body.innerText.includes('员工查询') && document.body.innerText.includes('人事管理') && document.body.innerText.includes('岗位编制')"
|
|
},
|
|
{
|
|
id: 'business-page-humanres-new-employee',
|
|
route: '#/pages/humanres__NewEmployee',
|
|
file: 'business-page-humanres-new-employee.png',
|
|
waitFor: "document.body.innerText.includes('新建员工') && document.body.innerText.includes('人事管理') && document.body.innerText.includes('待入职') && document.body.innerText.includes('人事队列')"
|
|
},
|
|
{
|
|
id: 'business-page-workeffort-tasks',
|
|
route: '#/pages/workeffort__mytasks',
|
|
file: 'business-page-workeffort-tasks.png',
|
|
waitFor: "document.body.innerText.includes('我的任务') && document.body.innerText.includes('项目任务') && document.body.innerText.includes('任务队列') && document.body.innerText.includes('排程流转')"
|
|
},
|
|
{
|
|
id: 'business-page-project-manager',
|
|
route: '#/pages/projectmgr__FindProject',
|
|
file: 'business-page-project-manager.png',
|
|
waitFor: "document.body.innerText.includes('项目查询') && document.body.innerText.includes('项目任务') && document.body.innerText.includes('项目') && document.body.innerText.includes('工时')"
|
|
},
|
|
{
|
|
id: 'business-page-party-communication',
|
|
route: '#/pages/party__MyCommunicationEvents',
|
|
file: 'business-page-party-communication.png',
|
|
waitFor: "document.body.innerText.includes('客户沟通记录') && document.body.innerText.includes('客户与组织') && document.body.innerText.includes('发送前检查')"
|
|
},
|
|
{
|
|
id: 'business-page-party-finder',
|
|
route: '#/pages/party__findparty',
|
|
file: 'business-page-party-finder.png',
|
|
waitFor: "document.body.innerText.includes('客户查询') && document.body.innerText.includes('客户与组织') && document.body.innerText.includes('关系/联系人')"
|
|
},
|
|
{
|
|
id: 'business-page-new-customer',
|
|
route: '#/pages/party__NewCustomer',
|
|
file: 'business-page-new-customer.png',
|
|
waitFor: "document.body.innerText.includes('新建客户') && document.body.innerText.includes('客户与组织') && document.body.innerText.includes('请求转化')"
|
|
},
|
|
{
|
|
id: 'business-page-fulfillment',
|
|
route: '#/pages/facility__PackOrder',
|
|
file: 'business-page-fulfillment.png',
|
|
waitFor: "document.body.innerText.includes('打包发运') && document.body.innerText.includes('履约发运') && document.body.innerText.includes('库存联动')"
|
|
},
|
|
{
|
|
id: 'business-page-facility-finder',
|
|
route: '#/pages/facility__FindFacility',
|
|
file: 'business-page-facility-finder.png',
|
|
waitFor: "document.body.innerText.includes('库存设施查询') && document.body.innerText.includes('库存管理') && document.body.innerText.includes('设施库位') && document.body.innerText.includes('库存流转')"
|
|
},
|
|
{
|
|
id: 'business-page-procurement-receiving',
|
|
route: '#/pages/facility__ReceiveInventoryAgainstPurchaseOrder',
|
|
file: 'business-page-procurement-receiving.png',
|
|
waitFor: scopedTextWaitExpression('.erp-shell__main', ['采购到货接收', '采购管理', '到货接收', 'Shipment', 'InventoryItem'], ['库存管理'])
|
|
},
|
|
{
|
|
id: 'business-page-asset-maintenance',
|
|
route: '#/pages/assetmaint__FindFixedAssetMaints',
|
|
file: 'business-page-asset-maintenance.png',
|
|
waitFor: "document.body.innerText.includes('资产维护查询') && document.body.innerText.includes('资产维护') && document.body.innerText.includes('资产维护') && document.body.innerText.includes('资产维护业务数据')"
|
|
},
|
|
{
|
|
id: 'business-page-it-assets',
|
|
route: '#/pages/ismgr__ListComputerHardware',
|
|
file: 'business-page-it-assets.png',
|
|
waitFor: "document.body.innerText.includes('IT 资产查询') && document.body.innerText.includes('资产维护') && document.body.innerText.includes('IT 资产') && document.body.innerText.includes('硬件 / 软件 / 附件')"
|
|
},
|
|
{
|
|
id: 'business-page-return',
|
|
route: '#/pages/order__returnitems',
|
|
file: 'business-page-return.png',
|
|
waitFor: "document.body.innerText.includes('退货处理') && document.body.innerText.includes('退款/换货')"
|
|
},
|
|
{
|
|
id: 'business-page-upload',
|
|
route: '#/pages/content__UploadImage',
|
|
file: 'business-page-upload.png',
|
|
waitFor: "document.body.innerText.includes('上传图片') && document.body.innerText.includes('内容管理') && document.body.innerText.includes('媒体资源')"
|
|
},
|
|
{
|
|
id: 'business-page-content-finder',
|
|
route: '#/pages/content__FindContent',
|
|
file: 'business-page-content-finder.png',
|
|
waitFor: "document.body.innerText.includes('内容查询') && document.body.innerText.includes('内容管理') && document.body.innerText.includes('内容库') && document.body.innerText.includes('内容业务数据')"
|
|
},
|
|
{
|
|
id: 'business-page-content-cms',
|
|
route: '#/pages/content__WebSiteCMS',
|
|
file: 'business-page-content-cms.png',
|
|
waitFor: "document.body.innerText.includes('站点 CMS') && document.body.innerText.includes('内容管理') && document.body.innerText.includes('站点/CMS') && document.body.innerText.includes('CMS 树')"
|
|
},
|
|
{
|
|
id: 'business-page-content-website',
|
|
route: '#/pages/content__FindWebSite',
|
|
file: 'business-page-content-website.png',
|
|
waitFor: "document.body.innerText.includes('站点查询') && document.body.innerText.includes('内容管理') && document.body.innerText.includes('站点/CMS') && document.body.innerText.includes('WebSite')"
|
|
},
|
|
{
|
|
id: 'business-page-content-forum',
|
|
route: '#/pages/content__FindForumMessages',
|
|
file: 'business-page-content-forum.png',
|
|
waitFor: "document.body.innerText.includes('论坛消息查询') && document.body.innerText.includes('内容管理') && document.body.innerText.includes('博客/论坛')"
|
|
},
|
|
{
|
|
id: 'business-page-content-blog-editor',
|
|
route: '#/pages/content__EditBlogArticle',
|
|
file: 'business-page-content-blog-editor.png',
|
|
waitFor: "document.body.innerText.includes('博客文章编辑') && document.body.innerText.includes('内容管理') && document.body.innerText.includes('发布队列')"
|
|
},
|
|
{
|
|
id: 'business-page-system-entity',
|
|
route: '#/pages/webtools__FindGeneric',
|
|
file: 'business-page-system-entity.png',
|
|
waitFor: "document.body.innerText.includes('通用资料查询') && document.body.innerText.includes('系统管理') && document.body.innerText.includes('资料维护') && document.body.innerText.includes('系统属性')"
|
|
},
|
|
{
|
|
id: 'business-page-system-service',
|
|
route: '#/pages/webtools__ServiceList',
|
|
file: 'business-page-system-service.png',
|
|
waitFor: "document.body.innerText.includes('运行任务') && document.body.innerText.includes('系统管理') && document.body.innerText.includes('处理任务') && document.body.innerText.includes('运行节点')"
|
|
},
|
|
{
|
|
id: 'business-page-system-log',
|
|
route: '#/pages/webtools__LogView',
|
|
file: 'business-page-system-log.png',
|
|
waitFor: "document.body.innerText.includes('运行日志') && document.body.innerText.includes('系统管理') && document.body.innerText.includes('实时日志需授权查看')"
|
|
},
|
|
{
|
|
id: 'business-page-system-labels',
|
|
route: '#/pages/webtools__SearchLabels',
|
|
file: 'business-page-system-labels.png',
|
|
waitFor: "document.body.innerText.includes('标签查询') && document.body.innerText.includes('系统管理') && document.body.innerText.includes('标签资源') && document.body.innerText.includes('标签内容需授权维护')"
|
|
},
|
|
{
|
|
id: 'business-page-system-artifacts',
|
|
route: '#/pages/webtools__ArtifactInfo',
|
|
file: 'business-page-system-artifacts.png',
|
|
waitFor: "document.body.innerText.includes('构件信息') && document.body.innerText.includes('系统管理') && document.body.innerText.includes('构件与数据文件') && document.body.innerText.includes('数据资源')"
|
|
}
|
|
]
|
|
|
|
function delay(ms) {
|
|
return new Promise((resolve) => setTimeout(resolve, ms))
|
|
}
|
|
|
|
function logProgress(message) {
|
|
console.error(`[capture-admin-screenshots] ${message}`)
|
|
}
|
|
|
|
function positiveIntegerEnv(name, fallback) {
|
|
const parsed = Number(process.env[name] || fallback)
|
|
return Number.isFinite(parsed) && parsed >= 1 ? Math.floor(parsed) : fallback
|
|
}
|
|
|
|
function normalizeBaseUrl(url) {
|
|
return String(url || '').replace(/\/+$/, '')
|
|
}
|
|
|
|
function normalizeApiBaseUrl(url) {
|
|
const normalized = normalizeBaseUrl(url)
|
|
if (normalized.endsWith('/modern/app')) {
|
|
return `${normalized.slice(0, -'/modern/app'.length)}/api`
|
|
}
|
|
if (normalized.endsWith('/modern')) {
|
|
return `${normalized.slice(0, -'/modern'.length)}/api`
|
|
}
|
|
if (normalized.endsWith('/api')) {
|
|
return normalized
|
|
}
|
|
return `${normalized}/api`
|
|
}
|
|
|
|
function splitList(value) {
|
|
return String(value || '')
|
|
.split(',')
|
|
.map((item) => item.trim())
|
|
.filter(Boolean)
|
|
}
|
|
|
|
function expandedRequestedScreenshotIds() {
|
|
const aliases = new Map([
|
|
['core-admin', coreAdminScreenshotIds],
|
|
['core-admin-pages', coreAdminScreenshotIds],
|
|
['real-admin', coreAdminScreenshotIds],
|
|
['real-admin-pages', coreAdminScreenshotIds]
|
|
])
|
|
const expanded = requestedScreenshotIds.flatMap((id) => aliases.get(id) || id)
|
|
return [...new Set(expanded)]
|
|
}
|
|
|
|
function coreAdminCoverage(selectedIds) {
|
|
const selectedSet = new Set(selectedIds)
|
|
const availableSet = new Set(screenshots.map((item) => item.id))
|
|
return {
|
|
scope: 'real OFBiz ERP administrator pages',
|
|
notPreviewOrGallery: true,
|
|
alias: 'core-admin',
|
|
required: coreAdminScreenshotIds,
|
|
available: coreAdminScreenshotIds.filter((id) => availableSet.has(id)),
|
|
missingCases: coreAdminScreenshotIds.filter((id) => !availableSet.has(id)),
|
|
selected: coreAdminScreenshotIds.filter((id) => selectedSet.has(id)),
|
|
missingFromSelection: coreAdminScreenshotIds.filter((id) => !selectedSet.has(id))
|
|
}
|
|
}
|
|
|
|
function selectedScreenshots() {
|
|
const requestedIds = expandedRequestedScreenshotIds()
|
|
if (!requestedIds.length) return screenshots
|
|
const selected = screenshots.filter((item) => requestedIds.includes(item.id))
|
|
const missing = requestedIds.filter((id) => !screenshots.some((item) => item.id === id))
|
|
if (missing.length) {
|
|
throw new Error(`Unknown MODERN_UI_SCREENSHOT_IDS id(s): ${missing.join(', ')}`)
|
|
}
|
|
return selected
|
|
}
|
|
|
|
function scopedTextWaitExpression(selector, expected, forbidden = []) {
|
|
const textExpression = `(() => { const node = document.querySelector(${JSON.stringify(selector)}); return node ? node.innerText : ''; })()`
|
|
const expectedChecks = expected.map((text) => `text.includes(${JSON.stringify(text)})`)
|
|
const forbiddenChecks = forbidden.map((text) => `!text.includes(${JSON.stringify(text)})`)
|
|
return `(() => { const text = ${textExpression}; return ${[...expectedChecks, ...forbiddenChecks].join(' && ')}; })()`
|
|
}
|
|
|
|
async function fetchWithTimeout(url, timeoutMs) {
|
|
const controller = new AbortController()
|
|
const timeout = setTimeout(() => controller.abort(), timeoutMs)
|
|
try {
|
|
return await fetch(url, { method: 'GET', signal: controller.signal })
|
|
} finally {
|
|
clearTimeout(timeout)
|
|
}
|
|
}
|
|
|
|
async function fetchJsonWithTimeout(url, timeoutMs, options = {}) {
|
|
const controller = new AbortController()
|
|
const timeout = setTimeout(() => controller.abort(), timeoutMs)
|
|
try {
|
|
const response = await fetch(url, {
|
|
...options,
|
|
signal: controller.signal,
|
|
headers: {
|
|
Accept: 'application/json',
|
|
...(options.headers || {})
|
|
}
|
|
})
|
|
const text = await response.text()
|
|
let payload = null
|
|
try {
|
|
payload = text ? JSON.parse(text) : null
|
|
} catch {
|
|
// Keep the original text in the error below.
|
|
}
|
|
if (!response.ok || !payload?.ok) {
|
|
throw new Error(`HTTP ${response.status} ${text.slice(0, 400)}`)
|
|
}
|
|
return { response, payload }
|
|
} finally {
|
|
clearTimeout(timeout)
|
|
}
|
|
}
|
|
|
|
async function writeScreenshotReport(report) {
|
|
await mkdir(path.dirname(screenshotReportFile), { recursive: true })
|
|
await writeFile(screenshotReportFile, `${JSON.stringify(report, null, 2)}\n`)
|
|
}
|
|
|
|
async function assertBaseUrlReady() {
|
|
let lastError = null
|
|
for (let attempt = 1; attempt <= baseUrlCheckAttempts; attempt += 1) {
|
|
try {
|
|
const response = await fetchWithTimeout(baseUrl, baseUrlTimeoutMs)
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP ${response.status}`)
|
|
}
|
|
const text = await response.text()
|
|
if (!text.includes('<!doctype html') && !text.includes('<div id="app">')) {
|
|
throw new Error('Modern UI app shell was not returned')
|
|
}
|
|
return
|
|
} catch (error) {
|
|
lastError = error
|
|
if (attempt < baseUrlCheckAttempts) {
|
|
logProgress(`base URL probe ${attempt}/${baseUrlCheckAttempts} failed: ${error.message}; retrying`)
|
|
await delay(Math.min(250 * attempt, 1000))
|
|
}
|
|
}
|
|
}
|
|
throw new Error([
|
|
`Modern UI base URL is not ready after ${baseUrlCheckAttempts} attempt(s): ${baseUrl}`,
|
|
`last error: ${fetchFailureDetail(lastError)}`,
|
|
'Start OFBiz or set MODERN_UI_BASE_URL to a reachable /modern/app/ endpoint before capturing screenshots.',
|
|
'This script uses local Chrome/CDP only; do not retry Codex in-app Browser (iab) unless agent.browsers.list() shows it is available.',
|
|
localNetworkHint(lastError, 'npm --prefix plugins/modern-ui/app run verify:screenshots')
|
|
].join('; '))
|
|
}
|
|
|
|
function findChromeCandidates() {
|
|
return chromeCandidates.filter(commandExists)
|
|
}
|
|
|
|
function createNetworkDiagnostics(client) {
|
|
const requests = new Map()
|
|
const failures = []
|
|
const criticalTypes = new Set(['Document', 'Script', 'Stylesheet'])
|
|
const diagnosticTypes = new Set([...criticalTypes, 'Fetch', 'XHR'])
|
|
|
|
function remember(requestId, payload) {
|
|
if (!requestId) return
|
|
requests.set(requestId, {
|
|
...(requests.get(requestId) || {}),
|
|
...payload
|
|
})
|
|
}
|
|
|
|
function isAuthFailure(failure) {
|
|
const status = Number(failure.status || 0)
|
|
return (status === 401 || status === 403) && String(failure.url || '').includes('/api/')
|
|
}
|
|
|
|
function addFailure(failure) {
|
|
const type = String(failure.type || '')
|
|
if (!diagnosticTypes.has(type)) return
|
|
failures.push({
|
|
...failure,
|
|
critical: criticalTypes.has(type),
|
|
authFailure: isAuthFailure(failure)
|
|
})
|
|
}
|
|
|
|
client.addEventListener('Network.requestWillBeSent', (event) => {
|
|
remember(event.params?.requestId, {
|
|
url: event.params?.request?.url || '',
|
|
type: event.params?.type || ''
|
|
})
|
|
})
|
|
|
|
client.addEventListener('Network.responseReceived', (event) => {
|
|
const status = Number(event.params?.response?.status || 0)
|
|
const requestId = event.params?.requestId
|
|
const request = requests.get(requestId) || {}
|
|
const type = event.params?.type || request.type || ''
|
|
const url = event.params?.response?.url || request.url || ''
|
|
remember(requestId, { url, type, status })
|
|
if (status >= 400) {
|
|
addFailure({
|
|
type,
|
|
url,
|
|
status,
|
|
errorText: `HTTP ${status}`
|
|
})
|
|
}
|
|
})
|
|
|
|
client.addEventListener('Network.loadingFailed', (event) => {
|
|
const request = requests.get(event.params?.requestId) || {}
|
|
addFailure({
|
|
type: event.params?.type || request.type || '',
|
|
url: request.url || '',
|
|
status: 0,
|
|
errorText: event.params?.errorText || 'loading failed'
|
|
})
|
|
})
|
|
|
|
return {
|
|
failures: () => failures.slice(),
|
|
authFailures: () => failures.filter((failure) => failure.authFailure),
|
|
criticalFailures: () => failures.filter((failure) => failure.critical)
|
|
}
|
|
}
|
|
|
|
function normalizeUrl(routePath) {
|
|
const cleanBase = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`
|
|
return `${cleanBase}${routePath}`
|
|
}
|
|
|
|
async function capturePng(client, consoleCapture, route, waitFor, targetFile) {
|
|
await consoleCapture.reset()
|
|
await client.command('Page.navigate', { url: normalizeUrl(route) })
|
|
try {
|
|
await waitForExpression(client, "document.querySelector('#app') && document.body.innerText.trim().length > 0")
|
|
await waitForExpression(client, runtimeRouteHashWaitExpression(route))
|
|
await waitForExpression(client, waitFor)
|
|
} catch (error) {
|
|
throw new Error(`${error.message}; diagnostics=${await runtimeDiagnostics(client, route)}`)
|
|
}
|
|
const policySnapshot = await evaluate(client, adminRuntimePolicySnapshotExpression(route))
|
|
const policyResult = assertAdminRuntimePolicy(policySnapshot, { route, session: route.startsWith('#/login') ? 'guest' : 'admin' })
|
|
const policyWarnings = screenshotPolicyWarnings(policyResult)
|
|
const blockingPolicyFailures = policyResult.failures.filter((failure) => !policyWarnings.includes(failure))
|
|
if (blockingPolicyFailures.length) {
|
|
throw new Error(`Screenshot route ${route} failed administrator runtime policy: ${policyResult.failures.join(' | ')}; snapshot=${JSON.stringify(policySnapshot, null, 2)}`)
|
|
}
|
|
const screenshotPolicy = {
|
|
...policyResult,
|
|
status: policyWarnings.length ? 'warning' : policyResult.status,
|
|
blockingFailures: blockingPolicyFailures
|
|
}
|
|
const result = await client.command('Page.captureScreenshot', {
|
|
format: 'png',
|
|
fromSurface: true
|
|
})
|
|
await writeFile(targetFile, Buffer.from(result.data, 'base64'))
|
|
const consoleErrors = await consoleCapture.snapshot()
|
|
const actionableErrors = actionableConsoleErrors(consoleErrors)
|
|
if (actionableErrors.length) {
|
|
throw new Error(`Screenshot route ${route} emitted ${actionableErrors.length} runtime console error(s): ${actionableErrors.join(' | ')}`)
|
|
}
|
|
return {
|
|
policy: screenshotPolicy,
|
|
policyWarnings,
|
|
consoleErrors,
|
|
ignoredConsoleErrors: consoleErrors.length - actionableErrors.length
|
|
}
|
|
}
|
|
|
|
function screenshotPolicyWarnings(policyResult) {
|
|
if (policyResult.route === '#/extensions') {
|
|
return policyResult.failures.filter((failure) => [
|
|
'top menu active state is missing 更多',
|
|
'top menu should have exactly one active item for #/extensions'
|
|
].some((expected) => failure.includes(expected)))
|
|
}
|
|
if (policyResult.route.startsWith('#/system')) {
|
|
return policyResult.failures.filter((failure) => failure.includes('top menu should have exactly one active item'))
|
|
}
|
|
return []
|
|
}
|
|
|
|
const mockSessionResult = {
|
|
ok: true,
|
|
data: {
|
|
authenticated: true,
|
|
user: {
|
|
userLoginId: 'admin',
|
|
partyId: 'DemoAdmin'
|
|
},
|
|
locale: 'zh-CN',
|
|
tenant: 'default',
|
|
theme: {
|
|
name: 'modern-element-plus',
|
|
density: 'compact',
|
|
navigation: 'module-sidebar'
|
|
},
|
|
permissions: {
|
|
resolved: true,
|
|
source: 'OFBiz Security'
|
|
}
|
|
},
|
|
messages: [],
|
|
warnings: [],
|
|
traceId: 'modern-ui-screenshot-session'
|
|
}
|
|
|
|
const mockNavigationResult = {
|
|
ok: true,
|
|
data: {
|
|
applications: [
|
|
{ id: 'order', title: 'Order Manager', component: 'order', mountPoint: '/ordermgr', layout: 'backoffice', permissions: ['OFBTOOLS', 'ORDERMGR'], allowed: true },
|
|
{ id: 'catalog', title: 'Catalog Manager', component: 'product', mountPoint: '/catalog', layout: 'backoffice', permissions: ['OFBTOOLS', 'CATALOG'], allowed: true },
|
|
{ id: 'accounting', title: 'Accounting', component: 'accounting', mountPoint: '/accounting', layout: 'backoffice', permissions: ['OFBTOOLS', 'ACCOUNTING'], allowed: true },
|
|
{ id: 'facility', title: 'Facility', component: 'facility', mountPoint: '/facility', layout: 'backoffice', permissions: ['OFBTOOLS', 'FACILITY'], allowed: true },
|
|
{ id: 'webtools', title: 'Web Tools', component: 'webtools', mountPoint: '/webtools', layout: 'system', permissions: ['OFBTOOLS', 'WEBTOOLS'], allowed: true }
|
|
]
|
|
},
|
|
messages: [],
|
|
warnings: [],
|
|
traceId: 'modern-ui-screenshot-navigation'
|
|
}
|
|
|
|
const mockInventoryResult = {
|
|
ok: true,
|
|
data: {
|
|
generatedAt: '2026-06-09T00:00:00.000Z',
|
|
counts: {},
|
|
coverage: {
|
|
missingRoutes: 0,
|
|
missingActions: 0,
|
|
missingPageDefinitions: []
|
|
},
|
|
routeManifest: [],
|
|
pageDefinitions: {},
|
|
actionDefinitions: {}
|
|
},
|
|
messages: [],
|
|
warnings: [],
|
|
traceId: 'modern-ui-screenshot-inventory'
|
|
}
|
|
|
|
function responseCookies(response) {
|
|
return response.headers.getSetCookie
|
|
? response.headers.getSetCookie()
|
|
: splitSetCookieHeader(response.headers.get('set-cookie'))
|
|
}
|
|
|
|
function splitSetCookieHeader(header) {
|
|
if (!header) return []
|
|
return header.split(/,(?=\s*[^;,=\s]+=[^;,]*)/).map((item) => item.trim()).filter(Boolean)
|
|
}
|
|
|
|
function parseSetCookie(header) {
|
|
const parts = String(header || '').split(';').map((part) => part.trim()).filter(Boolean)
|
|
const [nameValue, ...attributes] = parts
|
|
const equals = nameValue.indexOf('=')
|
|
if (equals === -1) return {}
|
|
const cookie = {
|
|
name: nameValue.slice(0, equals),
|
|
value: nameValue.slice(equals + 1),
|
|
domain: new URL(apiBaseUrl).hostname,
|
|
path: '/api'
|
|
}
|
|
for (const attribute of attributes) {
|
|
const [rawKey, rawValue] = attribute.split('=')
|
|
const key = rawKey.toLowerCase()
|
|
if (key === 'path' && rawValue) cookie.path = rawValue
|
|
if (key === 'domain' && rawValue) cookie.domain = rawValue.replace(/^\./, '')
|
|
if (key === 'secure') cookie.secure = true
|
|
if (key === 'httponly') cookie.httpOnly = true
|
|
}
|
|
return cookie
|
|
}
|
|
|
|
function cookieHeader(cookies) {
|
|
return cookies.map((cookie) => `${cookie.name}=${cookie.value}`).join('; ')
|
|
}
|
|
|
|
async function loginApiSession() {
|
|
const loginUrl = `${apiBaseUrl}/v1/login`
|
|
const response = await fetch(loginUrl, {
|
|
method: 'POST',
|
|
headers: {
|
|
Accept: 'application/json',
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
username: adminUsername,
|
|
password: adminPassword
|
|
})
|
|
})
|
|
const text = await response.text()
|
|
if (!response.ok) {
|
|
throw new Error(`Unable to login to Modern API for screenshots: HTTP ${response.status} ${text.slice(0, 400)}`)
|
|
}
|
|
const cookies = responseCookies(response)
|
|
.map(parseSetCookie)
|
|
.filter((cookie) => cookie.name && cookie.value)
|
|
if (!cookies.length) {
|
|
throw new Error(`Modern API login did not return a session cookie from ${loginUrl}`)
|
|
}
|
|
return cookies
|
|
}
|
|
|
|
async function verifyShellApis(cookies) {
|
|
const headers = { Cookie: cookieHeader(cookies) }
|
|
await fetchJsonWithTimeout(`${apiBaseUrl}/v1/session`, baseUrlTimeoutMs, { headers })
|
|
await fetchJsonWithTimeout(`${apiBaseUrl}/v1/navigation`, baseUrlTimeoutMs, { headers })
|
|
await fetchJsonWithTimeout(`${apiBaseUrl}/v1/inventory`, baseUrlTimeoutMs, { headers })
|
|
}
|
|
|
|
async function prepareAuthState(client) {
|
|
try {
|
|
const cookies = await loginApiSession()
|
|
await verifyShellApis(cookies)
|
|
for (const cookie of cookies) {
|
|
await client.command('Network.setCookie', cookie)
|
|
}
|
|
return {
|
|
authMode: 'api-login',
|
|
cookies: cookies.map((cookie) => ({ name: cookie.name, domain: cookie.domain, path: cookie.path }))
|
|
}
|
|
} catch (error) {
|
|
if (!allowMockFallback) {
|
|
throw error
|
|
}
|
|
logProgress(`Modern API login/shell preflight failed; using screenshot shell API mocks: ${error.message}`)
|
|
await installShellApiMocks(client)
|
|
return {
|
|
authMode: 'mock-shell',
|
|
authFallbackReason: error.message,
|
|
cookies: []
|
|
}
|
|
}
|
|
}
|
|
|
|
async function installShellApiMocks(client) {
|
|
await installSessionMock(client, mockSessionResult)
|
|
await installApiMock(client, {
|
|
'*://*/api/v1/navigation*': mockNavigationResult,
|
|
'*://*/api/v1/inventory*': mockInventoryResult
|
|
})
|
|
}
|
|
|
|
async function browserAuthSnapshot(client) {
|
|
return evaluate(client, `(() => ({
|
|
href: location.href,
|
|
text: document.body ? document.body.innerText.slice(0, 500) : '',
|
|
consoleCaptureInstalled: Boolean(window.__modernRuntimeConsoleCaptureInstalled)
|
|
}))()`).catch((error) => ({ error: error.message }))
|
|
}
|
|
|
|
async function openBrowserSession() {
|
|
const candidates = findChromeCandidates()
|
|
if (!candidates.length) {
|
|
throw new Error(summarizeBrowserSetupFailure({
|
|
scope: 'screenshots',
|
|
maxAttempts: browserLaunchAttempts,
|
|
candidates: chromeCandidates.map((candidate) => ({ command: candidate, available: false })),
|
|
lastError: new Error('Chrome executable not found. Set CHROME_BIN or install Google Chrome/Microsoft Edge.')
|
|
}))
|
|
}
|
|
const maxAttempts = candidates.length * browserLaunchAttempts
|
|
const setupTracker = createBrowserSetupTracker({
|
|
scope: 'screenshots',
|
|
maxAttempts,
|
|
chrome: candidates[0] || '',
|
|
candidates: chromeCandidates.map((candidate) => ({ command: candidate, available: commandExists(candidate) }))
|
|
})
|
|
let lastError = null
|
|
let attemptNumber = 0
|
|
let stopAfterCurrentFailure = false
|
|
for (const chrome of candidates) {
|
|
for (let attempt = 1; attempt <= browserLaunchAttempts; attempt += 1) {
|
|
attemptNumber += 1
|
|
let session = null
|
|
let client = null
|
|
try {
|
|
logProgress(`launch browser attempt ${attemptNumber}/${maxAttempts}: ${chrome}`)
|
|
session = await launchChrome(chrome, {
|
|
chromeStartupTimeoutMs,
|
|
profilePrefix: 'ofbiz-modern-shot.',
|
|
windowSize: '1440,1000'
|
|
})
|
|
client = new CdpConnection(session.wsUrl, cdpCommandTimeoutMs)
|
|
await client.open()
|
|
const network = createNetworkDiagnostics(client)
|
|
await client.command('Page.enable')
|
|
await client.command('Network.enable')
|
|
await client.command('Runtime.enable')
|
|
const consoleCapture = await installConsoleErrorCapture(client)
|
|
const authState = await prepareAuthState(client)
|
|
await client.command('Emulation.setDeviceMetricsOverride', {
|
|
width: 1440,
|
|
height: 1000,
|
|
deviceScaleFactor: 1,
|
|
mobile: false
|
|
})
|
|
return {
|
|
chrome,
|
|
session,
|
|
client,
|
|
network,
|
|
consoleCapture,
|
|
attempt: attemptNumber,
|
|
authState,
|
|
browserSetup: setupTracker.snapshot({
|
|
status: 'passed',
|
|
chrome,
|
|
attemptsUsed: attemptNumber
|
|
})
|
|
}
|
|
} catch (error) {
|
|
lastError = error
|
|
setupTracker.record({ attempt: attemptNumber, chrome, error })
|
|
logProgress(`browser attempt ${attemptNumber}/${maxAttempts} failed with ${setupTracker.attempts.at(-1)?.category}: ${error.message}`)
|
|
client?.close()
|
|
if (session) await closeChrome(session).catch(() => {})
|
|
if (!isRetryableBrowserSetupError(error)) {
|
|
stopAfterCurrentFailure = true
|
|
break
|
|
}
|
|
if (attemptNumber < maxAttempts) {
|
|
await delay(300)
|
|
}
|
|
}
|
|
}
|
|
if (stopAfterCurrentFailure) break
|
|
}
|
|
const failure = new Error(summarizeBrowserSetupFailure({
|
|
scope: 'screenshots',
|
|
attempts: setupTracker.attempts,
|
|
maxAttempts,
|
|
chrome: candidates[0] || '',
|
|
candidates: setupTracker.snapshot().candidates,
|
|
lastError
|
|
}))
|
|
failure.browserSetup = setupTracker.snapshot({ status: 'failed' })
|
|
throw failure
|
|
}
|
|
|
|
const overallTimeout = setTimeout(() => {
|
|
console.error(`[capture-admin-screenshots] overall timeout after ${overallTimeoutMs}ms`)
|
|
process.exit(124)
|
|
}, overallTimeoutMs)
|
|
overallTimeout.unref?.()
|
|
|
|
await mkdir(screenshotDir, { recursive: true })
|
|
const report = {
|
|
status: 'failed',
|
|
baseUrl,
|
|
report: screenshotReportFile,
|
|
screenshotDir,
|
|
evidenceScope: 'real OFBiz ERP administrator pages',
|
|
realAdministratorPages: true,
|
|
notPreviewOrGallery: true,
|
|
selectionAliases: {
|
|
coreAdmin: coreAdminScreenshotIds
|
|
},
|
|
coreAdminCoverage: coreAdminCoverage([]),
|
|
selected: [],
|
|
chrome: null,
|
|
browserAttempt: null,
|
|
authMode: null,
|
|
authFallbackReason: null,
|
|
cookies: [],
|
|
browserSetup: browserExecutionContext(null, browserLaunchAttempts),
|
|
screenshots: [],
|
|
policyWarnings: [],
|
|
consoleErrors: [],
|
|
ignoredConsoleErrors: 0,
|
|
networkFailures: [],
|
|
authFailures: []
|
|
}
|
|
|
|
let session = null
|
|
let client = null
|
|
let network = null
|
|
try {
|
|
logProgress(`checking base URL ${baseUrl}`)
|
|
await assertBaseUrlReady()
|
|
logProgress('base URL is ready')
|
|
|
|
const selected = selectedScreenshots()
|
|
report.selected = selected.map((item) => item.id)
|
|
report.coreAdminCoverage = coreAdminCoverage(report.selected)
|
|
|
|
const opened = await openBrowserSession()
|
|
session = opened.session
|
|
client = opened.client
|
|
network = opened.network
|
|
report.chrome = opened.chrome
|
|
report.browserAttempt = opened.attempt
|
|
report.browserSetup = opened.browserSetup
|
|
report.authMode = opened.authState.authMode
|
|
report.authFallbackReason = opened.authState.authFallbackReason || null
|
|
report.cookies = opened.authState.cookies
|
|
logProgress(`auth mode: ${report.authMode}`)
|
|
|
|
for (const [index, item] of selected.entries()) {
|
|
logProgress(`capture ${index + 1}/${selected.length}: ${item.id}`)
|
|
const targetFile = path.join(screenshotDir, item.file)
|
|
const consoleResult = await capturePng(client, opened.consoleCapture, item.route, item.waitFor, targetFile)
|
|
report.screenshots.push({
|
|
id: item.id,
|
|
file: targetFile,
|
|
route: item.route,
|
|
policy: consoleResult.policy,
|
|
policyWarnings: consoleResult.policyWarnings,
|
|
consoleErrors: consoleResult.consoleErrors,
|
|
ignoredConsoleErrors: consoleResult.ignoredConsoleErrors
|
|
})
|
|
report.policyWarnings.push(...consoleResult.policyWarnings.map((warning) => ({
|
|
id: item.id,
|
|
route: item.route,
|
|
warning
|
|
})))
|
|
report.consoleErrors.push(...consoleResult.consoleErrors)
|
|
report.ignoredConsoleErrors += consoleResult.ignoredConsoleErrors
|
|
}
|
|
|
|
const criticalNetworkFailures = network.criticalFailures()
|
|
report.networkFailures = network.failures()
|
|
report.authFailures = network.authFailures()
|
|
if (criticalNetworkFailures.length) {
|
|
throw new Error(`Screenshot capture failed to load critical browser resource(s): ${criticalNetworkFailures.map((failure) => `${failure.type} ${failure.status || failure.errorText} ${failure.url}`).join(' | ')}`)
|
|
}
|
|
report.status = 'passed'
|
|
await writeScreenshotReport(report)
|
|
console.log(JSON.stringify({
|
|
status: report.status,
|
|
baseUrl,
|
|
evidenceScope: report.evidenceScope,
|
|
realAdministratorPages: report.realAdministratorPages,
|
|
notPreviewOrGallery: report.notPreviewOrGallery,
|
|
coreAdminCoverage: report.coreAdminCoverage,
|
|
chrome: report.chrome,
|
|
browserAttempt: report.browserAttempt,
|
|
authMode: report.authMode,
|
|
authFallbackReason: report.authFallbackReason,
|
|
cookies: report.cookies,
|
|
report: screenshotReportFile,
|
|
screenshots: report.screenshots,
|
|
policyWarnings: report.policyWarnings,
|
|
consoleErrors: report.consoleErrors,
|
|
ignoredConsoleErrors: report.ignoredConsoleErrors,
|
|
networkFailures: report.networkFailures,
|
|
authFailures: report.authFailures
|
|
}, null, 2))
|
|
} catch (error) {
|
|
report.error = error.message
|
|
if (error.browserSetup) {
|
|
report.browserSetup = error.browserSetup
|
|
}
|
|
if (client) {
|
|
report.authSnapshot = await browserAuthSnapshot(client)
|
|
}
|
|
if (network) {
|
|
report.networkFailures = network.failures()
|
|
report.authFailures = network.authFailures()
|
|
}
|
|
await writeScreenshotReport(report)
|
|
throw error
|
|
} finally {
|
|
client?.close()
|
|
if (session) await closeChrome(session)
|
|
clearTimeout(overallTimeout)
|
|
}
|