Files
felhom.eu/documentation/audits/rehearsal-2026-10-20/tools/install_spec.py
T

19 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""install_spec.py APP [FIELD=VALUE ...] [--pw ENVNAME] — writes the ui.py steps for one app's install page:
open it, fill the named fields, fill every password box and its confirmation with the secret ENVNAME, press
„Telepítés indítása", wait for the result card (15 min), screenshot, print the text."""
import json, sys
app = sys.argv[1]; steps = [{"goto": f"https://felhom.tester4.test/apps/{app}/install"}, {"wait": 2000}]
pw = None
for a in sys.argv[2:]:
if a.startswith("--pw="):
pw = a[5:]
elif "=" in a:
k, v = a.split("=", 1)
steps.append({"select" if k.startswith("select:") else "fill": f"[name={k.split(':')[-1]}]", ("option" if k.startswith("select:") else "value"): v})
if pw:
steps += [{"fill_all": "input[data-field-type=password]", "env": pw}, {"fill_all": "input[data-confirm-for]", "env": pw}]
steps += [{"shot": f"{app}-1-form"}, {"click": "#deploy-form button[type=submit]"}, {"wait_for": "#deploy-result", "timeout": 900000},
{"wait": 3000}, {"shot": f"{app}-2-result"}, {"text": True}]
print(json.dumps({"size": "desktop", "lang": "hu", "state": "/root/work/state-dash.json", "out": "/root/shots/b3-apps", "steps": steps}))