diff --git a/client/client_test.go b/client/client_test.go index 660b871..d611e94 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -1803,7 +1803,26 @@ func testTui_scroll(t *testing.T) { out = stripTuiCommandPrefix(t, out) testutils.CompareGoldens(t, out, "TestTui-RightScrollTwo") - // TODO: Add a test here that shows all columns can be horizontally scrolled + // Set up to test horizontal scrolling for other columns + veryLongDirEntry := testutils.MakeFakeHistoryEntry("echo 'short'") + veryLongDirEntry.CurrentWorkingDirectory = "/tmp/1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_0_1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_1_1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_2_1234567890qwertyuiopasdfghjklzxxcvbnm0987654321" + manuallySubmitHistoryEntry(t, userSecret, veryLongDirEntry) + require.NoError(t, hctx.GetDb(hctx.MakeContext()).Create(veryLongDirEntry).Error) + + // Test displaying long other columns + out = captureTerminalOutput(t, tester, []string{ + "hishtory SPACE tquery ENTER", + }) + out = stripTuiCommandPrefix(t, out) + testutils.CompareGoldens(t, out, "TestTui-LongDirectoryName") + + // Test horizontal scrolling for other columns + out = captureTerminalOutput(t, tester, []string{ + "hishtory SPACE tquery ENTER", + "S-Right S-Right", + }) + out = stripTuiCommandPrefix(t, out) + testutils.CompareGoldens(t, out, "TestTui-RightScrollDirectoryTwo") // Assert there are no leaked connections assertNoLeakedConnections(t) diff --git a/client/testdata/TestTui-LongDirectoryName b/client/testdata/TestTui-LongDirectoryName new file mode 100644 index 0000000..9c69778 --- /dev/null +++ b/client/testdata/TestTui-LongDirectoryName @@ -0,0 +1,27 @@ +Search Query: > ls + +┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Hostname CWD Timestamp Runtime Exit Code Command │ +│──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│ +│ localhost /tmp/1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_0_1234567890qw… Oct 17 2022 21:43:31 PDT 3s 2 echo 'short' │ +│ localhost /tmp/ Oct 17 2022 21:43:26 PDT 3s 2 echo '1234567890qwertyuiopasdfghjklzxxcvbnm0987654321_0_1234567890qw… │ +│ localhost /tmp/ Oct 17 2022 21:43:21 PDT 3s 2 echo 'aaaaaa bbbb' │ +│ localhost /tmp/ Oct 17 2022 21:43:16 PDT 3s 2 ls ~/ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +hiSHtory: Search your shell history • ctrl+h help \ No newline at end of file diff --git a/client/testdata/TestTui-RightScrollDirectoryTwo b/client/testdata/TestTui-RightScrollDirectoryTwo new file mode 100644 index 0000000..fb771aa --- /dev/null +++ b/client/testdata/TestTui-RightScrollDirectoryTwo @@ -0,0 +1,27 @@ +Search Query: > ls + +┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Hostname CWD Timestamp Runtime Exit Code Command │ +│──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│ +│ localhost …yuiopasdfghjklzxxcvbnm0987654321_0_1234567890qwertyuiopasdfghjklzx… Oct 17 2022 21:43:31 PDT 3s 2 … │ +│ localhost … Oct 17 2022 21:43:26 PDT 3s 2 …tyuiopasdfghjklzxxcvbnm0987654321_0_1234567890qwertyuiopasdfghjklzx… │ +│ localhost … Oct 17 2022 21:43:21 PDT 3s 2 … │ +│ localhost … Oct 17 2022 21:43:16 PDT 3s 2 … │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +hiSHtory: Search your shell history • ctrl+h help \ No newline at end of file