cat / 012
clone

a spreadsheet for the terminal: lotus 1-2-3 looks, google sheets keys and formulas, one go binary

Macros: an e2e test of recording the sort bar; answered dialogs timed as commands

Dami committed 30ba870
commit
30ba8702c01f270151e5e1644febfedf51f303c4
parent
c763843914fa664858cccf0444d8354247d14516
author
Dami <dami.etoile@gmail.com>
kind
test risk score 0.8 of 3, Jev's estimate
3 files changed, +38 -1
Mdocs/sheets/macros.md3++-
Me2e/macros_test.go33++++++++++++++++++++++++++++++
Minternal/ui/macrohostnav.go3+++
M docs/sheets/macros.md +2 -1
M e2e/macros_test.go +33 -0
@@ -98,3 +98,36 @@ func TestMacroFromAnotherComputerAsks(t *testing.T) {
9898 s.keys("<down>", "<ctrl+alt+shift+1>")9999 s.waitForBar("C4:D4", "Total")100100 }101+102+// TestMacroRecordsTheSortBar records the choices made in a dialog and103+// replays them.104+func TestMacroRecordsTheSortBar(t *testing.T) {105+ dir := t.TempDir()106+ s := start(t, dir, "book.012")107+ s.keys("Month", "<tab>", "Sales", "<enter>", "Jan", "<tab>", "30", "<enter>", "Feb", "<tab>", "10", "<enter>", "Mar", "<tab>", "20", "<enter>")108+ s.keys("<ctrl+home>", "<ctrl+k>", "record macro")109+ s.waitFor("Record macro")110+ s.keys("<enter>")111+ s.waitFor("Recording (absolute references)")112+ s.keys("<ctrl+k>", "sort range", "<enter>")113+ s.waitFor("Sort A2:B4 by A Month A→Z")114+ s.keys("<right>", "<space>", "<enter>")115+ s.waitFor("Sorted A2:B4 by B Z→A")116+ s.waitForLine(gridRow1+1, " 2 Jan 30")117+ s.keys("<ctrl+k>", "stop and save", "<enter>")118+ s.waitFor("Save macro as: Macro 1")119+ s.keys("Sort", "<enter>", "<enter>")120+ s.waitFor("Saved macro Sort")121+122+ // Undone, then replayed from the palette.123+ s.keys("<ctrl+z>")124+ s.waitForLine(gridRow1+1, " 2 Feb 10")125+ s.keys("<ctrl+k>", "sort", "<enter>")126+ s.waitFor("Ran Sort")127+ s.waitForLine(gridRow1+1, " 2 Jan 30")128+ s.keys("<ctrl+s>")129+ s.eventually("saved", func() bool {130+ data, err := os.ReadFile(filepath.Join(dir, "book.012"))131+ return err == nil && strings.Contains(string(data), `run(\"data.sort_range\", answer={\"by\": [{\"column\": \"B\", \"order\": \"desc\"}], \"header\": True})`)132+ })133+}
M internal/ui/macrohostnav.go +3 -0