te3270 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/Gemfile +1 -2
- data/README.md +2 -2
- data/lib/te3270.rb +5 -3
- data/lib/te3270/emulator_factory.rb +3 -1
- data/lib/te3270/emulators/virtel.rb +210 -0
- data/lib/te3270/version.rb +1 -1
- data/spec/lib/te3270/accessors_spec.rb +8 -8
- data/spec/lib/te3270/emulators/extra_spec.rb +143 -133
- data/spec/lib/te3270/emulators/quick3270_spec.rb +125 -118
- data/spec/lib/te3270/emulators/x3270_spec.rb +47 -49
- data/spec/lib/te3270/screen_factory_spec.rb +3 -3
- data/spec/lib/te3270/screen_populator_spec.rb +4 -4
- data/spec/lib/te3270_spec.rb +19 -19
- data/spec/spec_helper.rb +16 -20
- data/te3270.gemspec +5 -2
- metadata +35 -2
@@ -22,14 +22,14 @@ describe TE3270::ScreenFactory do
|
|
22
22
|
it 'should create a new screen object' do
|
23
23
|
emulator = double('platform')
|
24
24
|
world.instance_variable_set('@emulator', emulator)
|
25
|
-
world.on(ScreenFactoryScreen).
|
25
|
+
expect(world.on(ScreenFactoryScreen)).to be_instance_of ScreenFactoryScreen
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should create a new screen object and execute a block' do
|
29
29
|
emulator = double('platform')
|
30
30
|
world.instance_variable_set('@emulator', emulator)
|
31
31
|
world.on(ScreenFactoryScreen) do |page|
|
32
|
-
page.
|
32
|
+
expect(page).to be_instance_of ScreenFactoryScreen
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -43,6 +43,6 @@ describe TE3270::ScreenFactory do
|
|
43
43
|
emulator = double('platform')
|
44
44
|
world.instance_variable_set('@emulator', emulator)
|
45
45
|
world.on(NoTE)
|
46
|
-
world.super_called.
|
46
|
+
expect(world.super_called).to be true
|
47
47
|
end
|
48
48
|
end
|
@@ -13,18 +13,18 @@ describe TE3270::ScreenPopulator do
|
|
13
13
|
let(:screen_object) { ScreenPopulatorScreen.new platform }
|
14
14
|
|
15
15
|
it 'should set a value in a text field' do
|
16
|
-
platform.
|
16
|
+
expect(platform).to receive(:put_string).with('the_value', 1, 2)
|
17
17
|
screen_object.populate_screen_with editable: 'the_value'
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should not set a value when a text field is read only' do
|
21
|
-
platform.
|
21
|
+
expect(platform).not_to receive(:put_string)
|
22
22
|
screen_object.populate_screen_with read_only: 'the_value'
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should attempt to set all values from the provided Hash' do
|
26
|
-
platform.
|
27
|
-
platform.
|
26
|
+
expect(platform).to receive(:put_string).with('the_value', 1, 2)
|
27
|
+
expect(platform).not_to receive(:put_string).with('read_only', 2, 3)
|
28
28
|
screen_object.populate_screen_with(editable: 'the_value', read_only: 'read_only')
|
29
29
|
end
|
30
30
|
end
|
data/spec/lib/te3270_spec.rb
CHANGED
@@ -15,76 +15,76 @@ describe TE3270 do
|
|
15
15
|
let(:screen_object) { TEScreenObject.new platform }
|
16
16
|
|
17
17
|
before(:each) do
|
18
|
-
screen_object.
|
18
|
+
allow(screen_object).to receive(:platform).and_return platform
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "interacting with the platform" do
|
22
22
|
it 'should use the platform to connect to an emulator' do
|
23
|
-
platform.
|
23
|
+
expect(platform).to receive(:connect)
|
24
24
|
screen_object.connect
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should use the platform to disconnect from an emulator' do
|
28
|
-
platform.
|
28
|
+
expect(platform).to receive(:disconnect)
|
29
29
|
screen_object.disconnect
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should use the platform to send keys to the screen' do
|
33
|
-
platform.
|
33
|
+
expect(platform).to receive(:send_keys).with('<Clear>')
|
34
34
|
screen_object.send_keys(TE3270.Clear)
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should use the platform to wait for a string to appear on the screen' do
|
38
|
-
platform.
|
38
|
+
expect(platform).to receive(:wait_for_string).with('The String', 2, 4)
|
39
39
|
screen_object.wait_for_string('The String', 2, 4)
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should use the platform to wait for the host to be quiet' do
|
43
|
-
platform.
|
43
|
+
expect(platform).to receive(:wait_for_host).with(4)
|
44
44
|
screen_object.wait_for_host(4)
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'should default to five seconds when waiting for the host' do
|
48
|
-
platform.
|
48
|
+
expect(platform).to receive(:wait_for_host).with(5)
|
49
49
|
screen_object.wait_for_host
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'should use the platform to wait until the cursor at a specific position' do
|
53
|
-
platform.
|
53
|
+
expect(platform).to receive(:wait_until_cursor_at).with(10, 10)
|
54
54
|
screen_object.wait_until_cursor_at(10, 10)
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'should use the platform to take a screenshot of the screen' do
|
58
|
-
platform.
|
58
|
+
expect(platform).to receive(:screenshot).with('image.png')
|
59
59
|
screen_object.screenshot('image.png')
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'should use the platform to get the text for the entire screen' do
|
63
|
-
platform.
|
64
|
-
screen_object.text.
|
63
|
+
expect(platform).to receive(:text).and_return('123abc')
|
64
|
+
expect(screen_object.text).to eql '123abc'
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
describe "module functionality" do
|
69
69
|
it 'should know the function keys' do
|
70
|
-
TE3270.Clear.
|
71
|
-
TE3270.Pf24.
|
70
|
+
expect(TE3270.Clear).to eql '<Clear>'
|
71
|
+
expect(TE3270.Pf24).to eql '<Pf24>'
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'should call initialize_screen if it exists' do
|
75
|
-
screen_object.initialize_screen.
|
75
|
+
expect(screen_object.initialize_screen).to be true
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'should create an emulator and connect to terminal' do
|
79
|
-
TE3270::Emulators::Extra.
|
80
|
-
platform.
|
79
|
+
expect(TE3270::Emulators::Extra).to receive(:new).and_return(platform)
|
80
|
+
expect(platform).to receive(:connect)
|
81
81
|
TE3270.emulator_for :extra
|
82
82
|
end
|
83
83
|
|
84
84
|
if Gem.win_platform?
|
85
85
|
it 'should accept a block when creating an emulator' do
|
86
|
-
WIN32OLE.
|
87
|
-
|
86
|
+
expect(WIN32OLE).to receive(:new).and_return(extra_system)
|
87
|
+
expect(extra_session).to receive(:Open).with('blah.edp').and_return(extra_session)
|
88
88
|
TE3270.emulator_for :extra do |emulator|
|
89
89
|
emulator.session_file = 'blah.edp'
|
90
90
|
end
|
@@ -92,7 +92,7 @@ describe TE3270 do
|
|
92
92
|
end
|
93
93
|
|
94
94
|
it 'should allow one to disconnect using the module' do
|
95
|
-
platform.
|
95
|
+
expect(platform).to receive(:disconnect)
|
96
96
|
TE3270.disconnect(platform)
|
97
97
|
end
|
98
98
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,42 +1,38 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
2
|
|
3
|
+
require 'rspec'
|
3
4
|
require 'te3270'
|
4
5
|
if Gem.win_platform?
|
5
6
|
require 'win32ole'
|
6
7
|
require 'win32/screenshot'
|
7
8
|
end
|
8
9
|
|
9
|
-
RSpec.configure do |config|
|
10
|
-
config.mock_with :rspec do |mocks|
|
11
|
-
mocks.syntax = :should
|
12
|
-
end
|
13
|
-
end
|
14
10
|
|
15
11
|
def extra_system
|
16
12
|
@extra_system ||= double('system')
|
17
|
-
@extra_system.
|
18
|
-
@extra_system.
|
13
|
+
allow(@extra_system).to receive(:Sessions).and_return extra_sessions
|
14
|
+
allow(@extra_system).to receive(:Version).and_return("0")
|
19
15
|
@extra_system
|
20
16
|
end
|
21
17
|
|
22
18
|
def extra_sessions
|
23
19
|
@extra_sessions ||= double('sessions')
|
24
|
-
@extra_sessions.
|
25
|
-
@extra_sessions.
|
20
|
+
allow(@extra_sessions).to receive(:Count).and_return 0
|
21
|
+
allow(@extra_sessions).to receive(:Open).and_return extra_session
|
26
22
|
@extra_sessions
|
27
23
|
end
|
28
24
|
|
29
25
|
def extra_session
|
30
26
|
@extra_session ||= double('session')
|
31
|
-
@extra_session.
|
32
|
-
@extra_session.
|
33
|
-
@extra_session.
|
27
|
+
allow(@extra_session).to receive(:Screen).and_return extra_screen
|
28
|
+
allow(@extra_session).to receive(:WindowState=)
|
29
|
+
allow(@extra_session).to receive(:Visible=)
|
34
30
|
@extra_session
|
35
31
|
end
|
36
32
|
|
37
33
|
def extra_screen
|
38
34
|
@extra_screen ||= double('screen')
|
39
|
-
@extra_screen.
|
35
|
+
allow(@extra_screen).to receive(:SelectAll).and_return extra_area
|
40
36
|
@extra_screen
|
41
37
|
end
|
42
38
|
|
@@ -47,18 +43,18 @@ end
|
|
47
43
|
|
48
44
|
def quick_system
|
49
45
|
@quick_system ||= double('quick_system')
|
50
|
-
@quick_system.
|
51
|
-
@quick_system.
|
46
|
+
allow(@quick_system).to receive(:ActiveSession).and_return quick_session
|
47
|
+
allow(@quick_system).to receive(:Visible=)
|
52
48
|
@quick_system
|
53
49
|
end
|
54
50
|
|
55
51
|
def quick_session
|
56
52
|
@quick_session ||= double('quick_session')
|
57
|
-
@quick_session.
|
58
|
-
@quick_session.
|
59
|
-
@quick_session.
|
60
|
-
@quick_session.
|
61
|
-
@quick_session.
|
53
|
+
allow(@quick_session).to receive(:Screen).and_return quick_screen
|
54
|
+
allow(@quick_session).to receive(:Open)
|
55
|
+
allow(@quick_session).to receive(:Connect)
|
56
|
+
allow(@quick_session).to receive(:Server_Name=)
|
57
|
+
allow(@quick_session).to receive(:Connected).and_return true
|
62
58
|
@quick_session
|
63
59
|
end
|
64
60
|
|
data/te3270.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "te3270"
|
8
8
|
spec.version = TE3270::VERSION
|
9
9
|
spec.platform = Gem::Platform::RUBY
|
10
|
-
spec.authors = ["Jeffrey S. Morgan", "Nithin C. Reddy", "Glenn W. Waters", "Thrivikrama Madiraju"]
|
11
|
-
spec.email = ["jeff.morgan@leandog.com","nithinreddyc@gmail.com", "gwwaters@gmail.com", "akmadiraju@yahoo.com"]
|
10
|
+
spec.authors = ["Jeffrey S. Morgan", "Nithin C. Reddy", "Glenn W. Waters", "Thrivikrama Madiraju", "David West", "Jonathan Flatt"]
|
11
|
+
spec.email = ["jeff.morgan@leandog.com","nithinreddyc@gmail.com", "gwwaters@gmail.com", "akmadiraju@yahoo.com", "david.b.west@gmail.com", "c-flattj@grangeinsurance.com"]
|
12
12
|
spec.description = %q{Automates a 3270 Terminal Emulator}
|
13
13
|
spec.summary = %q{Automates a 3270 Terminal Emulator}
|
14
14
|
spec.homepage = "http://github.com/cheezy/te3270"
|
@@ -21,6 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.extensions = ["ext/mkrf_conf.rb"]
|
22
22
|
|
23
23
|
spec.add_dependency 'page_navigation', '>= 0.9'
|
24
|
+
spec.add_dependency 'watir-webdriver', '0.6.10'
|
25
|
+
spec.add_dependency 'selenium-webdriver', '~>2.35.0'
|
26
|
+
spec.add_dependency 'win32screenshot' if Gem.win_platform?
|
24
27
|
|
25
28
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
29
|
spec.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: te3270
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey S. Morgan
|
8
8
|
- Nithin C. Reddy
|
9
9
|
- Glenn W. Waters
|
10
10
|
- Thrivikrama Madiraju
|
11
|
+
- David West
|
12
|
+
- Jonathan Flatt
|
11
13
|
autorequire:
|
12
14
|
bindir: bin
|
13
15
|
cert_chain: []
|
14
|
-
date: 2016-
|
16
|
+
date: 2016-11-22 00:00:00.000000000 Z
|
15
17
|
dependencies:
|
16
18
|
- !ruby/object:Gem::Dependency
|
17
19
|
name: page_navigation
|
@@ -27,6 +29,34 @@ dependencies:
|
|
27
29
|
- - ">="
|
28
30
|
- !ruby/object:Gem::Version
|
29
31
|
version: '0.9'
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: watir-webdriver
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - '='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.6.10
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - '='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.6.10
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: selenium-webdriver
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.35.0
|
53
|
+
type: :runtime
|
54
|
+
prerelease: false
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 2.35.0
|
30
60
|
- !ruby/object:Gem::Dependency
|
31
61
|
name: bundler
|
32
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +105,8 @@ email:
|
|
75
105
|
- nithinreddyc@gmail.com
|
76
106
|
- gwwaters@gmail.com
|
77
107
|
- akmadiraju@yahoo.com
|
108
|
+
- david.b.west@gmail.com
|
109
|
+
- c-flattj@grangeinsurance.com
|
78
110
|
executables: []
|
79
111
|
extensions:
|
80
112
|
- ext/mkrf_conf.rb
|
@@ -95,6 +127,7 @@ files:
|
|
95
127
|
- lib/te3270/emulator_factory.rb
|
96
128
|
- lib/te3270/emulators/extra.rb
|
97
129
|
- lib/te3270/emulators/quick3270.rb
|
130
|
+
- lib/te3270/emulators/virtel.rb
|
98
131
|
- lib/te3270/emulators/x3270.rb
|
99
132
|
- lib/te3270/function_keys.rb
|
100
133
|
- lib/te3270/screen_factory.rb
|