1package e2e23import (4 "strings"56 ghostty "go.mitchellh.com/libghostty"7)89// Golden screens for the grid's layout: a trip plan with its title merged10// across the table, borders around and inside it (a double line under11// the headers, a thick outline), notes that wrap and grow their rows, and12// a row made taller by hand; the question before a merge clears values,13// the Borders menu, and a row's height being dragged.1415// palette runs a command by searching the palette for it.16func palette(s *session, search string) {17 s.keys("<ctrl+k>", search, "<enter>")18}1920// tripPlan types the plan and lays it out through the Format menu's21// commands, ending on the notes column.22func tripPlan(s *session) {23 s.keys("Trip to Lisbon", "<enter>")24 s.keys("Day", "<tab>", "Cost", "<tab>", "Notes", "<enter>")25 s.keys("Fri", "<tab>", "120", "<tab>", "Train, book the early fare", "<enter>")26 s.keys("Sat", "<tab>", "45", "<tab>", "Tram 28 and the castle, before the crowds", "<enter>")27 s.keys("Sun", "<tab>", "60", "<tab>", "Fly home", "<enter>")28 s.keys("Total", "<tab>", "=SUM(B3:B5)", "<enter>")29 // The title across the table.30 s.keys("<ctrl+home>", "<shift+right>", "<shift+right>")31 palette(s, "merge all")32 s.waitFor("Merged A1:C1")33 // Lines inside, a double one under the headers, a thick outline.34 s.keys("<down>", "<shift+down>", "<shift+down>", "<shift+down>", "<shift+down>", "<shift+right>", "<shift+right>")35 palette(s, "all borders")36 s.waitFor("All borders for A2:C6")37 palette(s, "thick lines")38 s.keys("<alt+shift+7>")39 s.waitFor("Outer borders for A2:C6")40 s.keys("<esc>", "<shift+right>", "<shift+right>")41 palette(s, "double lines")42 s.keys("<alt+shift+3>")43 s.waitFor("Bottom border for A2:C2")44 // The notes wrap, and the total's row is two lines tall.45 s.keys("<esc>", "<down>", "<right>", "<right>", "<shift+down>", "<shift+down>")46 palette(s, "wrap")47 s.waitFor("Wrapping: wrap for C3:C5")48 s.keys("<esc>", "<down>", "<down>", "<down>")49 palette(s, "row height")50 s.keys("2", "<enter>")51 s.keys("<up>", "<up>")52 s.waitForBar("C4", "Tram 28 and the castle, before the crowds")53}5455// coloredPlan is the trip plan with its outline drawn again in blue and56// the total's values in the middle of its tall row.57func coloredPlan(s *session) {58 tripPlan(s)59 s.keys("<down>", "<down>", "<left>", "<left>")60 palette(s, "row height")61 s.keys("<right>", "<enter>")62 s.keys("<shift+right>", "<shift+right>")63 palette(s, "align middle")64 s.waitFor("Aligned to the middle")65 s.keys("<esc>", "<ctrl+home>", "<down>")66 for range 4 {67 s.keys("<shift+down>")68 }69 s.keys("<shift+right>", "<shift+right>")70 palette(s, "border color")71 s.waitFor("Automatic")72 s.keys("blue", "<enter>")73 s.waitFor("Borders draw in blue now")74 palette(s, "thick lines")75 s.keys("<alt+shift+7>")76 s.waitFor("Outer borders for A2:C6")77 s.keys("<esc>", "<down>")78 s.waitForBar("A3", "Fri")79}8081var layoutScreens = []screen{82 {name: "layout", setup: tripPlan},83 {name: "layout-colors", setup: coloredPlan},84 {name: "layout-colors-high-contrast", opts: options{config: highContrastConfig}, setup: coloredPlan},85 {name: "border-color-picker", setup: func(s *session) {86 budget(s)87 palette(s, "border color")88 s.waitFor("Automatic")89 s.keys("<down>", "<down>")90 }},91 {name: "layout-narrow", opts: options{cols: 60, rows: 16}, setup: func(s *session) {92 tripPlan(s)93 s.keys("<ctrl+home>") // the pointer on the merged title94 s.waitForBar("A1", "Trip to Lisbon")95 }},96 {name: "layout-high-contrast", opts: options{config: highContrastConfig}, setup: tripPlan},97 {name: "layout-merge-confirm", setup: func(s *session) {98 budget(s)99 s.keys("<up>", "<up>", "<up>", "<left>", "<shift+right>", "<shift+down>")100 palette(s, "merge all")101 s.waitFor("keeps only the top-left value")102 }},103 {name: "menu-format-borders", setup: func(s *session) {104 budget(s)105 s.keys("<alt+o>", "b", "b", "<right>")106 s.waitFor("│ Double lines")107 }},108 {name: "resizing-row", setup: func(s *session) {109 budget(s)110 s.mouse(ghostty.MouseActionPress, ghostty.MouseButtonLeft, 5, gridRow1+2, 0)111 s.mouse(ghostty.MouseActionMotion, ghostty.MouseButtonLeft, 5, gridRow1+4, 0)112 s.waitFor("Row 3 height 3 lines")113 }},114}115116func init() {117 for _, sc := range layoutScreens {118 screens = append(screens, sc)119 if sc.name != "layout-narrow" && !strings.HasSuffix(sc.name, "-high-contrast") {120 sc.name += "-light"121 sc.opts.light = true122 screens = append(screens, sc)123 }124 }125}