rautomation 0.0.1 → 0.0.2

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.
@@ -0,0 +1,8 @@
1
+ === Version 0.0.2 / 2010-10-14
2
+
3
+ * using :value locator for buttons instead of :text
4
+ * searching only visible windows with some text on them
5
+
6
+ === Version 0.0.1 / 2010-10-13
7
+
8
+ * Initial release
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -6,9 +6,12 @@ module RAutomation
6
6
  include Locators
7
7
 
8
8
  # Special-cased locators
9
- LOCATORS = {:class_name => :classnn}
9
+ LOCATORS = {
10
+ :class_name => :classnn,
11
+ :value => :text
12
+ }
10
13
 
11
- # Possible locators are :text, :id, :class, :class_name and :instance.
14
+ # Possible locators are :value, :id, :class, :class_name and :instance.
12
15
  def initialize(window, locators)
13
16
  @window = window
14
17
  extract(locators)
@@ -36,9 +36,12 @@ module RAutomation
36
36
  extract(locators)
37
37
  end
38
38
 
39
+ # Returns handle of the found window.
40
+ # Searches only for visible windows with having some text at all.
39
41
  def hwnd #:nodoc:
40
42
  @hwnd ||= @@autoit.WinList(@locators, @locator_text).pop.compact.
41
- find {|handle| self.class.new(:hwnd => handle.hex).visible?}.hex rescue nil
43
+ find {|handle| w = self.class.new(:hwnd => handle.hex); w.visible? && !w.text.empty?}.
44
+ hex rescue nil
42
45
  end
43
46
 
44
47
  def title #:nodoc:
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rautomation}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jarmo Pertman"]
12
- s.date = %q{2010-10-13}
12
+ s.date = %q{2010-10-14}
13
13
  s.description = %q{RAutomation tries to be a small and easy to use library for helping out to automate windows and their controls
14
14
  for automated testing.
15
15
 
@@ -26,6 +26,7 @@ RAutomation aims to provide:
26
26
  s.files = [
27
27
  ".document",
28
28
  ".gitignore",
29
+ "History.rdoc",
29
30
  "LICENSE",
30
31
  "README.rdoc",
31
32
  "Rakefile",
@@ -3,30 +3,30 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe RAutomation::Button do
4
4
  it "#button" do
5
5
  RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title]).
6
- button(:text => SpecHelper::DATA[:window2_button_text]).should exist
7
- lambda {RAutomation::Window.new(:title => "non-existing-window").button(:text => "Something")}.
6
+ button(:value => SpecHelper::DATA[:window2_button_text]).should exist
7
+ lambda {RAutomation::Window.new(:title => "non-existing-window").button(:value => "Something")}.
8
8
  should raise_exception(RAutomation::UnknownWindowException)
9
9
  end
10
10
 
11
11
  it "#value" do
12
12
  RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title]).
13
- button(:text => SpecHelper::DATA[:window2_button_text]).value.should == SpecHelper::DATA[:window2_button_text]
14
- lambda {RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title]).button(:text => "non-existent-button").value}.
13
+ button(:value => SpecHelper::DATA[:window2_button_text]).value.should == SpecHelper::DATA[:window2_button_text]
14
+ lambda {RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title]).button(:value => "non-existent-button").value}.
15
15
  should raise_exception(RAutomation::UnknownButtonException)
16
16
  end
17
17
 
18
18
  it "#exists?" do
19
19
  window = RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title])
20
- window.button(:text => SpecHelper::DATA[:window2_button_text]).should exist
21
- window.button(:text => "non-existent-button").should_not exist
20
+ window.button(:value => SpecHelper::DATA[:window2_button_text]).should exist
21
+ window.button(:value => "non-existent-button").should_not exist
22
22
  end
23
23
 
24
24
  it "#click" do
25
25
  window = RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title])
26
- lambda{window.button(:text => "non-existent-button").click}.
26
+ lambda{window.button(:value => "non-existent-button").click}.
27
27
  should raise_exception(RAutomation::UnknownButtonException)
28
28
 
29
- button = window.button(:text => SpecHelper::DATA[:window2_button_text])
29
+ button = window.button(:value => SpecHelper::DATA[:window2_button_text])
30
30
  button.should exist
31
31
  button.click
32
32
  button.should_not exist
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rautomation
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jarmo Pertman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-13 00:00:00 +03:00
18
+ date: 2010-10-14 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -54,6 +54,7 @@ extra_rdoc_files:
54
54
  files:
55
55
  - .document
56
56
  - .gitignore
57
+ - History.rdoc
57
58
  - LICENSE
58
59
  - README.rdoc
59
60
  - Rakefile