- 将软著说明书占位图替换为线上系统实拍高清截图,并加入分模块 MP4 演示视频链接 - 新增登录、总体概况、项目库、分割工作区、AI 推理、GT Mask、导出、模板库、用户管理和退出登录截图素材 - 新增 4 段 1920x1080 系统使用演示视频,同时保留 Playwright 原始 WebM 录制文件 - 新增功能验证与素材清单,记录验证地址、截图文件、视频文件和非破坏性验证说明 - 新增可复用 Playwright 采集脚本,便于后续重新录制软著素材
94 lines
3.0 KiB
JavaScript
94 lines
3.0 KiB
JavaScript
import { chromium } from 'playwright';
|
|
import fs from 'node:fs/promises';
|
|
import path from 'node:path';
|
|
|
|
const BASE_URL = process.env.SEG_DEMO_URL || 'https://seg.huijutec.cn/';
|
|
const USERNAME = process.env.SEG_DEMO_USER || 'admin';
|
|
const PASSWORD = process.env.SEG_DEMO_PASSWORD || '123456';
|
|
const OUT_DIR = process.env.SEG_DEMO_OUT_DIR || path.resolve('新撰写软著文档/系统使用视频');
|
|
|
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
|
async function clickIfVisible(locator, timeout = 3000) {
|
|
try {
|
|
await locator.waitFor({ state: 'visible', timeout });
|
|
await locator.click();
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
async function showModule(page, title, dwell = 2200) {
|
|
await clickIfVisible(page.getByTitle(title).first(), 5000);
|
|
await page.waitForLoadState('networkidle').catch(() => {});
|
|
await sleep(dwell);
|
|
}
|
|
|
|
async function main() {
|
|
await fs.mkdir(OUT_DIR, { recursive: true });
|
|
const browser = await chromium.launch({
|
|
headless: true,
|
|
args: ['--window-size=1920,1080'],
|
|
});
|
|
const context = await browser.newContext({
|
|
viewport: { width: 1920, height: 1080 },
|
|
recordVideo: {
|
|
dir: OUT_DIR,
|
|
size: { width: 1920, height: 1080 },
|
|
},
|
|
});
|
|
const page = await context.newPage();
|
|
|
|
await page.goto(BASE_URL, { waitUntil: 'networkidle', timeout: 60000 });
|
|
await sleep(1200);
|
|
|
|
const usernameInput = page.locator('input[type="text"]').first();
|
|
const passwordInput = page.locator('input[type="password"]').first();
|
|
await usernameInput.fill(USERNAME);
|
|
await sleep(400);
|
|
await passwordInput.fill(PASSWORD);
|
|
await sleep(500);
|
|
await page.getByRole('button', { name: /安全登录|登录/ }).click();
|
|
await page.waitForLoadState('networkidle').catch(() => {});
|
|
await sleep(2500);
|
|
|
|
await showModule(page, '总体概况', 2500);
|
|
await showModule(page, '项目库', 2500);
|
|
|
|
const demoProject = page.getByText(/演视LC视频序列|演视DICOM序列|LC视频序列|DICOM序列/).first();
|
|
if (await clickIfVisible(demoProject, 3500)) {
|
|
await page.waitForLoadState('networkidle').catch(() => {});
|
|
await sleep(3000);
|
|
} else {
|
|
await showModule(page, '分割工作区', 3000);
|
|
}
|
|
|
|
await showModule(page, 'AI智能分割', 3000);
|
|
await showModule(page, '模板库', 3000);
|
|
await showModule(page, '分割工作区', 3000);
|
|
await showModule(page, '项目库', 2200);
|
|
await showModule(page, '总体概况', 2200);
|
|
|
|
if (await page.getByTitle('用户管理').count()) {
|
|
await showModule(page, '用户管理', 2600);
|
|
}
|
|
|
|
await sleep(1200);
|
|
const video = page.video();
|
|
await context.close();
|
|
await browser.close();
|
|
|
|
const videoPath = await video?.path();
|
|
if (!videoPath) throw new Error('Playwright did not produce a video file.');
|
|
const finalPath = path.resolve(OUT_DIR, '多模态影像及视频智能语义分割与标注系统-使用演示.webm');
|
|
await fs.rm(finalPath, { force: true });
|
|
await fs.rename(videoPath, finalPath);
|
|
console.log(finalPath);
|
|
}
|
|
|
|
main().catch((error) => {
|
|
console.error(error);
|
|
process.exit(1);
|
|
});
|