fix(qa): 禁止后台验收启动系统 Google Chrome
This commit is contained in:
@@ -16,6 +16,8 @@ node live-native/build.mjs && node live-native/server.mjs
|
||||
|
||||
构建输出仅在本工作树 `admin/node_modules/.zyt-live-native/dist`。本机会话任务为 `local.zyt.live-native.bfc2`,可用 `launchctl remove local.zyt.live-native.bfc2` 停止,不设开机启动项。可选 `server.mjs --qa` 使用 5181 供隔离验收。
|
||||
|
||||
黑盒检查:`python3 live-native/browser_contract.py --host 127.0.0.1:5179 --chrome <Chromium路径> --out <本地截图目录>`。测试拦截所有非本机请求,仅用虚构登录/统计数据检查真实组件;不验证真实用户凭据或线上写入。
|
||||
黑盒检查:`python3 live-native/browser_contract.py --host 127.0.0.1:5179 --out <本地截图目录>`。测试拦截所有非本机请求,仅用虚构登录/统计数据检查真实组件;不验证真实用户凭据或线上写入。
|
||||
|
||||
分批 UI 验收:`node live-native/build.mjs v1-example` 只写入本机候选目录;`node live-native/server.mjs --qa v1-example` 在本机 5181 查看它。验收通过后运行 `node live-native/promote-local.mjs apply v1-example`;如需切回上版且当前仍是此构建,运行 `node live-native/promote-local.mjs restore v1-example`。每次应用使用唯一候选名。5179 的旧哈希资源继续可用,不涉及正式发布目录。
|
||||
|
||||
浏览器验收仅使用 Playwright 配套的 Chromium Headless Shell,不调用系统 Google Chrome。未安装专用引擎时,跳过浏览器验收;不要指定系统浏览器补跑。
|
||||
|
||||
@@ -222,12 +222,12 @@ def scenario(browser, args, wx, iam):
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--host", type=loopback, default="127.0.0.1:5179")
|
||||
parser.add_argument("--chrome", required=True)
|
||||
|
||||
parser.add_argument("--out", type=Path, help="Optional directory for offline screenshots")
|
||||
args = parser.parse_args()
|
||||
if args.out:
|
||||
args.out.mkdir(parents=True, exist_ok=True)
|
||||
with sync_playwright() as pw, pw.chromium.launch(executable_path=args.chrome, args=[
|
||||
with sync_playwright() as pw, pw.chromium.launch(headless=True, args=[
|
||||
"--disable-background-networking", "--disable-quic", "--no-proxy-server",
|
||||
"--host-resolver-rules=MAP * ~NOTFOUND, EXCLUDE 127.0.0.1",
|
||||
]) as browser:
|
||||
|
||||
@@ -251,13 +251,13 @@ def reader_checks(page, ui, fx, out, report):
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--host", type=loopback, default="127.0.0.1:5181")
|
||||
parser.add_argument("--chrome", required=True)
|
||||
|
||||
parser.add_argument("--out", type=Path)
|
||||
args = parser.parse_args()
|
||||
if args.out:
|
||||
args.out.mkdir(parents=True, exist_ok=True)
|
||||
report = {"checks": [], "errors": [], "business_writes": [], "fixtures": {}}
|
||||
with sync_playwright() as pw, pw.chromium.launch(headless=True, executable_path=args.chrome, args=[
|
||||
with sync_playwright() as pw, pw.chromium.launch(headless=True, args=[
|
||||
"--disable-background-networking", "--disable-quic", "--no-proxy-server",
|
||||
"--host-resolver-rules=MAP * ~NOTFOUND, EXCLUDE 127.0.0.1"]) as browser:
|
||||
for role in ("reader", "edit", "delete", "operator"):
|
||||
|
||||
@@ -186,10 +186,10 @@ def protected_startup(browser,host):
|
||||
|
||||
if __name__=="__main__":
|
||||
ap=argparse.ArgumentParser(description=__doc__);ap.add_argument("--host",type=loopback,default="127.0.0.1:5179")
|
||||
ap.add_argument("--chrome",required=True);ap.add_argument("--out",type=Path)
|
||||
ap.add_argument("--out",type=Path)
|
||||
a=ap.parse_args()
|
||||
if a.out: a.out.mkdir(parents=True,exist_ok=True)
|
||||
with sync_playwright() as pw,pw.chromium.launch(executable_path=a.chrome,headless=True,args=CHROME_ARGS) as browser:
|
||||
with sync_playwright() as pw,pw.chromium.launch(headless=True, args=CHROME_ARGS) as browser:
|
||||
report={"light":boot(browser,a.host,a.out,False),"dark_reduced":boot(browser,a.host,a.out,True,True),
|
||||
"journey":journey(browser,a.host,a.out),"asset_failure":failed_page(browser,a.host,a.out),"startup_guards":protected_startup(browser,a.host),"real_api_calls":0,"status":"PASS"}
|
||||
print(json.dumps(report,ensure_ascii=False))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Offline component test: real shared pagination SFC + installed Element Plus, no server or API."""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import tempfile
|
||||
@@ -125,9 +124,7 @@ def main():
|
||||
subprocess.run(['node','build.mjs'],cwd=root,check=True,stdout=subprocess.DEVNULL)
|
||||
dist=root/'dist'
|
||||
with sync_playwright() as pw:
|
||||
exe=os.environ.get('CHROME_BIN')
|
||||
mac='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
|
||||
browser=pw.chromium.launch(executable_path=exe or (mac if Path(mac).exists() else None),
|
||||
browser=pw.chromium.launch(headless=True,
|
||||
args=['--disable-background-networking'])
|
||||
page=browser.new_page()
|
||||
errors,requests=[],[]
|
||||
|
||||
@@ -399,14 +399,14 @@ def check(page, fixture, out):
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--host", type=loopback, default="127.0.0.1:5179")
|
||||
parser.add_argument("--chrome", required=True)
|
||||
|
||||
parser.add_argument("--out", type=Path, help="Optional local screenshots directory")
|
||||
args = parser.parse_args()
|
||||
if args.out:
|
||||
args.out.mkdir(parents=True, exist_ok=True)
|
||||
fixture = Fixture(args.host, False, False)
|
||||
setup_menu(fixture)
|
||||
with sync_playwright() as pw, pw.chromium.launch(executable_path=args.chrome, args=[
|
||||
with sync_playwright() as pw, pw.chromium.launch(headless=True, args=[
|
||||
"--disable-background-networking", "--disable-quic", "--no-proxy-server",
|
||||
"--host-resolver-rules=MAP * ~NOTFOUND, EXCLUDE 127.0.0.1"]) as browser:
|
||||
with browser.new_context(service_workers="block", viewport={"width": 1440, "height": 960},
|
||||
|
||||
@@ -310,13 +310,13 @@ def reader_checks(page, stats, fx, report, out):
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--host", type=loopback, default="127.0.0.1:5179")
|
||||
parser.add_argument("--chrome", required=True)
|
||||
|
||||
parser.add_argument("--out", type=Path, help="Write JSON and local screenshots to this directory")
|
||||
args = parser.parse_args()
|
||||
if args.out:
|
||||
args.out.mkdir(parents=True, exist_ok=True)
|
||||
report = {"checks": {}, "infrastructure_errors": []}
|
||||
with sync_playwright() as pw, pw.chromium.launch(executable_path=args.chrome, args=[
|
||||
with sync_playwright() as pw, pw.chromium.launch(headless=True, args=[
|
||||
"--disable-background-networking", "--disable-quic", "--no-proxy-server",
|
||||
"--host-resolver-rules=MAP * ~NOTFOUND, EXCLUDE 127.0.0.1"]) as browser:
|
||||
for role in ("reader", "edit", "delete"):
|
||||
|
||||
@@ -147,14 +147,14 @@ def exercise(page, fixture, out):
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--host", type=loopback, default="127.0.0.1:5179")
|
||||
parser.add_argument("--chrome", required=True)
|
||||
|
||||
parser.add_argument("--out", type=Path, help="Optional directory for local screenshots")
|
||||
args = parser.parse_args()
|
||||
if args.out:
|
||||
args.out.mkdir(parents=True, exist_ok=True)
|
||||
fixture = Fixture(args.host, False, False)
|
||||
register_menu(fixture)
|
||||
with sync_playwright() as pw, pw.chromium.launch(executable_path=args.chrome, args=[
|
||||
with sync_playwright() as pw, pw.chromium.launch(headless=True, args=[
|
||||
"--disable-background-networking", "--disable-quic", "--no-proxy-server",
|
||||
"--host-resolver-rules=MAP * ~NOTFOUND, EXCLUDE 127.0.0.1"]) as browser:
|
||||
with browser.new_context(service_workers="block", viewport={"width": 1440, "height": 960},
|
||||
|
||||
@@ -164,12 +164,12 @@ def run(browser, args, mobile):
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--host", type=loopback, default="127.0.0.1:5179")
|
||||
parser.add_argument("--chrome", required=True)
|
||||
|
||||
parser.add_argument("--out", type=Path)
|
||||
args = parser.parse_args()
|
||||
if args.out:
|
||||
args.out.mkdir(parents=True, exist_ok=True)
|
||||
with sync_playwright() as pw, pw.chromium.launch(executable_path=args.chrome, args=[
|
||||
with sync_playwright() as pw, pw.chromium.launch(headless=True, args=[
|
||||
"--disable-background-networking", "--disable-quic", "--no-proxy-server",
|
||||
"--host-resolver-rules=MAP * ~NOTFOUND, EXCLUDE 127.0.0.1"]) as browser:
|
||||
cases = [run(browser, args, mobile) for mobile in (False, True)]
|
||||
|
||||
Reference in New Issue
Block a user