diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/tui-golden.py | 172 |
1 files changed, 168 insertions, 4 deletions
diff --git a/scripts/tui-golden.py b/scripts/tui-golden.py index f5d5b7f..4fee4df 100755 --- a/scripts/tui-golden.py +++ b/scripts/tui-golden.py @@ -41,6 +41,7 @@ from pathlib import Path ORG_NAME = "Test AB" ORG_NR = "5560123456" +DOWNLOAD_PATH = f"/tmp/bokf-golden-dl-{os.getpid()}.txt" KEYS = { "enter": "\r", @@ -59,6 +60,7 @@ KEYS = { "ctrlenter-kitty": "\x1b[13;5u", "f5": "\x1b[15~", "f9": "\x1b[20~", + "f2": "\x1bOQ", } # {org_name} {org_nr} {fy_label} {fy_start} {fy_end} are substituted at run @@ -104,6 +106,42 @@ SCENARIOS = [ "expect": ["Benämning", "Debet", "Kredit", "Underlag", "kvitto.txt"], }, + { + "keys": ["f"], + "expect": ["Underlag", "kvitto.txt"], + }, + { + "keys": ["enter"], + "expect": ["Underlag: < Granska >"], + }, + { + "keys": ["enter"], + "expect": ["piltangenter/PgUp/PgDn rullar", "kvitto"], + }, + { + "keys": ["esc"], + "expect": ["Benämning", "Underlag"], + }, + { + "keys": ["f", "enter", "right"], + "expect": ["Underlag: < Ladda ned… >"], + }, + { + "keys": ["enter"], + "expect": ["Spara underlag: "], + }, + { + "keys": [DOWNLOAD_PATH, "enter"], + "expect": ["Sparat"], + }, + { + "keys": ["enter"], + "expect": ["piltangenter/PgUp/PgDn rullar", "kvitto"], + }, + { + "keys": ["esc"], + "expect": ["Benämning", "Underlag"], + }, ], }, { @@ -194,11 +232,11 @@ SCENARIOS = [ }, { "keys": ["enter"], - "expect": ["Matchat med A3"], + "expect": ["Matchat med A2"], }, { "keys": ["enter"], - "expect": ["→ A3", "0 omatchade"], + "expect": ["→ A2", "0 omatchade"], }, { "keys": ["ctrln"], @@ -221,6 +259,64 @@ SCENARIOS = [ "expect": ["Kunder", "Testkund AB"], }, { + "name": "customer-draft", + "screen": "customers", + "expect": ["Kunder", "Testkund AB"], + "steps": [ + { + "keys": ["ctrln"], + "expect": ["Ny kund", "<UTKAST>"], + }, + { + "keys": ["enter", "Utkastkund", "enter"], + "expect": ["Ny kund", "<UTKAST>", "Utkastkund"], + }, + { + "keys": ["esc"], + "expect": ["Kunder", "<UTKAST> Utkastkund"], + }, + { + "keys": ["end", "up"], + "expect": ["<UTKAST> Utkastkund"], + }, + { + "keys": ["f2"], + "expect": ["Åtgärder", "Öppna", "Radera utkast"], + }, + { + "keys": ["down", "enter"], + "expect": ["Radera utkastet?"], + }, + { + "keys": ["enter"], + "expect": ["Kunder", "Testkund AB"], + }, + ], + }, + { + "name": "customer-draft-save", + "screen": "customers", + "expect": ["Kunder", "Testkund AB"], + "steps": [ + { + "keys": ["ctrln"], + "expect": ["Ny kund", "<UTKAST>"], + }, + { + "keys": ["enter", "Sparad kund", "enter"], + "expect": ["Sparad kund", "<UTKAST>"], + }, + { + "keys": ["f9"], + "expect": ["Sparat."], + }, + { + "keys": ["enter"], + "expect": ["Kunder", "Sparad kund"], + }, + ], + }, + { "name": "invoice-form", "screen": "invoices", "steps": [ @@ -231,6 +327,52 @@ SCENARIOS = [ ], }, { + "name": "invoice-duplicate", + "screen": "invoices", + "steps": [ + { + "keys": ["enter"], + "expect": ["Att betala", "12 500,00"], + }, + { + "keys": ["u"], + "expect": ["Ny faktura", "Testkund AB", + "Konsulttjänster"], + }, + { + "keys": ["esc"], + "expect": ["Faktura", "Att betala"], + }, + ], + }, + { + "name": "invoice-pay", + "screen": "invoices", + "steps": [ + { + "keys": ["enter"], + "expect": ["Att betala", "12 500,00"], + }, + { + "keys": ["b"], + "expect": ["Nytt verifikat", "1930", "1510", + "Betalning faktura"], + }, + { + "keys": ["f9"], + "expect": ["Bokfört"], + }, + { + "keys": ["enter"], + "expect": ["kvitterad"], + }, + { + "keys": ["enter"], + "expect": ["betald", "Betalningsverifikat"], + }, + ], + }, + { "name": "employees", "screen": "employees", "expect": ["Anställda", "Testanställd", "Ny anställd"], @@ -291,10 +433,28 @@ SCENARIOS = [ "name": "company", "screen": "company", "expect": ["Bolaget", "Företagsuppgifter", "Fakturauppgifter", - "E-post (SMTP)", "Anställda", "Kunder", "Momsregler"], + "Verifikationsserier", "E-post (SMTP)", "Anställda", + "Kunder", "Momsregler"], "steps": [ { + "keys": ["2"], + "expect": ["Fakturauppgifter", "Nästa fakturanummer"], + }, + { + "keys": ["esc"], + "expect": ["Bolaget", "Verifikationsserier"], + }, + { "keys": ["3"], + "expect": ["Verifikationsserier", "Manuella verifikat", + "Ingående balans"], + }, + { + "keys": ["esc"], + "expect": ["Bolaget", "Fakturauppgifter"], + }, + { + "keys": ["4"], "expect": ["E-post (SMTP)", "SMTP-server", "lämna tomt för oförändrat"], }, @@ -303,7 +463,7 @@ SCENARIOS = [ "expect": ["Bolaget", "Företagsuppgifter"], }, { - "keys": ["5"], + "keys": ["6"], "expect": ["Anställda", "Testanställd"], }, { @@ -1044,6 +1204,10 @@ def main(argv): file=sys.stderr) failures = max(failures, 1) finally: + try: + os.unlink(DOWNLOAD_PATH) + except OSError: + pass if daemon and daemon.poll() is None: try: os.killpg(daemon.pid, signal.SIGTERM) |
