win32-autogui 0.3.0 → 0.4.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.
data/.gemfiles ADDED
@@ -0,0 +1,78 @@
1
+ .gemfiles
2
+ .gitattributes
3
+ .gitignore
4
+ .yardopts
5
+ Gemfile
6
+ Gemfile.lock
7
+ HISTORY.markdown
8
+ LICENSE
9
+ README.markdown
10
+ Rakefile
11
+ TODO.markdown
12
+ VERSION
13
+ config/cucumber.yml
14
+ examples/quicknote/.gitignore
15
+ examples/quicknote/FormAboutU.dfm
16
+ examples/quicknote/FormAboutU.pas
17
+ examples/quicknote/FormMainU.dfm
18
+ examples/quicknote/FormMainU.pas
19
+ examples/quicknote/FormSplashU.dfm
20
+ examples/quicknote/FormSplashU.pas
21
+ examples/quicknote/LICENSE
22
+ examples/quicknote/README.markdown
23
+ examples/quicknote/Rakefile
24
+ examples/quicknote/TODO.markdown
25
+ examples/quicknote/dcu/.gitignore
26
+ examples/quicknote/exe/.gitignore
27
+ examples/quicknote/exe/quicknote.exe
28
+ examples/quicknote/lib/quicknote.rb
29
+ examples/quicknote/quicknote.cfg
30
+ examples/quicknote/quicknote.dof
31
+ examples/quicknote/quicknote.dpr
32
+ examples/quicknote/quicknote.res
33
+ examples/quicknote/spec/quicknote/form_about_spec.rb
34
+ examples/quicknote/spec/quicknote/form_main_spec.rb
35
+ examples/quicknote/spec/quicknote/form_splash_spec.rb
36
+ examples/quicknote/spec/spec.opts
37
+ examples/quicknote/spec/spec_helper.rb
38
+ examples/quicknote/spec/watchr.rb
39
+ examples/skeleton/.gitignore
40
+ examples/skeleton/HISTORY.markdown
41
+ examples/skeleton/LICENSE
42
+ examples/skeleton/README.markdown
43
+ examples/skeleton/Rakefile
44
+ examples/skeleton/TODO.markdown
45
+ examples/skeleton/config/cucumber.yml
46
+ examples/skeleton/dcu/.gitignore
47
+ examples/skeleton/exe/.gitignore
48
+ examples/skeleton/features/basic.feature
49
+ examples/skeleton/features/step_definitions/.gitignore
50
+ examples/skeleton/features/step_definitions/application_steps.rb
51
+ examples/skeleton/features/support/env.rb
52
+ examples/skeleton/lib/myapp.rb
53
+ examples/skeleton/spec/myapp/form_about_spec.rb
54
+ examples/skeleton/spec/myapp/form_main_spec.rb
55
+ examples/skeleton/spec/spec.opts
56
+ examples/skeleton/spec/spec_helper.rb
57
+ examples/skeleton/spec/watchr.rb
58
+ features/automating_an_application.feature
59
+ features/step_definitions/.gitignore
60
+ features/step_definitions/calculator_steps.rb
61
+ features/support/env.rb
62
+ lib/win32/autogui.rb
63
+ lib/win32/autogui/application.rb
64
+ lib/win32/autogui/input.rb
65
+ lib/win32/autogui/logging.rb
66
+ lib/win32/autogui/window.rb
67
+ lib/win32/autogui/windows/window.rb
68
+ spec/applications/calculator.rb
69
+ spec/auto_gui/application_spec.rb
70
+ spec/auto_gui/logging_spec.rb
71
+ spec/auto_gui/window_spec.rb
72
+ spec/basic_gem/aruba_helper_spec.rb
73
+ spec/basic_gem/basic_gem_spec.rb
74
+ spec/basic_gem/gemspec_spec.rb
75
+ spec/spec.opts
76
+ spec/spec_helper.rb
77
+ spec/watchr.rb
78
+ win32-autogui.gemspec
data/.yardopts CHANGED
@@ -1,5 +1,4 @@
1
1
  --verbose
2
- --list-undoc
3
2
  -
4
3
  LICENSE
5
4
  HISTORY.markdown
data/Gemfile.lock CHANGED
@@ -1,22 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- win32-autogui (0.3.0)
4
+ win32-autogui (0.4.0)
5
5
  log4r (>= 1.1.9)
