Files
Investidor-V2/tools/portal-profile-installation-checks-qa.py
T
nala 01405cbf8a
tests / ci (push) Canceled after 0s
oportunidades 5
2026-10-10 14:15:28 +02:00

35 lines
2.7 KiB
Python

"""Isolated tests plus frontend checks; never claim browser acceptance."""
import json
import subprocess
import sys
from datetime import datetime, timezone
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
PRIVATE = ROOT / 'storage/app/private/investmoz-v2/portal-audit'
PHP = 'C:/Users/macbook/.config/investmoz/php-8.5.11/php.exe'
files = ['PortalProfileInstallationTest', 'OpportunityPublicationScopeTest', 'PortalProfileAccessTest', 'OpportunityCanonicalWorkflowTest', 'IndependentDocumentOperationsTest', 'TerritoryGeometryImportTest']
if '--installer-only' in sys.argv:
previous = PRIVATE / 'profile-installation-checks-qa.json'
archive = PRIVATE / 'profile-installation-regression-qa.json'
if previous.exists() and not archive.exists():
archive.write_bytes(previous.read_bytes())
files = ['PortalProfileInstallationTest', 'OpportunityPublicationScopeTest']
unit = subprocess.run([PHP, '-d', 'extension=C:/Users/macbook/.config/investmoz/php-8.5.11/ext/php_gd.dll', 'vendor/bin/phpunit', *['tests/Feature/' + f + '.php' for f in files], '--no-progress'], cwd=ROOT, capture_output=True)
try:
tests = json.loads(unit.stdout.decode('utf-8-sig'))
except Exception:
raise RuntimeError('Unit runner output was not a sanitized JSON receipt; output withheld')
(PRIVATE / 'profile-installation-unit-qa.json').write_text(json.dumps(tests, ensure_ascii=False, indent=2), encoding='utf-8')
assert unit.returncode == 0 and tests['result'] == 'passed' and tests.get('skipped', 0) == 0, 'QA tests failed; details retained privately'
types = subprocess.run(['cmd', '/c', 'npm.cmd', 'run', 'types:check'], cwd=ROOT, capture_output=True)
assert types.returncode == 0, 'TypeScript failed; output withheld'
result = subprocess.run([PHP, 'tools/portal-profile-installation-status-qa.php'], cwd=ROOT, capture_output=True)
assert result.returncode == 0, 'Guarded status failed; output withheld'
status = json.loads(result.stdout.decode('utf-8-sig'))
proof = {'result': 'passed', 'target': status['target'], 'code_hash': status['code_hash'], 'checked_at': datetime.now(timezone.utc).isoformat(),
'tests': tests, 'types_passed': True, 'scope': ('Final installation rollback guard and publication scopes; preceding regression is separately dated' if '--installer-only' in sys.argv else 'Installation, scope labels, profile/canonical/document/cartographic regression') + '; interface not observed',
'interface_observed': False, 'active_writes': 0}
(PRIVATE / 'profile-installation-checks-qa.json').write_text(json.dumps(proof, ensure_ascii=False, indent=2), encoding='utf-8')
print(json.dumps({'result': 'passed', 'tests': tests['tests'], 'assertions': tests['assertions'], 'types_passed': True, 'active_writes': 0}))