Files
kefu/deploy/review-visibility-20260916/frontend_final_qa.py
T
2026-09-21 10:34:06 +08:00

23 lines
1.3 KiB
Python

from pathlib import Path
import hashlib,json,re
folder=Path('C:/kefu/deploy/review-visibility-20260916')
test=folder/'frontend-test.mjs'
s=test.read_text(encoding='utf-8')
needle="assert.match(await p.locator('.task-review-hint').innerText(),/先在企业微信核对是否已发出/);await p.close();"
assert s.count(needle)==1
s=s.replace(needle,"assert.match(await p.locator('.task-review-hint').innerText(),/先在企业微信核对是否已发出/);await p.screenshot({path:`${folder}/qa/${label}-uncertain-delivery.png`,scale:'css',fullPage:true});await p.close();")
test.write_text(s,encoding='utf-8')
manifest=json.loads((folder/'frontend-files.json').read_text(encoding='utf-8'))
checks=[]
for item in manifest:
root=Path(item['root'])
for entry in item['files']:
digest=hashlib.sha256((root/entry['path']).read_bytes()).hexdigest()
assert digest==entry['sha256'],f"Unexpected post-edit change: {root/entry['path']}"
html=(root/'assets/ui/zhenyang-ai-console.html').read_text(encoding='utf-8')
assert 'console-app.js?v=review1' in html
assert 'console-review.css?v=review1' in html
checks.append({'root':str(root),'filesMatchSavedManifest':True,'scriptAndReviewStylesCacheKey':'review1'})
(folder/'qa/frontend-final-files.json').write_text(json.dumps(checks,ensure_ascii=False,indent=2),encoding='utf-8')
print(json.dumps(checks,ensure_ascii=False))