6
6
  win32-clipboard (>= 0.5.2)
7
- win32-process (>= 0.6.2)
7
+ win32-process (>= 0.6.4)
8
8
  windows-api (>= 0.4.0)
9
- windows-pr (>= 1.0.9)
9
+ windows-pr (>= 1.1.2)
10
10
 
11
11
  GEM
12
12
  remote: http://rubygems.org/
13
13
  specs:
14
- aruba (0.2.3)
15
- background_process
16
- cucumber (~> 0.9.0)
17
- background_process (1.2)
14
+ aruba (0.2.2)
18
15
  builder (2.1.2)
19
- cucumber (0.9.3)
16
+ cucumber (0.9.4)
20
17
  builder (~> 2.1.2)
21
18
  diff-lcs (~> 1.1.2)
22
19
  gherkin (~> 2.2.9)
@@ -27,37 +24,37 @@ GEM
27
24
  json (~> 1.4.6)
28
25
  term-ansicolor (~> 1.0.5)
29
26
  json (1.4.6)
27
+ kramdown (0.12.0)
30
28
  log4r (1.1.9)
31
29
  rake (0.8.7)
32
- rdiscount (1.6.5)
33
30
  rspec (1.3.1)
34
31
  term-ansicolor (1.0.5)
35
32
  win32-api (1.4.6)
36
33
  win32-clipboard (0.5.2)
37
34
  windows-pr (>= 1.0.3)
38
- win32-process (0.6.2)
39
- windows-pr (>= 1.0.5)
35
+ win32-process (0.6.4)
36
+ windows-pr (>= 1.1.0)
40
37
  windows-api (0.4.0)
41
38
  win32-api (>= 1.4.5)
42
- windows-pr (1.0.9)
39
+ windows-pr (1.1.2)
43
40
  win32-api (>= 1.4.5)
44
41
  windows-api (>= 0.3.0)
45
- yard (0.6.1)
42
+ yard (0.6.2)
46
43
 
47
44
  PLATFORMS
48
45
  ruby
49
46
 
50
47
  DEPENDENCIES
51
- aruba (>= 0.2.3)
52
- bundler (>= 1.0.3)
53
- cucumber (>= 0.9.2)
48
+ aruba (= 0.2.2)
49
+ bundler (>= 1.0.7)
50
+ cucumber (>= 0.9.4)
51
+ kramdown (>= 0.12.0)
54
52
  log4r (>= 1.1.9)
55
53
  rake (>= 0.8.7)
56
- rdiscount (>= 1.6.5)
57
54
  rspec (= 1.3.1)
58
55
  win32-autogui!
59
56
  win32-clipboard (>= 0.5.2)
60
- win32-process (>= 0.6.2)
57
+ win32-process (>= 0.6.4)
61
58
  windows-api (>= 0.4.0)
62
- windows-pr (>= 1.0.9)
63
- yard (>= 0.6.1)
59
+ windows-pr (>= 1.1.2)
60
+ yard (>= 0.6.2)
data/HISTORY.markdown CHANGED
@@ -6,6 +6,13 @@ Most recent changes are at the top
6
6
  Changes
7
7
  -------
8
8
 
9
+ ### 0.4.0 - 11/22/2010 ###
10
+
11
+ * Internal specs, features and all examples should run out-of-the-box on both Cygwin and MingW installs
12
+ * EnumerateDesktopWindows now accepts an optional timeout allowing the "find"
13
+ method to continue enumerating windows until the timeout is reached
14
+ * Added static logging constants to Autogui::Loggting
15
+
9
16
  ### 0.3.0 - 11/08/2010 ###
10
17
 
11
18
  * Added Log4R logging
@@ -14,7 +21,8 @@ Changes
14
21
  ### 0.2.1 - 11/05/2010 ###
15
22
 
16
23
  * Added missing "require 'timeout'", fixes issue #1
17
- * Replaced missing '@calculator' tag required to close down the calculator after running cucumber features
24
+ * Replaced missing '@calculator' tag required to close down the calculator
25
+ after running cucumber features
18
26
 
19
27
  ### 0.2.0 - 11/04/2010 ###
20
28
 
