test(image-annotate): 真站 e2e 的 SRI 断言不再写死内容寻址文件名
断言原本要求 src 必须是 plugin-image-annotate.<hash12>.js,但带主干守卫的 合规发布通道 scripts/plugins-publish.sh 产出的是固定名 plugin-image-annotate.js (走 no-cache + ETag),于是发布成功后这条断言必红、其余 26 项全绿。 SRI 的实质要求是「带 integrity 且有值」,与命名策略无关,改为两种命名都接受。 1.7.0 实测:test 站 27 项全通。
This commit is contained in:
1 parent
3e76f2792e
commit
eb90939f11
1 file changed
+4
-1
@@ -93,7 +93,10 @@ check('从真实 KV 加载并启用(SRI 通过)', Boolean(active), JSON.stri
|
||||
check('线上版本 = package.json(' + WANT_VERSION + ')', Boolean(active && active.version === WANT_VERSION), active && active.version)
|
||||
|
||||
const scripts = await page.evaluate(() => Array.from(document.querySelectorAll('script[src*="/plugins/"]')).map((s) => ({ src: s.getAttribute('src'), integrity: s.getAttribute('integrity') || '' })))
|
||||
check('插件脚本用 SRI(sha256) 加载', scripts.some((s) => /^\/plugins\/plugin-image-annotate\.[a-f0-9]{12}\.js$/.test(s.src) && /^sha256-/.test(s.integrity)), JSON.stringify(scripts))
|
||||
// 文件名两种都合法:plugins-publish.mjs 产内容寻址名(.<hash12>.js,可 immutable 缓存),
|
||||
// plugins-publish.sh(带主干守卫的合规通道)产固定名(plugin-image-annotate.js,走 no-cache+ETag)。
|
||||
// 断言的关键是「必须带 integrity」,与命名策略无关。
|
||||
check('插件脚本用 SRI(sha256) 加载', scripts.some((s) => /^\/plugins\/plugin-image-annotate(\.[a-f0-9]{12})?\.js$/.test(s.src) && /^sha256-/.test(s.integrity)), JSON.stringify(scripts))
|
||||
|
||||
// ---------- 2) 打开工作区 + 节点存在 ----------
|
||||
await page.locator('.iwb-home-card:not(.iwb-home-new)').first().dblclick()
|
||||
|
||||
Reference in new issue
Block a user