ttytest2 0.9.4 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +98 -62
- data/examples/canonical_integration_tests.rb +9 -17
- data/examples/noncanonical_integration_tests.rb +12 -25
- data/lib/ttytest/capture.rb +8 -0
- data/lib/ttytest/constants.rb +1 -1
- data/lib/ttytest/terminal.rb +39 -2
- data/lib/ttytest/tmux/session.rb +13 -0
- data/lib/ttytest/version.rb +1 -1
- data/notes.txt +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 196acc1f485c7ad416fbdbe07c94f0829bfb53a57c852a85bf79d72655f4debb
|
4
|
+
data.tar.gz: a2afc1f836dff32a2e2aa53a90137ce9bd768a20907855defae05da66af821e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 762f9246cadb92d30ef2d8535b135cb9d72270d8e24bc100c8d18e18ecdd949e35560a7ff6fdc3b413a7dffbacbef56cf712c0b459b4cc3f8f7797dbfeca61d3
|
7
|
+
data.tar.gz: 2e099fda420602c981073d9cb39d9be307e261086ac8682ec4b213b6a061eded99a9ccff73df9e6c16a9157676fc4dea03a33d834d643fcfdf63631090807156
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,12 +2,30 @@
|
|
2
2
|
|
3
3
|
ttytest2 is an acceptance test framework for interactive console applications. It's like [capybara](https://github.com/teamcapybara/capybara) for the terminal.
|
4
4
|
|
5
|
-
A drop-in replacement for https://github.com/jhawthorn/ttytest, because I had some features I needed for my own project.
|
5
|
+
A drop-in replacement for [ttytest](https://github.com/jhawthorn/ttytest), because I had some features I needed for my own project.
|
6
6
|
|
7
|
-
It works by running commands inside a tmux session, capturing the pane, and comparing the content.
|
7
|
+
It works by running commands inside a tmux session, capturing the pane, and comparing the content.
|
8
|
+
|
9
|
+
The assertions will wait a specified amount of time (default 2 seconds) for the expected content to appear.
|
8
10
|
|
9
11
|
[![Gem Version](https://badge.fury.io/rb/ttytest2.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/ttytest2)
|
10
12
|
|
13
|
+
## Table of Contents
|
14
|
+
|
15
|
+
1. [Minimum Requirements](#minimum-requirements)
|
16
|
+
2. [Usage](#usage)
|
17
|
+
3. [Example for Canonical CLI or Shell](#example-for-canonical-cli-or-shell)
|
18
|
+
4. [Example for Noncanonical CLI or Shell](#example-for-noncanonical-cli-or-shell)
|
19
|
+
5. [Assertions](#assertions)
|
20
|
+
6. [Output](#output)
|
21
|
+
7. [Output Helpers](#output-helpers)
|
22
|
+
8. [Troubleshooting](#troubleshooting)
|
23
|
+
9. [Constants](#constants)
|
24
|
+
10. [Tips](#tips)
|
25
|
+
11. [Docker](#docker)
|
26
|
+
12. [Contributing](#contributing)
|
27
|
+
13. [License](#license)
|
28
|
+
|
11
29
|
## Minimum Requirements
|
12
30
|
|
13
31
|
* tmux >= 1.8
|
@@ -15,13 +33,72 @@ It works by running commands inside a tmux session, capturing the pane, and comp
|
|
15
33
|
|
16
34
|
## Usage
|
17
35
|
|
18
|
-
More documentation available at [(https://www.rubydoc.info/gems/ttytest2)
|
36
|
+
More documentation available at [ttytest2 docs](https://www.rubydoc.info/gems/ttytest2).
|
37
|
+
|
38
|
+
There are more examples in the examples folder.
|
39
|
+
|
40
|
+
### Example for Canonical CLI or Shell
|
41
|
+
|
42
|
+
Most people should use send_keys, if you are writing or working with a noncanonical shell/CLI, you will probably know it! Most shell/CLI applications are canonical.
|
43
|
+
|
44
|
+
``` ruby
|
45
|
+
require 'ttytest'
|
46
|
+
|
47
|
+
@tty = TTYtest.new_terminal(%{PS1='$ ' /bin/sh}, width: 80, height: 24)
|
48
|
+
@tty.assert_row(0, '$')
|
49
|
+
@tty.assert_cursor_position(x: 2, y: 0)
|
50
|
+
|
51
|
+
@tty.send_keys(%{echo "Hello, world"\n})
|
52
|
+
|
53
|
+
@tty.assert_contents <<TTY
|
54
|
+
$ echo "Hello, world"
|
55
|
+
Hello, world
|
56
|
+
$
|
57
|
+
TTY
|
58
|
+
@tty.assert_cursor_position(x: 2, y: 2)
|
59
|
+
|
60
|
+
@tty.print_rows # => ["$ echo \"Hello, world\"", "Hello, world", "$", "", "", "", ...]
|
61
|
+
|
62
|
+
@tty.print # prints out the contents of the terminal
|
63
|
+
```
|
64
|
+
|
65
|
+
### Example for Noncanonical CLI or Shell
|
66
|
+
|
67
|
+
If you are working with a noncanonical shell, you need to use send_keys_one_at_a_time to have your shell/CLI process the input correctly.
|
68
|
+
|
69
|
+
Also useful if you need to send input one character at a time for whatever reason.
|
70
|
+
|
71
|
+
'Multi-character' characters like '\n' need to be sent with send-keys, though.
|
72
|
+
|
73
|
+
``` ruby
|
74
|
+
require 'ttytest'
|
75
|
+
|
76
|
+
@tty = TTYtest.new_terminal(%{PS1='$ ' /bin/noncanonical-sh}, width: 80, height: 24)
|
77
|
+
@tty.assert_row_starts_with(0, ENV['USER'])
|
78
|
+
@tty.assert_row_ends_with(0, '$')
|
79
|
+
|
80
|
+
@tty.send_keys_one_at_a_time('ls')
|
81
|
+
@tty.assert_row_ends_with(0, 'ls')
|
82
|
+
@tty.send_keys(%(\n)) # make sure to use send_keys for 'multi-character' characters like \n, \r, \t, etc.
|
83
|
+
|
84
|
+
@tty.send_keys_one_at_a_time('ps')
|
85
|
+
@tty.assert_row_ends_with(1, 'ps')
|
86
|
+
@tty.send_keys(TTYtest:NEWLINE) # can use constants instead
|
87
|
+
|
88
|
+
|
89
|
+
@tty.assert_row_starts_with(2, ENV['USER'])
|
90
|
+
@tty.assert_row_ends_with(2, '$')
|
91
|
+
@tty.send_newline # an alternative to the 2 above methods to send \n to the terminal
|
92
|
+
|
93
|
+
puts "\n#{@tty.capture}" # prints out the contents of the terminal, equivalent to @tty.print
|
94
|
+
```
|
19
95
|
|
20
96
|
### Assertions
|
21
97
|
|
22
98
|
The main way to use TTYtest is through assertions. When called on a `TTYtest::Terminal`, each of these will be retried (for up to 2 seconds).
|
23
99
|
|
24
100
|
Available assertions:
|
101
|
+
|
25
102
|
* `assert_row(row_number, expected_text)`
|
26
103
|
* `assert_row_at(row_number, column_start_position, column_end_position, expected_text)`
|
27
104
|
* `assert_row_like(row_number, expected_text)`
|
@@ -32,7 +109,7 @@ Available assertions:
|
|
32
109
|
* `assert_cursor_hidden`
|
33
110
|
* `assert_contents(lines_of_terminal)`
|
34
111
|
|
35
|
-
###
|
112
|
+
### Output
|
36
113
|
|
37
114
|
You can send output to the terminal with the following calls.
|
38
115
|
|
@@ -58,74 +135,27 @@ Helper functions to make sending output easier! They use the methods above under
|
|
58
135
|
* `send_up_arrows(number_of_times)`
|
59
136
|
* `send_down_arrow`
|
60
137
|
* `send_down_arrows(number_of_times)`
|
138
|
+
* `send_home` # simulate pressing the Home key
|
139
|
+
* `send_end` # simulate pressing the End key
|
140
|
+
* `send_clear` # clear the screen by sending clear ascii code
|
61
141
|
|
62
142
|
### Troubleshooting
|
63
143
|
|
64
144
|
You can use the method rows to get all rows of the terminal as an array, of use the method capture to get the contents of the terminal window. This can be useful when troubleshooting.
|
65
145
|
|
66
146
|
``` ruby
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
### Example Canonical CLI/Shell
|
72
|
-
|
73
|
-
Most people should use send_keys, if you are writing or working with a noncanonical shell/CLI, you will probably know it! Most shell/CLI applications are canonical.<br /><br />
|
74
|
-
There are more examples in the examples folder.
|
75
|
-
|
76
|
-
``` ruby
|
77
|
-
require 'ttytest'
|
78
|
-
|
79
|
-
@tty = TTYtest.new_terminal(%{PS1='$ ' /bin/sh}, width: 80, height: 24)
|
80
|
-
@tty.assert_row(0, '$')
|
81
|
-
@tty.assert_cursor_position(x: 2, y: 0)
|
82
|
-
|
83
|
-
@tty.send_keys(%{echo "Hello, world"\n})
|
84
|
-
|
85
|
-
@tty.assert_contents <<TTY
|
86
|
-
$ echo "Hello, world"
|
87
|
-
Hello, world
|
88
|
-
$
|
89
|
-
TTY
|
90
|
-
@tty.assert_cursor_position(x: 2, y: 2)
|
91
|
-
|
92
|
-
p @tty.rows # => ["$ echo \"Hello, world\"", "Hello, world", "$", "", "", "", ...]
|
93
|
-
|
94
|
-
puts "\n#{@tty.capture}" # prints out the contents of the terminal
|
95
|
-
```
|
96
|
-
|
97
|
-
### Example Noncanonical CLI/Shell
|
98
|
-
|
99
|
-
If you are working with a noncanonical shell, you need to use send_keys_one_at_a_time to have your shell/CLI process the input correctly.<br /><br />
|
100
|
-
Also useful if you need to send input one character at a time for whatever reason.<br /><br />
|
101
|
-
'Multi-character' characters like '\n' need to be sent with send-keys, though.<br /><br />
|
102
|
-
There are more examples in the examples folder.
|
103
|
-
|
104
|
-
``` ruby
|
105
|
-
require 'ttytest'
|
106
|
-
|
107
|
-
@tty = TTYtest.new_terminal(%{PS1='$ ' /bin/noncanonical-sh}, width: 80, height: 24)
|
108
|
-
@tty.assert_row_starts_with(0, ENV['USER'])
|
109
|
-
@tty.assert_row_ends_with(0, '$')
|
110
|
-
|
111
|
-
@tty.send_keys_one_at_a_time('ls')
|
112
|
-
@tty.assert_row_ends_with(0, 'ls')
|
113
|
-
@tty.send_keys(%(\n)) # make sure to use send_keys for 'multi-character' characters like \n, \r, \t, etc.
|
114
|
-
|
115
|
-
@tty.send_keys_one_at_a_time('ps')
|
116
|
-
@tty.assert_row_ends_with(0, 'ps')
|
117
|
-
@tty.send_keys(TTYtest:NEWLINE) # can use constants instead
|
118
|
-
|
119
|
-
@tty.assert_row_starts_with(0, ENV['USER'])
|
120
|
-
@tty.assert_row_ends_with(0, '$')
|
121
|
-
@tty.send_newline # an alternative to the 2 above methods to send \n to the terminal
|
147
|
+
# you can use @tty.rows to access the entire pane, split by line into an array.
|
148
|
+
p @tty.rows # prints out the contents of the terminal as a array.
|
149
|
+
@tty.print_rows # equivalent to above, just for ease of use.
|
122
150
|
|
123
|
-
|
151
|
+
# you can use @tty.capture to access the entire pane.
|
152
|
+
p "\n#{@tty.capture}" # prints out the contents of the terminal
|
153
|
+
@tty.print # equivalent to above, just for ease of use.
|
124
154
|
```
|
125
155
|
|
126
156
|
### Constants
|
127
157
|
|
128
|
-
There are some commonly used keys available as constants to make interacting with your shell/CLI easy.
|
158
|
+
There are some commonly used keys available as constants to make interacting with your shell/CLI easy.
|
129
159
|
|
130
160
|
``` ruby
|
131
161
|
TTYtest::BACKSPACE
|
@@ -143,6 +173,12 @@ There are some commonly used keys available as constants to make interacting wit
|
|
143
173
|
TTYtest::CLEAR # clear the screen
|
144
174
|
```
|
145
175
|
|
176
|
+
### Tips
|
177
|
+
|
178
|
+
If you are using ttyest2 to test your CLI, using sh is easier than bash because you don't have to worry about user, current working directory, etc. as shown in the examples above.
|
179
|
+
|
180
|
+
If you are using ttytest2 to test your shell, using assertions like assert_row_like, assert_row_starts_with, and assert_row_ends_with are going to be extremely helpful, especially if trying to test your shell in different environments or using a docker container.
|
181
|
+
|
146
182
|
## Docker
|
147
183
|
|
148
184
|
Easy to use from Docker. Add this to your dockerfile to get started.
|
@@ -158,7 +194,7 @@ RUN apt update && \
|
|
158
194
|
|
159
195
|
## Contributing
|
160
196
|
|
161
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/a-eski/ttytest2.
|
197
|
+
Bug reports and pull requests are welcome on GitHub at [ttytest2](https://github.com/a-eski/ttytest2).
|
162
198
|
|
163
199
|
## License
|
164
200
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
# example testing a noncanonical shell, ncsh
|
5
|
+
|
4
6
|
require 'ttytest'
|
5
7
|
|
6
8
|
START_COL = 19
|
@@ -55,13 +57,9 @@ assert_check_new_row(row)
|
|
55
57
|
|
56
58
|
# multiple end of line backspaces
|
57
59
|
@tty.send_keys(%(lsssss))
|
58
|
-
@tty.
|
59
|
-
@tty.
|
60
|
-
@tty.
|
61
|
-
@tty.send_backspace
|
62
|
-
@tty.assert_row_ends_with(row, '$ ls')
|
63
|
-
@tty.send_backspace
|
64
|
-
@tty.send_backspace
|
60
|
+
@tty.send_backspaces(4)
|
61
|
+
@tty.assert_row_ends_with(row, 'ls')
|
62
|
+
@tty.send_backspaces(2)
|
65
63
|
@tty.send_keys(%(echo hello)) # make sure buffer is properly formed after backspaces
|
66
64
|
@tty.send_newline
|
67
65
|
row += 1
|
@@ -72,20 +70,14 @@ row += 1
|
|
72
70
|
assert_check_new_row(row)
|
73
71
|
@tty.send_keys(%(lsssss))
|
74
72
|
@tty.assert_cursor_position(START_COL + 6, row)
|
75
|
-
@tty.
|
76
|
-
@tty.send_keys(TTYtest::LEFT_ARROW)
|
73
|
+
@tty.send_left_arrows(2)
|
77
74
|
@tty.assert_cursor_position(START_COL + 4, row)
|
78
|
-
@tty.
|
79
|
-
@tty.send_backspace
|
80
|
-
@tty.send_backspace
|
81
|
-
@tty.send_backspace
|
75
|
+
@tty.send_backspaces(4)
|
82
76
|
@tty.assert_cursor_position(START_COL, row)
|
83
77
|
@tty.assert_row_ends_with(row, '$ ss')
|
84
|
-
@tty.
|
85
|
-
@tty.send_keys(TTYtest::RIGHT_ARROW)
|
78
|
+
@tty.send_right_arrows(2)
|
86
79
|
@tty.assert_cursor_position(START_COL + 2, row)
|
87
|
-
@tty.
|
88
|
-
@tty.send_backspace
|
80
|
+
@tty.send_backspaces(2)
|
89
81
|
@tty.assert_cursor_position(START_COL, row)
|
90
82
|
@tty.send_keys(%(echo hello)) # make sure buffer is properly formed after backspaces
|
91
83
|
@tty.send_newline
|
@@ -1,25 +1,24 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
# example testing a canonical shell called shl
|
5
|
+
|
4
6
|
require 'ttytest'
|
5
7
|
|
6
8
|
START_COL = 19
|
7
9
|
|
8
10
|
def assert_check_new_row(row)
|
9
11
|
@tty.assert_row_starts_with(row, "#{ENV['USER']}:")
|
10
|
-
@tty.assert_row_like(row, '
|
12
|
+
@tty.assert_row_like(row, 'shl')
|
11
13
|
@tty.assert_row_ends_with(row, '$')
|
12
14
|
@tty.assert_cursor_position(START_COL, row)
|
13
15
|
end
|
14
16
|
|
15
|
-
@tty = TTYtest.new_terminal(%(PS1='$ ' ./bin/
|
17
|
+
@tty = TTYtest.new_terminal(%(PS1='$ ' ./bin/shl), width: 80, height: 24)
|
16
18
|
|
17
19
|
row = 0
|
18
20
|
|
19
|
-
|
20
|
-
puts 'Starting basic tests'
|
21
|
-
|
22
|
-
@tty.assert_row_starts_with(row, 'ncsh: startup time: ')
|
21
|
+
@tty.assert_row_starts_with(row, 'shl: startup time: ')
|
23
22
|
row += 1
|
24
23
|
|
25
24
|
assert_check_new_row(row)
|
@@ -42,11 +41,9 @@ assert_check_new_row(row)
|
|
42
41
|
@tty.send_keys_one_at_a_time(%(lss)) # send a bad command
|
43
42
|
@tty.send_newline
|
44
43
|
row += 1
|
45
|
-
@tty.assert_row(row, '
|
44
|
+
@tty.assert_row(row, 'shl: Could not find command or directory: No such file or directory')
|
46
45
|
row += 1
|
47
46
|
|
48
|
-
puts 'Starting backspace tests'
|
49
|
-
|
50
47
|
# end of line backspace
|
51
48
|
assert_check_new_row(row)
|
52
49
|
@tty.send_keys_one_at_a_time(%(l))
|
@@ -55,13 +52,9 @@ assert_check_new_row(row)
|
|
55
52
|
|
56
53
|
# multiple end of line backspaces
|
57
54
|
@tty.send_keys_one_at_a_time(%(lsssss))
|
58
|
-
@tty.
|
59
|
-
@tty.send_backspace
|
60
|
-
@tty.send_backspace
|
61
|
-
@tty.send_backspace
|
55
|
+
@tty.send_backspaces(4)
|
62
56
|
@tty.assert_row_ends_with(row, '$ ls')
|
63
|
-
@tty.
|
64
|
-
@tty.send_backspace
|
57
|
+
@tty.send_backspaces(2)
|
65
58
|
@tty.send_keys_one_at_a_time(%(echo hello)) # make sure buffer is properly formed after backspaces
|
66
59
|
@tty.send_newline
|
67
60
|
row += 1
|
@@ -72,20 +65,14 @@ row += 1
|
|
72
65
|
assert_check_new_row(row)
|
73
66
|
@tty.send_keys_one_at_a_time(%(lsssss))
|
74
67
|
@tty.assert_cursor_position(START_COL + 6, row)
|
75
|
-
@tty.
|
76
|
-
@tty.send_keys(TTYtest::LEFT_ARROW)
|
68
|
+
@tty.send_left_arrows(2)
|
77
69
|
@tty.assert_cursor_position(START_COL + 4, row)
|
78
|
-
@tty.
|
79
|
-
@tty.send_backspace
|
80
|
-
@tty.send_backspace
|
81
|
-
@tty.send_backspace
|
70
|
+
@tty.send_backspaces(4)
|
82
71
|
@tty.assert_cursor_position(START_COL, row)
|
83
72
|
@tty.assert_row_ends_with(row, '$ ss')
|
84
|
-
@tty.
|
85
|
-
@tty.send_keys(TTYtest::RIGHT_ARROW)
|
73
|
+
@tty.send_right_arrows(2)
|
86
74
|
@tty.assert_cursor_position(START_COL + 2, row)
|
87
|
-
@tty.
|
88
|
-
@tty.send_backspace
|
75
|
+
@tty.send_backspaces(2)
|
89
76
|
@tty.assert_cursor_position(START_COL, row)
|
90
77
|
@tty.send_keys_one_at_a_time(%(echo hello)) # make sure buffer is properly formed after backspaces
|
91
78
|
@tty.send_newline
|
data/lib/ttytest/capture.rb
CHANGED
data/lib/ttytest/constants.rb
CHANGED
data/lib/ttytest/terminal.rb
CHANGED
@@ -26,15 +26,48 @@ module TTYtest
|
|
26
26
|
# @param [String] keys keys to send to the terminal
|
27
27
|
# @!method send_newline
|
28
28
|
# Simulate typing enter by sending newline character to the terminal.
|
29
|
+
# @!method send_newlines
|
30
|
+
# Simulates sending newline the specified number of times.
|
31
|
+
# @param [Integer] number of times to send newline
|
29
32
|
# @!method send_delete
|
30
33
|
# Simulate typing the delete key in the terminal.
|
34
|
+
# @!method send_deletes
|
35
|
+
# Simulates typing delete the specified number of times.
|
36
|
+
# @param [Integer] number of times to send delete
|
31
37
|
# @!method send_backspace
|
32
38
|
# Simulate typing the backspace key in the terminal.
|
39
|
+
# @!method send_backspaces
|
40
|
+
# Simulates typing backspace the specified number of times.
|
41
|
+
# @param [Integer] number of times to send backspace
|
42
|
+
# @!method send_left_arrow
|
43
|
+
# Simulate typing the left arrow key in the terminal.
|
44
|
+
# @!method send_left_arrows
|
45
|
+
# Simulates typing left arrow the specified number of times.
|
46
|
+
# @param [Integer] number of times to send left arrow
|
47
|
+
# @!method send_right_arrow
|
48
|
+
# Simulate typing the right arrow key in the terminal.
|
49
|
+
# @!method send_right_arrows
|
50
|
+
# Simulates typing right arrow the specified number of times.
|
51
|
+
# @param [Integer] number of times to send right arrow
|
52
|
+
# @!method send_down_arrow
|
53
|
+
# Simulate typing the down arrow key in the terminal.
|
54
|
+
# @!method send_down_arrows
|
55
|
+
# Simulates typing the down arrow the specified number of times.
|
56
|
+
# @param [Integer] number of times to send down arrow
|
57
|
+
# @!method send_up_arrow
|
58
|
+
# Simulate typing the up arrow key in the terminal.
|
59
|
+
# @!method send_up_arrows
|
60
|
+
# Simulates typing the up arrow the specified number of times.
|
61
|
+
# @param [Integer] number of times to send up arrow
|
33
62
|
# @!method send_keys_exact
|
34
63
|
# Send tmux send-keys command to the terminal, such as DC or Enter, to simulate pressing that key in the terminal.
|
35
64
|
# @!method capture
|
36
65
|
# Capture the current state of the terminal
|
37
66
|
# @return [Capture] instantaneous state of the terminal when called
|
67
|
+
# @!method print
|
68
|
+
# Prints the current state of the terminal to stdout. See capture to get the raw string.
|
69
|
+
# @!method print_rows
|
70
|
+
# Prints the current state of the terminal as an array to stdout. See rows to get the raw array.
|
38
71
|
def_delegators :@driver_terminal,
|
39
72
|
:send_keys, :send_keys_one_at_a_time,
|
40
73
|
:send_newline, :send_newlines,
|
@@ -42,7 +75,7 @@ module TTYtest
|
|
42
75
|
:send_backspace, :send_backspaces,
|
43
76
|
:send_left_arrow, :send_left_arrows, :send_right_arrow, :send_right_arrows,
|
44
77
|
:send_down_arrow, :send_down_arrows, :send_up_arrow, :send_up_arrows,
|
45
|
-
:send_keys_exact,
|
78
|
+
:send_keys_exact, :send_home, :send_end, :send_clear,
|
46
79
|
:capture
|
47
80
|
|
48
81
|
# @!method rows
|
@@ -69,7 +102,11 @@ module TTYtest
|
|
69
102
|
# @!method cursor_hidden?
|
70
103
|
# @see Capture#cursor_hidden?
|
71
104
|
# @return [true,false]
|
72
|
-
def_delegators :capture, :
|
105
|
+
def_delegators :capture, :print, :print_rows,
|
106
|
+
:rows, :row,
|
107
|
+
:width, :height,
|
108
|
+
:cursor_x, :cursor_y,
|
109
|
+
:cursor_visible?, :cursor_hidden?
|
73
110
|
|
74
111
|
TTYtest::Matchers::METHODS.each do |matcher_name|
|
75
112
|
define_method matcher_name do |*args|
|
data/lib/ttytest/tmux/session.rb
CHANGED
@@ -138,6 +138,19 @@ module TTYtest
|
|
138
138
|
driver.tmux(*%W[send-keys -t #{name}], keys)
|
139
139
|
end
|
140
140
|
|
141
|
+
def send_home
|
142
|
+
send_keys_exact(%(Home))
|
143
|
+
end
|
144
|
+
|
145
|
+
def send_end
|
146
|
+
send_keys_exact(%(End))
|
147
|
+
end
|
148
|
+
|
149
|
+
def send_clear
|
150
|
+
send_keys_one_at_a_time(TTYtest::CLEAR)
|
151
|
+
send_newline
|
152
|
+
end
|
153
|
+
|
141
154
|
private
|
142
155
|
|
143
156
|
attr_reader :driver, :name
|
data/lib/ttytest/version.rb
CHANGED
data/notes.txt
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ttytest2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Eski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|