data/README.markdown CHANGED
@@ -13,14 +13,29 @@ and [Cucumber](http://github.com/aslakhellesoy/cucumber). Examples of
13
13
  using both these tools are provided with this gem.
14
14
 
15
15
 
16
- Quick Start
17
- -----------
18
- See [examples/skeleton/README.markdown](examples/skeleton/README.markdown) for
19
- a template of the file structure needed for jump-starting GUI testing with
20
- the Win32-autogui RubyGem.
16
+ Quick Start Options
17
+ -------------------
18
+ See [examples/skeleton/README.markdown](examples/skeleton/README.markdown)
19
+ for a template of the file structure needed for jump-starting GUI testing
20
+ with the Win32-autogui RubyGem.
21
21
 
22
22
  Read our introduction blog posting here: <http://www.gearheadforhire.com/articles/ruby/win32-autogui/using-ruby-to-drive-windows-applications>
23
23
 
24
+ Run Win32-autogui's internal specs and example programs.
25
+
26
+ gem install win32-autogui
27
+ gem install rake bundler win32console cucumber
28
+ gem install rspec -v 1.3.1
29
+
30
+ cd C:\Ruby187\lib\ruby\gems\1.8\gems\win32-autogui-0.4.0
31
+ bundle install
32
+
33
+ # run the calculator specs and features
34
+ rake
35
+
36
+ # run the example quicknote specs
37
+ cd examples\quicknote
38
+ rake
24
39
 
25
40
 
26
41
  Example Usage: Driving Calc.exe
@@ -184,7 +199,12 @@ focus with set_focus."
184
199
  System Requirements
185
200
  -------------------
186
201
 
187
- Windows OS, version 2000 or higher, testing was done via Cygwin <http://www.cygwin.com/>
202
+ Windows OS, version 2000 or higher
203
+
204
+ Testing was done on the following Ruby platforms:
205
+
206
+ * ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]
207
+ * ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
188
208
 
189
209
 
190
210
  Dependencies
