diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/tui-golden.py | 101 |
1 files changed, 99 insertions, 2 deletions
diff --git a/scripts/tui-golden.py b/scripts/tui-golden.py index 25cfdc3..fbcfc57 100755 --- a/scripts/tui-golden.py +++ b/scripts/tui-golden.py @@ -56,6 +56,7 @@ KEYS = { "ctrlc": "\x03", "ctrln": "\x0e", "ctrlenter": "\x1b[27;5;13~", + "f5": "\x1b[15~", } # {org_name} {org_nr} {fy_label} {fy_start} {fy_end} are substituted at run @@ -64,7 +65,8 @@ SCENARIOS = [ { "name": "dashboard", "screen": "dashboard", - "expect": ["{org_name}", "{fy_label}", "{fy_start}", "{fy_end}"], + "expect": ["{org_name}", "{fy_label}", "{fy_start}", "{fy_end}", + "Företag", "Bolaget"], }, { "name": "audit-ok", @@ -211,6 +213,78 @@ SCENARIOS = [ }, ], }, + { + "name": "employees", + "screen": "employees", + "expect": ["Anställda", "Testanställd", "Ny anställd"], + }, + { + "name": "company", + "screen": "company", + "expect": ["Bolaget", "Fakturauppgifter", "E-post (SMTP)", + "Styrelseledamöter", "Test AB"], + "steps": [ + { + "keys": ["end", "up", "enter"], + "expect": ["E-post (SMTP)", "SMTP-server", + "lämna tomt för oförändrat"], + }, + { + "keys": ["esc"], + "expect": ["Bolaget", "Fakturauppgifter"], + }, + ], + }, + { + "name": "system", + "screen": "system", + "expect": ["Systeminställningar", "Bilagornas mapp"], + }, + { + "name": "tax-tables", + "screen": "tax_tables", + "expect": ["Skattetabeller", "Status: skattetabeller för", + "Hämta från Skatteverket"], + }, + { + "name": "payroll", + "screen": "payroll", + "expect": ["Lönekörningar", "Ny lönekörning"], + }, + { + "name": "payroll-run", + "screen": "payroll", + "steps": [ + { + "keys": ["ctrln"], + "expect": ["Ny lönekörning", "Period", "Bokför körning"], + }, + { + "keys": ["f5"], + "expect": ["Testanställd", "30 000,00", "Avgifter"], + }, + { + "keys": ["esc"], + "expect": ["Ny lönekörning", "Bokför körning"], + }, + { + "keys": ["ctrlenter"], + "expect": ["Bokför lönekörningen"], + }, + { + "keys": ["j"], + "expect": ["Lönekörningen är bokförd"], + }, + { + "keys": ["enter"], + "expect": ["Status: bokförd", "Lönebesked (PDF)"], + }, + { + "keys": ["down", "down", "down", "down", "enter"], + "expect": ["Sparad", "Lönebesked"], + }, + ], + }, ] # -------------------------------------------------------------------------- @@ -739,6 +813,24 @@ def setup_rig(repo, tmp, env): "unit_price_ore": 100000, "vat_code": "25"}], })], env) + # Payroll rig: one B record covering the employee's salary, and one + # employee, so the Lön screens have data to show. + table_line = "30B30 1 80000 7000 7000 7000 7000 7000 7000\n" + run_checked([str(bind / "bokfctl"), "--socket", str(sock), + "--user", "admin", "--password", env["BOKFD_PASSWORD"], + "--org", str(org_id), "payroll.tax_tables_import", + json.dumps({"year": start.year, + "content_base64": base64.b64encode( + table_line.encode("utf-8")).decode()})], env) + run_checked([str(bind / "bokfctl"), "--socket", str(sock), + "--user", "admin", "--password", env["BOKFD_PASSWORD"], + "--org", str(org_id), "employee.create", + json.dumps({"name": "Testanställd", + "personal_no": "19800101-1234", + "monthly_salary_ore": 3000000, + "tax_table": 30, + "tax_column": 1, + "email": "test@example.com"})], env) return daemon, sock, org_id, fy @@ -763,9 +855,14 @@ def main(argv): tmp = Path(tempfile.mkdtemp(prefix="bokf-golden-", dir="/tmp")) password = "golden-" + os.urandom(6).hex() env = dict(os.environ) - env.update({"BOKFD_PASSWORD": password}) + env.update({"BOKFD_PASSWORD": password, + "BOKFD_SECRET_KEY": os.urandom(32).hex()}) env.pop("BOKFD_SESSION", None) env.pop("BOKFD_TOKEN", None) + # keep generated PDFs from opening a window: the TUI then reports where + # it saved the file, which is what the scenarios assert on + env.pop("DISPLAY", None) + env.pop("WAYLAND_DISPLAY", None) daemon = None failures = 0 |
