Issue#6·F4: 下拉契约断言脚本 verify-select-contract.mjs(双主题 10 项:trigger 底 token 系/弹层 slate-800·白/圆角 12/选项密度 10-16/左对齐)+package.json verify:select 注册;10/10 全过;门禁 vitest 186/build/eslint/vue-tsc 全绿
This commit is contained in:
+2
-1
@@ -16,7 +16,8 @@
|
|||||||
"gen:dict": "cd .. && go run ./tools/gen-dict",
|
"gen:dict": "cd .. && go run ./tools/gen-dict",
|
||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"shot": "node scripts/shot.mjs",
|
"shot": "node scripts/shot.mjs",
|
||||||
"verify:layout": "node scripts/verify-layout.mjs"
|
"verify:layout": "node scripts/verify-layout.mjs",
|
||||||
|
"verify:select": "node scripts/verify-select-contract.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@element-plus/icons-vue": "^2.3.1",
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// verify-select-contract.mjs Issue#6·F4:下拉契约断言(chrome-session 铁律:channel chrome+独立 launch+单 page)
|
||||||
|
// 断言:F1 色调(trigger 底=token 系,暗=veil/亮=白;弹层底 slate-800/白;r12)/F2 密度与对齐(item 10/16+左)/选中底色式
|
||||||
|
import { chromium } from '../node_modules/playwright/index.mjs'
|
||||||
|
const sleep=(ms)=>new Promise(r=>setTimeout(r,ms))
|
||||||
|
const fails=[]
|
||||||
|
const ok=(c,m,v)=>{console.log((c?'✓ ':'✗ ')+m+(v!==undefined?` = ${v}`:''));if(!c)fails.push(m)}
|
||||||
|
const browser = await chromium.launch({ channel:'chrome', args:['--no-sandbox','--disable-gpu','--disable-dev-shm-usage'] })
|
||||||
|
const page = await browser.newPage({ viewport:{ width:1440, height:900 } })
|
||||||
|
await page.goto('http://127.0.0.1:5173/login',{waitUntil:'domcontentloaded'})
|
||||||
|
await page.getByTestId('login-username').fill(process.env.SHOT_USER ?? 's2demo')
|
||||||
|
await page.getByTestId('login-password').fill(process.env.SHOT_PASS ?? 'S2demo@2026')
|
||||||
|
await page.getByTestId('login-submit').click()
|
||||||
|
await page.waitForURL('**/home',{timeout:15000}); await sleep(1500)
|
||||||
|
async function probe(expect, label){
|
||||||
|
await page.goto('http://127.0.0.1:5173/account',{waitUntil:'domcontentloaded'}); await sleep(2500)
|
||||||
|
await page.locator('.el-select').first().click(); await sleep(1100)
|
||||||
|
const r = await page.evaluate(() => {
|
||||||
|
const trig=document.querySelector('.el-select__wrapper')
|
||||||
|
const dd=document.querySelector('.el-select-dropdown')
|
||||||
|
const pop=document.querySelector('.el-select__popper')
|
||||||
|
const it=dd?.querySelector('.el-select-dropdown__item')
|
||||||
|
const g=(e,k)=>e?getComputedStyle(e)[k]:'-'
|
||||||
|
return { trig:g(trig,'backgroundColor'), popBg:g(pop,'backgroundColor'), popR:g(pop,'borderRadius'),
|
||||||
|
pad:g(it,'padding'), align:g(it,'textAlign') }
|
||||||
|
})
|
||||||
|
ok(r.trig===expect.trig, `[${label}] trigger 底=token(${expect.trig})`, r.trig)
|
||||||
|
ok(r.popBg===expect.pop, `[${label}] 弹层底`, r.popBg)
|
||||||
|
ok(r.popR==='12px', `[${label}] 弹层圆角 12`, r.popR)
|
||||||
|
ok(r.pad==='10px 16px', `[${label}] 选项密度 10/16(契约 px-4 py-2.5)`, r.pad)
|
||||||
|
ok(r.align==='start', `[${label}] 选项左对齐`, r.align)
|
||||||
|
await page.keyboard.press('Escape'); await sleep(350)
|
||||||
|
}
|
||||||
|
await probe({trig:'rgba(148, 163, 184, 0.06)',pop:'rgb(30, 41, 59)'},'暗')
|
||||||
|
await page.getByTestId('dark-toggle').click(); await sleep(700)
|
||||||
|
await probe({trig:'rgb(255, 255, 255)',pop:'rgb(255, 255, 255)'},'亮')
|
||||||
|
await browser.close()
|
||||||
|
if(fails.length){console.error(`\n✗ ${fails.length} 项失败`);process.exit(1)}
|
||||||
|
console.log('\n✓ 下拉契约断言全通过')
|
||||||
Reference in New Issue
Block a user