rautomation 0.17.0 → 1.0.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 +5 -5
- data/.document +1 -1
- data/.gitignore +37 -36
- data/.yardopts +4 -2
- data/CHANGES.md +264 -0
- data/Gemfile.lock +12 -4
- data/LICENSE +1 -1
- data/README.md +141 -0
- data/VERSION +1 -1
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj +103 -101
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj +2 -0
- data/lib/rautomation/adapter/autoit/button.rb +2 -2
- data/lib/rautomation/adapter/autoit/text_field.rb +2 -2
- data/lib/rautomation/adapter/autoit/window.rb +2 -2
- data/lib/rautomation/adapter/ms_uia/control.rb +2 -2
- data/lib/rautomation/adapter/ms_uia/uia_dll.rb +3 -3
- data/lib/rautomation/adapter/ms_uia/window.rb +3 -3
- data/lib/rautomation/adapter/win_32/control.rb +2 -2
- data/lib/rautomation/adapter/win_32/mouse.rb +59 -59
- data/lib/rautomation/adapter/win_32/window.rb +7 -7
- data/lib/rautomation/window.rb +4 -4
- data/rautomation.gemspec +36 -34
- data/spec/button_spec.rb +68 -69
- data/spec/spec_helper.rb +122 -122
- data/spec/text_field_spec.rb +2 -2
- data/spec/window_spec.rb +149 -149
- metadata +53 -27
- data/History.rdoc +0 -273
- data/README.rdoc +0 -120
data/lib/rautomation/window.rb
CHANGED
@@ -72,27 +72,27 @@ module RAutomation
|
|
72
72
|
@@wait_timeout = 60
|
73
73
|
|
74
74
|
# Change the timeout to wait before {WaitHelper::TimeoutError} is raised.
|
75
|
-
# @param [
|
75
|
+
# @param [Integer] timeout in seconds.
|
76
76
|
def wait_timeout=(timeout)
|
77
77
|
@@wait_timeout = timeout
|
78
78
|
end
|
79
79
|
|
80
80
|
# Retrieve current timeout in seconds to wait before {WaitHelper::TimeoutError} is raised.
|
81
|
-
# @return [
|
81
|
+
# @return [Integer] timeout in seconds
|
82
82
|
def wait_timeout
|
83
83
|
@@wait_timeout
|
84
84
|
end
|
85
85
|
|
86
86
|
end
|
87
87
|
|
88
|
-
# @return [
|
88
|
+
# @return [Integer] handle of the window which is used internally for other methods.
|
89
89
|
# @raise [UnknownWindowException] if the window doesn't exist.
|
90
90
|
def hwnd
|
91
91
|
wait_until_present
|
92
92
|
@window.hwnd
|
93
93
|
end
|
94
94
|
|
95
|
-
# @return [
|
95
|
+
# @return [Integer] process identifier (PID) of the window.
|
96
96
|
# @raise [UnknownWindowException] if the window doesn't exist.
|
97
97
|
def pid
|
98
98
|
wait_until_present
|
data/rautomation.gemspec
CHANGED
@@ -1,34 +1,36 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
Gem::Specification.new do |s|
|
3
|
-
s.name = %q{rautomation}
|
4
|
-
s.version = File.read("VERSION").strip
|
5
|
-
s.authors = [%q{Jarmo Pertman}]
|
6
|
-
s.email = %q{jarmo.p@gmail.com}
|
7
|
-
s.description = %q{RAutomation is a small and easy to use library for helping out to automate windows and their controls
|
8
|
-
for automated testing.
|
9
|
-
|
10
|
-
RAutomation provides:
|
11
|
-
* Easy to use and user-friendly API (inspired by Watir http://www.watir.com)
|
12
|
-
* Cross-platform compatibility
|
13
|
-
* Easy extensibility - with small scripting effort it's possible to add support for not yet
|
14
|
-
supported platforms or technologies}
|
15
|
-
s.homepage = %q{http://github.com/jarmo/RAutomation}
|
16
|
-
s.summary = %q{Automate windows and their controls through user-friendly API with Ruby}
|
17
|
-
s.license = "MIT"
|
18
|
-
|
19
|
-
ext_binaries = [
|
20
|
-
"ext/IAccessibleDLL/Release/IAccessibleDLL.dll",
|
21
|
-
"ext/UiaDll/Release/UiaDll.dll",
|
22
|
-
"ext/UiaDll/Release/RAutomation.UIA.dll",
|
23
|
-
"ext/WindowsForms/Release/WindowsForms.exe"
|
24
|
-
]
|
25
|
-
s.files = `git ls-files`.split("\n") + ext_binaries
|
26
|
-
s.test_files = `git ls-files -- spec/*`.split("\n")
|
27
|
-
s.require_paths = ["lib"]
|
28
|
-
|
29
|
-
s.add_dependency("ffi", "~>1.
|
30
|
-
s.add_development_dependency("rspec", "~> 2.14")
|
31
|
-
s.add_development_dependency("rake")
|
32
|
-
s.add_development_dependency("yard")
|
33
|
-
|
34
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.name = %q{rautomation}
|
4
|
+
s.version = File.read("VERSION").strip
|
5
|
+
s.authors = [%q{Jarmo Pertman}]
|
6
|
+
s.email = %q{jarmo.p@gmail.com}
|
7
|
+
s.description = %q{RAutomation is a small and easy to use library for helping out to automate windows and their controls
|
8
|
+
for automated testing.
|
9
|
+
|
10
|
+
RAutomation provides:
|
11
|
+
* Easy to use and user-friendly API (inspired by Watir http://www.watir.com)
|
12
|
+
* Cross-platform compatibility
|
13
|
+
* Easy extensibility - with small scripting effort it's possible to add support for not yet
|
14
|
+
supported platforms or technologies}
|
15
|
+
s.homepage = %q{http://github.com/jarmo/RAutomation}
|
16
|
+
s.summary = %q{Automate windows and their controls through user-friendly API with Ruby}
|
17
|
+
s.license = "MIT"
|
18
|
+
|
19
|
+
ext_binaries = [
|
20
|
+
"ext/IAccessibleDLL/Release/IAccessibleDLL.dll",
|
21
|
+
"ext/UiaDll/Release/UiaDll.dll",
|
22
|
+
"ext/UiaDll/Release/RAutomation.UIA.dll",
|
23
|
+
"ext/WindowsForms/Release/WindowsForms.exe"
|
24
|
+
]
|
25
|
+
s.files = `git ls-files`.split("\n") + ext_binaries
|
26
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
|
29
|
+
s.add_dependency("ffi", "~> 1.11.0")
|
30
|
+
s.add_development_dependency("rspec", "~> 2.14")
|
31
|
+
s.add_development_dependency("rake")
|
32
|
+
s.add_development_dependency("yard")
|
33
|
+
s.add_development_dependency("redcarpet")
|
34
|
+
s.add_development_dependency("github-markup")
|
35
|
+
end
|
36
|
+
|
data/spec/button_spec.rb
CHANGED
@@ -1,69 +1,68 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe RAutomation::Button do
|
4
|
-
it "#button" do
|
5
|
-
RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).
|
6
|
-
button(:value => "Close").should exist
|
7
|
-
|
8
|
-
RAutomation::Window.wait_timeout = 0.1
|
9
|
-
expect {RAutomation::Window.new(:title => "non-existing-window").button(:value => "Something")}.
|
10
|
-
to raise_exception(RAutomation::UnknownWindowException)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "#value" do
|
14
|
-
RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).
|
15
|
-
button(:value => "Close").value.should == "Close"
|
16
|
-
|
17
|
-
RAutomation::Window.wait_timeout = 0.1
|
18
|
-
expect {RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).button(:value => "non-existent-button").value}.
|
19
|
-
to raise_exception(RAutomation::UnknownButtonException)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "#exists?" do
|
23
|
-
window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
|
24
|
-
window.button(:value => "Close").should exist
|
25
|
-
window.button(:value => "non-existent-button").should_not exist
|
26
|
-
end
|
27
|
-
|
28
|
-
it "clicking non-existing button raises exception" do
|
29
|
-
window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
|
30
|
-
RAutomation::Window.wait_timeout = 0.1
|
31
|
-
expect {window.button(:value => "non-existent-button").click}.
|
32
|
-
to raise_exception(RAutomation::UnknownButtonException)
|
33
|
-
end
|
34
|
-
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
button
|
40
|
-
button.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
button
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
RAutomation::Window.
|
60
|
-
|
61
|
-
button
|
62
|
-
button.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RAutomation::Button do
|
4
|
+
it "#button" do
|
5
|
+
RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).
|
6
|
+
button(:value => "Close").should exist
|
7
|
+
|
8
|
+
RAutomation::Window.wait_timeout = 0.1
|
9
|
+
expect {RAutomation::Window.new(:title => "non-existing-window").button(:value => "Something")}.
|
10
|
+
to raise_exception(RAutomation::UnknownWindowException)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "#value" do
|
14
|
+
RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).
|
15
|
+
button(:value => "Close").value.should == "Close"
|
16
|
+
|
17
|
+
RAutomation::Window.wait_timeout = 0.1
|
18
|
+
expect {RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).button(:value => "non-existent-button").value}.
|
19
|
+
to raise_exception(RAutomation::UnknownButtonException)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "#exists?" do
|
23
|
+
window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
|
24
|
+
window.button(:value => "Close").should exist
|
25
|
+
window.button(:value => "non-existent-button").should_not exist
|
26
|
+
end
|
27
|
+
|
28
|
+
it "clicking non-existing button raises exception" do
|
29
|
+
window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
|
30
|
+
RAutomation::Window.wait_timeout = 0.1
|
31
|
+
expect {window.button(:value => "non-existent-button").click}.
|
32
|
+
to raise_exception(RAutomation::UnknownButtonException)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "#click" do
|
36
|
+
window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
|
37
|
+
|
38
|
+
button = window.button(:value => "Close")
|
39
|
+
button.should exist
|
40
|
+
button.click
|
41
|
+
|
42
|
+
button.should_not exist
|
43
|
+
RAutomation::WaitHelper.wait_until { !window.exists? }
|
44
|
+
end
|
45
|
+
|
46
|
+
it "#click with a block for defining successful click returning false raises a TimeoutError" do
|
47
|
+
window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
|
48
|
+
RAutomation::Window.wait_timeout = 5
|
49
|
+
button = window.button(:value => "Close")
|
50
|
+
expect {button.click {false}}.
|
51
|
+
to raise_exception(RAutomation::WaitHelper::TimeoutError)
|
52
|
+
|
53
|
+
button.should_not exist
|
54
|
+
window.should_not exist
|
55
|
+
end
|
56
|
+
|
57
|
+
it "#click with a block for defining successful click returning true" do
|
58
|
+
RAutomation::Window.wait_timeout = 10
|
59
|
+
window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
|
60
|
+
button = window.button(:value => "Close")
|
61
|
+
button.should exist
|
62
|
+
button.click {|button| !button.exists? && !window.exists?}
|
63
|
+
|
64
|
+
button.should_not exist
|
65
|
+
window.should_not exist
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,122 +1,122 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
require 'rautomation'
|
3
|
-
require 'rspec'
|
4
|
-
require 'timeout'
|
5
|
-
|
6
|
-
module SpecHelper
|
7
|
-
# @private
|
8
|
-
def adapter
|
9
|
-
ENV["RAUTOMATION_ADAPTER"] && ENV["RAUTOMATION_ADAPTER"].to_sym || RAutomation::Adapter::Helper.default_adapter
|
10
|
-
end
|
11
|
-
|
12
|
-
def navigate_to_simple_elements
|
13
|
-
main_window = RAutomation::Window.new(:title => "MainFormWindow")
|
14
|
-
main_window.button(:value => "Simple Elements").click { RAutomation::Window.new(:title => "SimpleElementsForm").present? }
|
15
|
-
end
|
16
|
-
|
17
|
-
module_function :adapter, :navigate_to_simple_elements
|
18
|
-
|
19
|
-
# Since adapters are different then the windows to be tested
|
20
|
-
# might be different also.
|
21
|
-
#
|
22
|
-
# This constant allows to create input data for specs which could differ between the adapters.
|
23
|
-
#
|
24
|
-
# There has to be 2 windows:
|
25
|
-
# 1) Some random window, which is maximizable, minimizable, close'able and etc.
|
26
|
-
# 2) Browser window, which opens up a test.html where JavaScript prompt with a Button and a TextField objects will be shown.
|
27
|
-
DATA = {
|
28
|
-
# This adapter needs Windows OS with Internet Explorer installed into 'c:\program files\internet explorer'.
|
29
|
-
:autoit => {
|
30
|
-
# Path to some binary, which opens up a window, what can be
|
31
|
-
# minimized, maximized, activated, closed and etc.
|
32
|
-
:window1 => "ext\\WindowsForms\\Release\\WindowsForms.exe",
|
33
|
-
:window2 => "
|
34
|
-
:window2_title => /
|
35
|
-
# Window 1 title, has to be a Regexp.
|
36
|
-
:window1_title => /FormWindow/i,
|
37
|
-
:window1_full_title => 'MainFormWindow',
|
38
|
-
# Window 1 should have this text on it.
|
39
|
-
:window1_text => "This is a sample text",
|
40
|
-
# When sending ENTER on Window 2, then the window OK button should be pressed and Window 2 should be closed.
|
41
|
-
# "A" key
|
42
|
-
:window1_send_keys => "A",
|
43
|
-
:proc_after_send_keys => lambda do
|
44
|
-
about_box = RAutomation::Window.new(:title => /About/i)
|
45
|
-
RAutomation::WaitHelper.wait_until {about_box.present?}
|
46
|
-
end,
|
47
|
-
# Window 1 should have a button with the following text.
|
48
|
-
:window1_button_text => "&About",
|
49
|
-
# Window 1 should have a text field with the specified class name.
|
50
|
-
:window1_text_field_class => "Edit",
|
51
|
-
# Adapter internal method invocation for getting title of window2
|
52
|
-
:title_proc => lambda {|win| win.WinGetTitle("[TITLE:MainFormWindow]")}
|
53
|
-
},
|
54
|
-
:win_32 => {
|
55
|
-
# Path to some binary, which opens up a window, what can be
|
56
|
-
# minimized, maximized, activated, closed and etc.
|
57
|
-
:window1 => "ext\\WindowsForms\\Release\\WindowsForms.exe",
|
58
|
-
:window2 => "
|
59
|
-
:window2_title => /
|
60
|
-
# Window 1 title, has to be a Regexp.
|
61
|
-
:window1_title => /FormWindow/i,
|
62
|
-
:window1_full_title => 'MainFormWindow',
|
63
|
-
# Window 1 should have this text on it.
|
64
|
-
:window1_text => "This is a sample text",
|
65
|
-
# When sending ENTER on Window 2, then the window OK button should be pressed and Window 2 should be closed.
|
66
|
-
# "A" key
|
67
|
-
:window1_send_keys => "A",
|
68
|
-
:proc_after_send_keys => lambda do
|
69
|
-
about_box = RAutomation::Window.new(:title => /About/i)
|
70
|
-
RAutomation::WaitHelper.wait_until {about_box.present?}
|
71
|
-
end,
|
72
|
-
# Window 1 should have a button with the following text.
|
73
|
-
:window1_button_text => "&About",
|
74
|
-
# Window 1 should have a text field with the specified class name.
|
75
|
-
:window1_text_field_class => "Edit",
|
76
|
-
# Adapter internal method invocation for getting title of window2
|
77
|
-
:title_proc => lambda {|win| win.window_title(win.hwnd)}
|
78
|
-
},
|
79
|
-
#Just copying :win_ffi data for now
|
80
|
-
:ms_uia => {
|
81
|
-
# Path to some binary, which opens up a window, what can be
|
82
|
-
# minimized, maximized, activated, closed and etc.
|
83
|
-
:window1 => "ext\\WindowsForms\\Release\\WindowsForms.exe",
|
84
|
-
:window2 => "
|
85
|
-
:window2_title => /
|
86
|
-
# Window 1 title, has to be a Regexp.
|
87
|
-
:window1_title => /FormWindow/i,
|
88
|
-
:window1_full_title => 'MainFormWindow',
|
89
|
-
# Window 1 should have this text on it.
|
90
|
-
:window1_text => "This is a sample text",
|
91
|
-
# When sending ENTER on Window 2, then the window OK button should be pressed and Window 2 should be closed.
|
92
|
-
# "A" key
|
93
|
-
:window1_send_keys => "A",
|
94
|
-
:proc_after_send_keys => lambda do
|
95
|
-
about_box = RAutomation::Window.new(:title => /About/i)
|
96
|
-
RAutomation::WaitHelper.wait_until {about_box.present?}
|
97
|
-
end,
|
98
|
-
# Window 1 should have a button with the following text.
|
99
|
-
:window1_button_text => "&About",
|
100
|
-
# Window 1 should have a text field with the specified class name.
|
101
|
-
:window1_text_field_class => "Edit",
|
102
|
-
# Adapter internal method invocation for getting title of window2
|
103
|
-
:title_proc => lambda {|win| win.window_title(win.hwnd)}
|
104
|
-
}
|
105
|
-
}[adapter]
|
106
|
-
end
|
107
|
-
|
108
|
-
|
109
|
-
RSpec.configure do |config|
|
110
|
-
config.before(:each) do
|
111
|
-
RAutomation::Window.wait_timeout = 15
|
112
|
-
|
113
|
-
unless example.metadata[:pure_unit]
|
114
|
-
@pid1 = IO.popen(SpecHelper::DATA[:window1]).pid
|
115
|
-
RAutomation::WaitHelper.wait_until { RAutomation::Window.new(:pid => @pid1).present? }
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
config.after(:each) do
|
120
|
-
Process.kill(9, @pid1) rescue nil
|
121
|
-
end
|
122
|
-
end
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require 'rautomation'
|
3
|
+
require 'rspec'
|
4
|
+
require 'timeout'
|
5
|
+
|
6
|
+
module SpecHelper
|
7
|
+
# @private
|
8
|
+
def adapter
|
9
|
+
ENV["RAUTOMATION_ADAPTER"] && ENV["RAUTOMATION_ADAPTER"].to_sym || RAutomation::Adapter::Helper.default_adapter
|
10
|
+
end
|
11
|
+
|
12
|
+
def navigate_to_simple_elements
|
13
|
+
main_window = RAutomation::Window.new(:title => "MainFormWindow")
|
14
|
+
main_window.button(:value => "Simple Elements").click { RAutomation::Window.new(:title => "SimpleElementsForm").present? }
|
15
|
+
end
|
16
|
+
|
17
|
+
module_function :adapter, :navigate_to_simple_elements
|
18
|
+
|
19
|
+
# Since adapters are different then the windows to be tested
|
20
|
+
# might be different also.
|
21
|
+
#
|
22
|
+
# This constant allows to create input data for specs which could differ between the adapters.
|
23
|
+
#
|
24
|
+
# There has to be 2 windows:
|
25
|
+
# 1) Some random window, which is maximizable, minimizable, close'able and etc.
|
26
|
+
# 2) Browser window, which opens up a test.html where JavaScript prompt with a Button and a TextField objects will be shown.
|
27
|
+
DATA = {
|
28
|
+
# This adapter needs Windows OS with Internet Explorer installed into 'c:\program files\internet explorer'.
|
29
|
+
:autoit => {
|
30
|
+
# Path to some binary, which opens up a window, what can be
|
31
|
+
# minimized, maximized, activated, closed and etc.
|
32
|
+
:window1 => "ext\\WindowsForms\\Release\\WindowsForms.exe",
|
33
|
+
:window2 => "notepad",
|
34
|
+
:window2_title => /notepad/i,
|
35
|
+
# Window 1 title, has to be a Regexp.
|
36
|
+
:window1_title => /FormWindow/i,
|
37
|
+
:window1_full_title => 'MainFormWindow',
|
38
|
+
# Window 1 should have this text on it.
|
39
|
+
:window1_text => "This is a sample text",
|
40
|
+
# When sending ENTER on Window 2, then the window OK button should be pressed and Window 2 should be closed.
|
41
|
+
# "A" key
|
42
|
+
:window1_send_keys => "A",
|
43
|
+
:proc_after_send_keys => lambda do
|
44
|
+
about_box = RAutomation::Window.new(:title => /About/i)
|
45
|
+
RAutomation::WaitHelper.wait_until {about_box.present?}
|
46
|
+
end,
|
47
|
+
# Window 1 should have a button with the following text.
|
48
|
+
:window1_button_text => "&About",
|
49
|
+
# Window 1 should have a text field with the specified class name.
|
50
|
+
:window1_text_field_class => "Edit",
|
51
|
+
# Adapter internal method invocation for getting title of window2
|
52
|
+
:title_proc => lambda {|win| win.WinGetTitle("[TITLE:MainFormWindow]")}
|
53
|
+
},
|
54
|
+
:win_32 => {
|
55
|
+
# Path to some binary, which opens up a window, what can be
|
56
|
+
# minimized, maximized, activated, closed and etc.
|
57
|
+
:window1 => "ext\\WindowsForms\\Release\\WindowsForms.exe",
|
58
|
+
:window2 => "notepad",
|
59
|
+
:window2_title => /notepad/i,
|
60
|
+
# Window 1 title, has to be a Regexp.
|
61
|
+
:window1_title => /FormWindow/i,
|
62
|
+
:window1_full_title => 'MainFormWindow',
|
63
|
+
# Window 1 should have this text on it.
|
64
|
+
:window1_text => "This is a sample text",
|
65
|
+
# When sending ENTER on Window 2, then the window OK button should be pressed and Window 2 should be closed.
|
66
|
+
# "A" key
|
67
|
+
:window1_send_keys => "A",
|
68
|
+
:proc_after_send_keys => lambda do
|
69
|
+
about_box = RAutomation::Window.new(:title => /About/i)
|
70
|
+
RAutomation::WaitHelper.wait_until {about_box.present?}
|
71
|
+
end,
|
72
|
+
# Window 1 should have a button with the following text.
|
73
|
+
:window1_button_text => "&About",
|
74
|
+
# Window 1 should have a text field with the specified class name.
|
75
|
+
:window1_text_field_class => "Edit",
|
76
|
+
# Adapter internal method invocation for getting title of window2
|
77
|
+
:title_proc => lambda {|win| win.window_title(win.hwnd)}
|
78
|
+
},
|
79
|
+
#Just copying :win_ffi data for now
|
80
|
+
:ms_uia => {
|
81
|
+
# Path to some binary, which opens up a window, what can be
|
82
|
+
# minimized, maximized, activated, closed and etc.
|
83
|
+
:window1 => "ext\\WindowsForms\\Release\\WindowsForms.exe",
|
84
|
+
:window2 => "notepad",
|
85
|
+
:window2_title => /notepad/i,
|
86
|
+
# Window 1 title, has to be a Regexp.
|
87
|
+
:window1_title => /FormWindow/i,
|
88
|
+
:window1_full_title => 'MainFormWindow',
|
89
|
+
# Window 1 should have this text on it.
|
90
|
+
:window1_text => "This is a sample text",
|
91
|
+
# When sending ENTER on Window 2, then the window OK button should be pressed and Window 2 should be closed.
|
92
|
+
# "A" key
|
93
|
+
:window1_send_keys => "A",
|
94
|
+
:proc_after_send_keys => lambda do
|
95
|
+
about_box = RAutomation::Window.new(:title => /About/i)
|
96
|
+
RAutomation::WaitHelper.wait_until {about_box.present?}
|
97
|
+
end,
|
98
|
+
# Window 1 should have a button with the following text.
|
99
|
+
:window1_button_text => "&About",
|
100
|
+
# Window 1 should have a text field with the specified class name.
|
101
|
+
:window1_text_field_class => "Edit",
|
102
|
+
# Adapter internal method invocation for getting title of window2
|
103
|
+
:title_proc => lambda {|win| win.window_title(win.hwnd)}
|
104
|
+
}
|
105
|
+
}[adapter]
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
RSpec.configure do |config|
|
110
|
+
config.before(:each) do
|
111
|
+
RAutomation::Window.wait_timeout = 15
|
112
|
+
|
113
|
+
unless example.metadata[:pure_unit]
|
114
|
+
@pid1 = IO.popen(SpecHelper::DATA[:window1]).pid
|
115
|
+
RAutomation::WaitHelper.wait_until { RAutomation::Window.new(:pid => @pid1).present? }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
config.after(:each) do
|
120
|
+
Process.kill(9, @pid1) rescue nil
|
121
|
+
end
|
122
|
+
end
|