@@ -224,6 +244,7 @@ Win32-autogui development was jump-started by cloning [BasicGem](http://github.c
224
244
  * Cucumber for functional testing <http://github.com/aslakhellesoy/cucumber>
225
245
  * Aruba for CLI testing <http://github.com/aslakhellesoy/aruba>
226
246
  * YARD for documentation generation <http://github.com/lsegal/yard>
247
+ * Kramdown for documentation markup processing <https://github.com/gettalong/kramdown>
227
248
 
228
249
  ### Rake tasks ###
229
250
 
data/Rakefile CHANGED
@@ -6,6 +6,16 @@
6
6
  require 'rubygems'
7
7
  require 'bundler/setup'
8
8
 
9
+ # TODO: remove this once issue corrected
10
+ # Bundler broken up to 1.0.7 on Windows
11
+ module Bundler
12
+ class GemHelper
13
+ def self.install_tasks(opts = nil)
14
+ dir = caller.find{|c| /Rakefile:/}[/^(.*?)\/Rakefile:/, 1]
15
+ self.new(dir, opts && opts[:name]).install
16
+ end
17
+ end
18
+ end
9
19
  Bundler::GemHelper.install_tasks
10
20
 
11
21
  def gemspec
@@ -41,8 +51,7 @@ namespace :doc do
41
51
  require 'yard/rake/yardoc_task'
42
52
 
43
53
  YARD::Rake::YardocTask.new(:generate) do |yt|
44
- yt.options = ['--markup-provider', 'rdiscount',
45
- '--output-dir', doc_destination
54
+ yt.options = ['--output-dir', doc_destination
46
55
  ] +
47
56
  gemspec.rdoc_options - ['--line-numbers', '--inline-source']
48
57
  end
@@ -51,5 +60,10 @@ namespace :doc do
51
60
  task :clean do
52
61
  rm_r doc_destination if File.exists?(doc_destination)
53
62
  end
63
+
64
+ desc "List undocumented objects"
65
+ task :undocumented do
66
+ system('yard stats --list-undoc')
67
+ end
54
68
 
55
69
  end
data/TODO.markdown CHANGED
@@ -7,4 +7,6 @@ general
7
7
  * (1.0) stop changing $LOAD_PATH in specs and features, modify ENV[] in before and afters
8
8
  * (1.0) implement Application.find and add option to not start application automatically, allows driving already running applications
9
9
  * (1.0) application class should be a mixin, not classical inheritance
10
- * (1.0) "rake release" broken on Windows, create patch to fix Bundler. For now, 'git tag v0.3.0 && rake build && gem push
10
+ * (1.0) "rake release" broken on Windows, create patch to fix Bundler. For now, 'git tag v0.3.0 && rake build && gem push pkg/win32-autogui-0.3.0.gem'
11
+ * (1.0) add an exception dialog watcher that accepts a block and scans for exception dialogs in a separate thread
12
+ * unicode support for window text
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -24,28 +24,28 @@ def status_bar
24
24
  main_window.children.find {|w| w.window_class == 'TStatusBar'}
25
25
  end
26
26
 
27
- def dialog_about
28
- Autogui::EnumerateDesktopWindows.new.find do |w|
29
- w.title.match(/About QuickNote/) && (w.pid == pid)
27
+ def dialog_about(options={})
28
+ Autogui::EnumerateDesktopWindows.new(options).find do |w|
29
+ w.title.match(/^About QuickNote/) && (w.pid == pid)
30
30
  end
31
31
  end
32
32
 
33
- def splash
34
- Autogui::EnumerateDesktopWindows.new.find do |w|
35
- w.title.match(/FormSplash/) && (w.pid == pid)
33
+ def splash(options={})
34
+ Autogui::EnumerateDesktopWindows.new(options).find do |w|
35
+ w.title.match(/^FormSplash/) && (w.pid == pid)
36
36
  end
37
37
  end
38
38
 
39
- def message_dialog_confirm
40
- Autogui::EnumerateDesktopWindows.new.find do |w|
41
- w.title.match(/Confirm/) && (w.pid == pid)
39
+ def message_dialog_confirm(options={})
40
+ Autogui::EnumerateDesktopWindows.new(options).find do |w|
41
+ w.title.match(/^Confirm/) && (w.pid == pid)
42
42
  end
43
43
  end
44
44
 
45
45
  # Title and class are the same as dialog_overwrite_confirm
46
46
  # Use child windows to differentiate
47
- def dialog_overwrite_confirm
48
- Autogui::EnumerateDesktopWindows.new.find do |w|
47
+ def dialog_overwrite_confirm(options={})
48
+ Autogui::EnumerateDesktopWindows.new(options).find do |w|
49
49
  w.title.match(/^Text File Save$/) &&
50
50
  (w.pid == pid) &&
51
51
  (w.window_class == "#32770") &&
@@ -54,23 +54,23 @@ def dialog_overwrite_confirm
54
54
  end
55
55
 
56
56
  # Title and class are the same as dialog_overwrite_confirm
57
- def file_save_as_dialog
58
- Autogui::EnumerateDesktopWindows.new.find do |w|
59
- w.title.match(/Text File Save/) &&
57
+ def file_save_as_dialog(options={})
58
+ Autogui::EnumerateDesktopWindows.new(options).find do |w|
59
+ w.title.match(/^Text File Save/) &&
60
60
  (w.pid == pid) &&
61
61
  (w.window_class == "#32770") &&
62
62
  (w.combined_text.match(/Save \&in:/))
63
63
  end
64
64
  end
65
65
 
66
- def file_open_dialog
67
- Autogui::EnumerateDesktopWindows.new.find do |w|
68
- w.title.match(/Text File Open/) && (w.pid == pid)
66
+ def file_open_dialog(options={})
67
+ Autogui::EnumerateDesktopWindows.new(options).find do |w|
68
+ w.title.match(/^Text File Open/) && (w.pid == pid)
69
69
  end
70
70
  end
71
71
 
72
- def error_dialog
73
- Autogui::EnumerateDesktopWindows.new.find do |w|
72
+ def error_dialog(options={})
73
+ Autogui::EnumerateDesktopWindows.new(options).find do |w|
74
74
  w.title.match(/^QuickNote$/) && (w.pid == pid) && (w.window_class == "#32770")
75
75
  end
76
76
  end
@@ -159,7 +159,7 @@
159
159
 
160
160
  it "should do nothing unless modified text" do
161
161
  append_to_file(@filename, "sneak in extra content that shouldn't be here")
162
- contents = get_file_content(@filename)
162
+ contents = get_file_contents(@filename)
163
163
  contents.should match(/extra content/)
164
164
  @application.file_save
165
165
  contents.should match(/extra content/)
@@ -177,7 +177,7 @@
177
177
  type_in("foobar")
178
178
  @application.edit_window.text.should == "foobar" + "original content"
179
179
  @application.file_save
180
- get_file_content(@filename).should == "foobar" + "original content"
180
+ get_file_contents(@filename).should == "foobar" + "original content"
181
181
  end
182
182
  end
183
183
 
@@ -249,9 +249,9 @@
249
249
  @application.main_window.title.downcase.should == "QuickNote - #{fullpath(@saveas_filename)}".downcase
250
250
  end
251
251
  it "should save the text" do
252
- get_file_content(@saveas_filename).should == ''
252
+ get_file_contents(@saveas_filename).should == ''
253
253
  @application.file_save_as(fullpath(@saveas_filename), :overwrite => true)
254
- get_file_content(@saveas_filename).should match(/original content/)
254
+ get_file_contents(@saveas_filename).should match(/original content/)
255
255
  end
256
256
  end
257
257
 
@@ -15,15 +15,22 @@
15
15
  require 'spec/autorun'
16
16
  require 'aruba/api'
17
17
 
18
- # aruba helper, returns full path to files in the aruba tmp folder
18
+ # aruba helpers
19
+ #
20
+ # @return full path to files in the aruba tmp folder
19
21
  def fullpath(filename)
20
22
  path = File.expand_path(File.join(current_dir, filename))
21
- path = `cygpath -w #{path}`.chomp if path.match(/^\/cygdrive/) # cygwin?
23
+ if path.match(/^\/cygdrive/)
24
+ # match /cygdrive/c/path/to and return c:\\path\\to
25
+ path = `cygpath -w #{path}`.chomp
26
+ elsif path.match(/.\:/)
27
+ # match c:/path/to and return c:\\path\\to
28
+ path = path.gsub(/\//, '\\')
29
+ end
22
30
  path
23
31
  end
24
-
25
- # return the contents of "filename" in the aruba tmp folder
26
- def get_file_content(filename)
32
+ # @return the contents of "filename" in the aruba tmp folder
33
+ def get_file_contents(filename)
27
34
  in_current_dir do
28
35
  IO.read(filename)
29
36
  end
@@ -0,0 +1,11 @@
1
+ History
2
+ =======
3
+ Most recent changes are at the top
4
+
5
+
6
+ Changes
7
+ -------
8
+
9
+ ### 0.1.0 - 11/04/2010 ###
10
+
11
+ * Initial release
@@ -1,23 +1,37 @@
1
1
  require 'myapp'
2
2
 
3
3
  include Autogui::Input
4
+ include Autogui::Logging
4
5
 
5
6
  After('@application') do
6
- if @application
7
- @application.close(:wait_for_close => true) if @application.running?
7
+ if @application && @application.running?
8
+ @application.dialog_tips.close if @application.dialog_tips
9
+ @application.dialog_wizard.close if @application.dialog_wizard
10
+ begin
11
+ @application.close(:wait_for_close => true) if @application.running?
12
+ rescue
13
+ @application.kill
14
+ raise
15
+ end
16
+ end
17
+ end
18
+
19
+ Given /^the application is running$/ do
20
+ unless @application && @application.running?
21
+ @application = Myapp.new
8
22
  @application.should be_running
9
23
  end
10
24
  end
11
25
 
12
- Before('@applicaton') do
13
- @application = Myapp.new
14
- @application.should_not be_running
26
+ When /^I start the application with parameters "([^"]*)"$/ do |parameters|
27
+ @application = Myapp.new :parameters => parameters
28
+ @application.should be_running
29
+ end
15
30
 
16
- # debug
17
- puts "application:"
18
- puts @application.inspect
19
- puts "application.combined_text"
20
- puts @application.combined_text
31
+ When /^I start the application$/ do
32
+ data_folder = cygpath_to_windows_path(File.expand_path(current_dir))
33
+ @application = Myapp.new :parameters => "--nosplash --data_folder:#{data_folder}"
34
+ @application.should be_running
21
35
  end
22
36
 
23
37
  When /^I type in "([^"]*)"$/ do |string|