ttytest2 0.9.3 → 0.9.5
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 +94 -61
- 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/terminal.rb +39 -3
- data/lib/ttytest/tmux/session.rb +12 -4
- 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: a1d11e60e54ba7d4b267d4b51d0fedeeade66563ac9957dd652b4fb94e57ed4b
|
4
|
+
data.tar.gz: 568127f476a6fbed14d5288e4a07dddfa5512a9b050c9a31bd7071c92b7a90dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78b47ae1254de6020012e16e1825f2d43d5fe5ef36eb8c7deb141023e6a33616561f8794a02b79113963aa290e2c7b30df8fc0e73c0d4adf1c59de093ed70973
|
7
|
+
data.tar.gz: 2b9da01bb485487eb5e060a8a69ae9d7e989c5d5be1f873efe94a287773d0abc1106fd16002f88343c012d21a28642421ec0c8cbf222f886bcc32580abdd0154
|
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,24 @@ 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
|
61
140
|
|
62
141
|
### Troubleshooting
|
63
142
|
|
64
143
|
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
144
|
|
66
145
|
``` ruby
|
67
|
-
p @tty.rows # prints out the contents of the terminal as a array
|
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
|
146
|
+
p @tty.rows # prints out the contents of the terminal as a array
|
147
|
+
@tty.print_rows # equivalent to above
|
122
148
|
|
123
149
|
puts "\n#{@tty.capture}" # prints out the contents of the terminal
|
150
|
+
@tty.print # equivalent to above
|
124
151
|
```
|
125
152
|
|
126
153
|
### Constants
|
127
154
|
|
128
|
-
There are some commonly used keys available as constants to make interacting with your shell/CLI easy.
|
155
|
+
There are some commonly used keys available as constants to make interacting with your shell/CLI easy.
|
129
156
|
|
130
157
|
``` ruby
|
131
158
|
TTYtest::BACKSPACE
|
@@ -143,6 +170,12 @@ There are some commonly used keys available as constants to make interacting wit
|
|
143
170
|
TTYtest::CLEAR # clear the screen
|
144
171
|
```
|
145
172
|
|
173
|
+
### Tips
|
174
|
+
|
175
|
+
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.
|
176
|
+
|
177
|
+
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.
|
178
|
+
|
146
179
|
## Docker
|
147
180
|
|
148
181
|
Easy to use from Docker. Add this to your dockerfile to get started.
|
@@ -158,7 +191,7 @@ RUN apt update && \
|
|
158
191
|
|
159
192
|
## Contributing
|
160
193
|
|
161
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/a-eski/ttytest2.
|
194
|
+
Bug reports and pull requests are welcome on GitHub at [ttytest2](https://github.com/a-eski/ttytest2).
|
162
195
|
|
163
196
|
## License
|
164
197
|
|
@@ -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/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,8 +75,8 @@ 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,
|
46
|
-
:capture
|
78
|
+
:send_keys_exact, :send_home, :send_end,
|
79
|
+
:capture, :print, :print_rows
|
47
80
|
|
48
81
|
# @!method rows
|
49
82
|
# @return [Array<String>]
|
@@ -69,7 +102,10 @@ module TTYtest
|
|
69
102
|
# @!method cursor_hidden?
|
70
103
|
# @see Capture#cursor_hidden?
|
71
104
|
# @return [true,false]
|
72
|
-
def_delegators :capture, :rows, :row,
|
105
|
+
def_delegators :capture, :rows, :row,
|
106
|
+
:width, :height,
|
107
|
+
:cursor_x, :cursor_y,
|
108
|
+
:cursor_visible?, :cursor_hidden?
|
73
109
|
|
74
110
|
TTYtest::Matchers::METHODS.each do |matcher_name|
|
75
111
|
define_method matcher_name do |*args|
|
data/lib/ttytest/tmux/session.rb
CHANGED
@@ -87,7 +87,7 @@ module TTYtest
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def send_right_arrow
|
90
|
-
|
90
|
+
send_keys(TTYtest::RIGHT_ARROW)
|
91
91
|
end
|
92
92
|
|
93
93
|
def send_right_arrows(number_of_times)
|
@@ -98,7 +98,7 @@ module TTYtest
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def send_left_arrow
|
101
|
-
|
101
|
+
send_keys(TTYtest::LEFT_ARROW)
|
102
102
|
end
|
103
103
|
|
104
104
|
def send_left_arrows(number_of_times)
|
@@ -109,7 +109,7 @@ module TTYtest
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def send_up_arrow
|
112
|
-
|
112
|
+
send_keys(TTYtest::UP_ARROW)
|
113
113
|
end
|
114
114
|
|
115
115
|
def send_up_arrows(number_of_times)
|
@@ -120,7 +120,7 @@ module TTYtest
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def send_down_arrow
|
123
|
-
|
123
|
+
send_keys(TTYtest::DOWN_ARROW)
|
124
124
|
end
|
125
125
|
|
126
126
|
def send_down_arrows(number_of_times)
|
@@ -138,6 +138,14 @@ 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
|
+
|
141
149
|
private
|
142
150
|
|
143
151
|
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.5
|
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-
|
11
|
+
date: 2024-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|