20 lines
1.8 KiB
Python
20 lines
1.8 KiB
Python
from pathlib import Path
|
|
from urllib.request import urlopen
|
|
from urllib.parse import urlsplit
|
|
from datetime import datetime,timezone
|
|
import json,hashlib,re
|
|
OUT=Path(__file__).resolve().parent;fixture=json.loads((OUT/'business-country-fixture.json').read_text(encoding='utf-8'));QA=Path(fixture['QA_source']);BASE='https://portal-investidor.test:18445';manifest=json.loads((QA/'public/build/manifest.json').read_text(encoding='utf-8'));assets=[]
|
|
with urlopen(fixture['URL'],timeout=30)as r:assert r.status==200 and r.headers.get('X-Investmoz-QA-Target')=='stability_consumers_20261011_084534_test:55441';body=r.read()
|
|
html=body.decode('utf-8');paths=[]
|
|
for value in re.findall(r'(?:src|href)="([^"]+)"',html):
|
|
u=urlsplit(value)
|
|
if u.path.startswith('/build/'):
|
|
assert not u.netloc or u.netloc=='portal-investidor.test:18445';assert not u.scheme or u.scheme=='https';paths.append(u.path)
|
|
entry=manifest['resources/js/pages/investment/business-interest.tsx'];paths.append('/build/'+entry['file']);assert paths
|
|
for path in sorted(set(paths)):
|
|
local=QA/'public'/path.lstrip('/');assert local.is_file() and local.resolve().is_relative_to((QA/'public/build').resolve())
|
|
with urlopen(BASE+path,timeout=30)as r:assert r.status==200;raw=r.read()
|
|
assert hashlib.sha256(raw).digest()==hashlib.sha256(local.read_bytes()).digest();assets.append({'path':path,'status':200,'sha256':hashlib.sha256(raw).hexdigest()})
|
|
proof={'at':datetime.now(timezone.utc).isoformat(),'result':'passed','base':BASE,'TLS_bypass':False,'served_new_form_chunk_matches_QA_build':True,'form_and_asset_URLs_use_QA_HTTPS':True,'assets':assets,'compiled_UI_executed_in_browser':False,'visual_accessibility_acceptance_pending':True,'active_writes':0}
|
|
(OUT/'business-feedback-assets.json').write_text(json.dumps(proof,indent=2),encoding='utf-8');print(json.dumps({k:v for k,v in proof.items()if k!='assets'}))
|