test: 新增统一回归运行器
新增 run-regressions.mjs 一键执行全部回归脚本,package.json 注册 npm test 入口与 test:fine-tune-create,page-surface 脚本适配统一运行。
This commit is contained in:
@@ -6,11 +6,12 @@ import { parse as parseTemplate } from '@vue/compiler-dom'
|
||||
import { parse as parseSfc } from '@vue/compiler-sfc'
|
||||
|
||||
const scriptDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const [globalStyles, routerSource, mainLayoutSource, trainingLogSource, fineTuneCreateSource] = await Promise.all([
|
||||
const [globalStyles, routerSource, mainLayoutSource, trainingLogSource, trainingOverviewSource, fineTuneCreateSource] = await Promise.all([
|
||||
readFile(path.resolve(scriptDir, '../src/styles/index.scss'), 'utf8'),
|
||||
readFile(path.resolve(scriptDir, '../src/router/index.ts'), 'utf8'),
|
||||
readFile(path.resolve(scriptDir, '../src/layouts/MainLayout.vue'), 'utf8'),
|
||||
readFile(path.resolve(scriptDir, '../src/views/system/TrainingLogView.vue'), 'utf8'),
|
||||
readFile(path.resolve(scriptDir, '../src/views/system/training-log/TrainingTaskOverview.vue'), 'utf8'),
|
||||
readFile(path.resolve(scriptDir, '../src/views/fine-tune/FineTuneCreateView.vue'), 'utf8'),
|
||||
])
|
||||
|
||||
@@ -70,8 +71,10 @@ const selfSurfaceRoutes = [
|
||||
'fine-tune',
|
||||
'model-eval',
|
||||
'model-inference',
|
||||
'model-inference/chat/:id',
|
||||
'model-manage',
|
||||
'data-process',
|
||||
'data-process/create',
|
||||
'dataset',
|
||||
]
|
||||
for (const routePath of selfSurfaceRoutes) {
|
||||
@@ -138,8 +141,8 @@ assert.doesNotMatch(
|
||||
const layoutContentBlock = extractCssBlock(mainLayoutStyle, '.layout-content')
|
||||
assert.match(layoutContentBlock, /background-color:\s*var\(--app-shell-bg\);/, '主内容区未使用灰色外层背景')
|
||||
|
||||
const pageCanvasBlock = extractCssBlock(mainLayoutStyle, '.page-canvas')
|
||||
assert.match(pageCanvasBlock, /min-height:\s*100%;/, '白色页面画布没有铺满可用高度')
|
||||
const pageCanvasBlock = extractCssBlock(mainLayoutStyle, '\n.page-canvas {')
|
||||
assert.match(pageCanvasBlock, /flex:\s*1 0 auto;/, '白色页面画布没有铺满可用高度')
|
||||
assert.match(pageCanvasBlock, /padding:\s*24px;/, '白色页面画布缺少统一内容内边距')
|
||||
assert.match(pageCanvasBlock, /border-radius:\s*16px;/, '白色页面画布圆角与参考不一致')
|
||||
assert.match(pageCanvasBlock, /background-color:\s*var\(--app-page-bg\);/, '全局页面画布未使用白色背景')
|
||||
@@ -174,7 +177,9 @@ assert.match(rootPageCardBlock, /background-color:\s*transparent;/, '页面根
|
||||
assert.match(rootPageCardBlock, /border-radius:\s*0\s*!important;/, '页面根卡片仍形成第二层圆角边界')
|
||||
assert.match(rootPageCardBlock, /box-shadow:\s*none\s*!important;/, '页面根卡片仍形成重复卡片层级')
|
||||
|
||||
const trainingLogStyle = parseSfc(trainingLogSource).descriptor.styles.map((item) => item.content).join('\n')
|
||||
const trainingLogStyle = [trainingLogSource, trainingOverviewSource]
|
||||
.flatMap((source) => parseSfc(source).descriptor.styles.map((item) => item.content))
|
||||
.join('\n')
|
||||
const businessSurfaceBlock = extractCssBlock(trainingLogStyle, '.profile-section,\n.runtime-panel')
|
||||
assert.match(
|
||||
businessSurfaceBlock,
|
||||
|
||||
Reference in New Issue
Block a user