commonwatir 3.0.0.rc3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/README +24 -0
  2. data/Rakefile +3 -14
  3. data/commonwatir.gemspec +18 -0
  4. data/lib/watir.rb +1 -14
  5. metadata +19 -131
  6. data/CHANGES +0 -712
  7. data/LICENSE +0 -34
  8. data/README.rdoc +0 -101
  9. data/VERSION +0 -1
  10. data/lib/watir/assertions.rb +0 -44
  11. data/lib/watir/browser.rb +0 -149
  12. data/lib/watir/browsers.rb +0 -13
  13. data/lib/watir/element_extensions.rb +0 -69
  14. data/lib/watir/exceptions.rb +0 -50
  15. data/lib/watir/matches.rb +0 -23
  16. data/lib/watir/options.rb +0 -56
  17. data/lib/watir/testcase.rb +0 -97
  18. data/lib/watir/util.rb +0 -35
  19. data/lib/watir/version.rb +0 -4
  20. data/lib/watir/wait.rb +0 -41
  21. data/lib/watir/wait_helper.rb +0 -12
  22. data/lib/watir/waiter.rb +0 -98
  23. data/unittests/attach_to_existing_window_test.rb +0 -70
  24. data/unittests/browser_test.rb +0 -38
  25. data/unittests/buttons_test.rb +0 -288
  26. data/unittests/dd_test.rb +0 -84
  27. data/unittests/dl_test.rb +0 -82
  28. data/unittests/dt_test.rb +0 -82
  29. data/unittests/element_collections_test.rb +0 -22
  30. data/unittests/element_test.rb +0 -24
  31. data/unittests/em_test.rb +0 -81
  32. data/unittests/form2_test.rb +0 -22
  33. data/unittests/html/blankpage.html +0 -11
  34. data/unittests/html/buttons1.html +0 -40
  35. data/unittests/html/buttons2.html +0 -60
  36. data/unittests/html/definition_lists.html +0 -48
  37. data/unittests/html/elements.html +0 -13
  38. data/unittests/html/emphasis.html +0 -12
  39. data/unittests/html/entertainment_com.html +0 -667
  40. data/unittests/html/frame_buttons.html +0 -4
  41. data/unittests/html/images/button.jpg +0 -0
  42. data/unittests/html/pass.html +0 -10
  43. data/unittests/html/phrase_elements.html +0 -15
  44. data/unittests/html/select_lists.html +0 -18
  45. data/unittests/html/utf8.html +0 -12
  46. data/unittests/html/visibility.html +0 -90
  47. data/unittests/html/wait.html +0 -15
  48. data/unittests/html/watir_unit_tests.css +0 -64
  49. data/unittests/html/whitespace.html +0 -29
  50. data/unittests/options.yml.example +0 -13
  51. data/unittests/select_list_test.rb +0 -19
  52. data/unittests/setup.rb +0 -17
  53. data/unittests/setup/browser.rb +0 -14
  54. data/unittests/setup/capture_io_helper.rb +0 -17
  55. data/unittests/setup/filter.rb +0 -24
  56. data/unittests/setup/lib.rb +0 -22
  57. data/unittests/setup/options.rb +0 -29
  58. data/unittests/setup/testUnitAddons.rb +0 -8
  59. data/unittests/setup/watir-unittest.rb +0 -78
  60. data/unittests/strong_test.rb +0 -46
  61. data/unittests/utf8_test.rb +0 -24
  62. data/unittests/visibility_test.rb +0 -47
  63. data/unittests/wait_test.rb +0 -126
  64. data/unittests/whitespace_test.rb +0 -46
data/LICENSE DELETED
@@ -1,34 +0,0 @@
1
- ---------------------------------------------------------------------------
2
- Copyright (c) 2004 - 2006, Paul Rogers
3
- Copyright (c) 2006 - 2007, Angrez Singh
4
- Copyright (c) 2004 - 2010, Bret Pettichord
5
- All rights reserved.
6
-
7
- Redistribution and use in source and binary forms, with or without
8
- modification, are permitted provided that the following conditions are met:
9
-
10
- 1. Redistributions of source code must retain the above copyright notice,
11
- this list of conditions and the following disclaimer.
12
-
13
- 2. Redistributions in binary form must reproduce the above copyright
14
- notice, this list of conditions and the following disclaimer in the
15
- documentation and/or other materials provided with the distribution.
16
-
17
- 3. Neither the names Paul Rogers, nor Bret Pettichord, nor Angrez Singh nor the names of any
18
- other contributors to this software may be used to endorse or promote
19
- products derived from this software without specific prior written
20
- permission.
21
-
22
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
23
- IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
26
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31
- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
- --------------------------------------------------------------------------
34
- (based on BSD Open Source License)
@@ -1,101 +0,0 @@
1
- = Watir
2
-
3
- Watir, pronounced water, is an open-source (BSD) family of Ruby libraries for automating web browsers. It supports your app no matter what technology it is developed in. They support Internet Explorer on Windows, Firefox and Chrome on Windows, Mac and Linux and Safari on Mac.
4
-
5
- Project Home:: http://watir.com
6
- Source Code:: http://github.com/bret/watir
7
- Support:: http://watir.com/support
8
- Gem:: https://rubygems.org/gems/watir
9
- Gem:: https://rubygems.org/gems/firewatir
10
- Gem:: https://rubygems.org/gems/commonwatir
11
- Gem:: https://rubygems.org/gems/safariwatir
12
- Gem:: https://rubygems.org/gems/watir-webdriver
13
- Gem:: https://rubygems.org/gems/celerity
14
-
15
- == Install
16
-
17
- You have to install Ruby and RubyGems first. To be able to drive Firefox you have to install Firefox add-on. Detailed installation instructions are at http://watir.com/installation
18
-
19
- === Windows
20
-
21
- To install Internet Explorer and Firefox driver:
22
-
23
- gem update --system
24
- gem install watir
25
-
26
- === Mac
27
-
28
- To install Firefox driver:
29
-
30
- sudo gem update --system
31
- sudo gem install firewatir
32
-
33
- To install Safari driver, you have to install Xcode first and then:
34
-
35
- sudo gem install rb-appscript
36
- sudo gem install safariwatir
37
-
38
- === Linux
39
-
40
- To install Firefox driver:
41
-
42
- sudo gem update --system
43
- sudo gem install firewatir
44
-
45
- == Examples
46
-
47
- Some examples from http://watir.com/examples
48
-
49
- Loading Watir gem to drive Internet Explorer on Windows
50
-
51
- require 'watir'
52
-
53
- Loading FireWatir gem to drive Firefox on Windows/Mac/Linux
54
-
55
- require 'firewatir'
56
-
57
- Starting a new browser & and going to our site
58
-
59
- browser = Watir::Browser.new
60
- browser.goto("http://bit.ly/watir-example")
61
-
62
- Setting a text field
63
-
64
- browser.text_field(:name => "entry.0.single").set "Watir"
65
-
66
- Setting a multi-line text box
67
-
68
- browser.text_field(:name => "entry.1.single").set "I come here from Australia. \n The weather is great here."
69
-
70
- Setting and clearing a radio button
71
-
72
- browser.radio(:value => "Watir").set
73
- browser.radio(:value => "Watir").clear
74
-
75
- Setting and clearing check boxes
76
-
77
- browser.checkbox(:value => "Ruby").set
78
- browser.checkbox(:value => "Python").set
79
- browser.checkbox(:value => "Python").clear
80
-
81
- Clicking a button
82
-
83
- browser.button(:name => "logon").click
84
-
85
- Clearing, getting and selecting selection list values
86
-
87
- browser.select_list(:name => "entry.6.single").clear
88
- puts browser.select_list(:name => "entry.6.single").options
89
- browser.select_list(:name => "entry.6.single").select "Chrome"
90
-
91
- Clicking a button
92
-
93
- browser.button(:name => "submit").click
94
-
95
- Checking for text in a page
96
-
97
- puts browser.text.include?("Your response has been recorded.")
98
-
99
- Checking the title of a page
100
-
101
- puts browser.title == "Thanks!"
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.0.0.rc3
@@ -1,44 +0,0 @@
1
- require 'test/unit/assertions'
2
-
3
- module Watir
4
- # Verification methods used by Watir::TestCase
5
- module Assertions
6
- include Test::Unit::Assertions
7
-
8
- # Log a failure if the boolean is true. The message is the failure
9
- # message logged.
10
- # Whether true or false, the assertion count is incremented.
11
- def verify boolean, message = 'verify failed.'
12
- add_assertion
13
- add_failure message.to_s, caller unless boolean
14
- end
15
-
16
- def verify_equal expected, actual, message=nil
17
- full_message = build_message(message, <<EOT, expected, actual)
18
- <?> expected but was
19
- <?>.
20
- EOT
21
- verify(expected == actual, full_message)
22
- end
23
- def verify_match pattern, string, message=nil
24
- pattern = case(pattern)
25
- when String
26
- Regexp.new(Regexp.escape(pattern))
27
- else
28
- pattern
29
- end
30
- full_message = build_message(message, "<?> expected to be =~\n<?>.", string, pattern)
31
- verify(string =~ pattern, full_message)
32
- end
33
-
34
- end
35
-
36
- end
37
- module Test::Unit::Assertions
38
- def assert_false(boolean, message=nil)
39
- _wrap_assertion do
40
- assert_block("assert should not be called with a block.") { !block_given? }
41
- assert_block(build_message(message, "<?> is not false.", boolean)) { !boolean }
42
- end
43
- end
44
- end
@@ -1,149 +0,0 @@
1
- # watir/browser
2
- require 'watir/options'
3
- module Watir
4
-
5
- =begin rdoc
6
-
7
- Watir is a family of open-source drivers for automating web browsers. You
8
- can use it to write tests that are easy to read and maintain.
9
-
10
- Watir drives browsers the same way people do. It clicks links, fills in forms,
11
- presses buttons. Watir also checks results, such as whether expected text
12
- appears on a page.
13
-
14
- The Watir family currently includes support for Internet Explorer (on Windows),
15
- Firefox (on Windows, Mac and Linux) and Safari (on Mac).
16
-
17
- Project Homepage: http://wtr.rubyforge.org
18
-
19
- This Browser module provides a generic interface
20
- that tests can use to access any browser. The actual browser (and thus
21
- the actual Watir driver) is determined at runtime based on configuration
22
- settings.
23
-
24
- require 'watir'
25
- browser = Watir::Browser.new
26
- browser.goto 'http://google.com'
27
- browser.text_field(:name, 'q').set 'pickaxe'
28
- browser.button(:name, 'btnG').click
29
- if browser.text.include? 'Programming Ruby'
30
- puts 'Text was found'
31
- else
32
- puts 'Text was not found'
33
- end
34
-
35
- A comprehensive summary of the Watir API can be found here
36
- http://wiki.openqa.org/display/WTR/Methods+supported+by+Element
37
-
38
- There are two ways to configure the browser that will be used by your tests.
39
-
40
- One is to set the +watir_browser+ environment variable to +ie+ or +firefox+.
41
- (How you do this depends on your platform.)
42
-
43
- The other is to create a file that looks like this.
44
-
45
- browser: ie
46
-
47
- And then to add this line to your script, after the require statement and
48
- before you invoke Browser.new.
49
-
50
- Watir.options_file = 'path/to/the/file/you/just/created'
51
-
52
- =end rdoc
53
-
54
- module Browser
55
- @@browser_classes = {}
56
- @@sub_options = {}
57
- @@default = nil
58
- class << self
59
-
60
- # Create a new instance of a browser driver, as determined by the
61
- # configuration settings. (Don't be fooled: this is not actually
62
- # an instance of Browser class.)
63
- def new
64
- set_sub_options
65
- klass.new
66
- end
67
- # Create a new instance as with #new and start the browser on the
68
- # specified url.
69
- def start url
70
- set_sub_options
71
- klass.start url
72
- end
73
- # Attach to an existing browser.
74
- def attach(how, what)
75
- set_sub_options
76
- klass.attach(how, what)
77
- end
78
- def set_options options
79
- return unless klass.respond_to?(:set_options)
80
- klass.set_options options
81
- end
82
- def options
83
- return {} unless klass.respond_to?(:options)
84
- klass.options
85
- end
86
-
87
- def klass
88
- key = Watir.options[:browser]
89
- eval @@browser_classes[key] # this triggers the autoload
90
- end
91
- private :klass
92
- # Add support for the browser option, using the specified class,
93
- # provided as a string. Optionally, additional options supported by
94
- # the class can be specified as an array of symbols. Options specified
95
- # by the user and included in this list will be passed (as a hash) to
96
- # the set_options class method (if defined) before creating an instance.
97
- def support hash_args
98
- option = hash_args[:name]
99
- class_string = hash_args[:class]
100
- additional_options = hash_args[:options]
101
- library = hash_args[:library]
102
- gem = hash_args[:gem] || library
103
-
104
- @@browser_classes[option] = class_string
105
- @@sub_options[option] = additional_options
106
-
107
- autoload class_string, library
108
- activate_gem gem, option
109
- end
110
-
111
- def default
112
- @@default
113
- end
114
- # Specifies a default browser. Must be specified before options are parsed.
115
- def default= option
116
- @@default = option
117
- end
118
- # Returns the names of the browsers that are supported by this module.
119
- # These are the options for 'watir_browser' (env var) or 'browser:' (yaml).
120
- def browser_names
121
- @@browser_classes.keys
122
- end
123
-
124
- private
125
- def autoload class_string, library
126
- mod, klass = class_string.split('::')
127
- eval "module ::#{mod}; autoload :#{klass}, '#{library}'; end"
128
- end
129
- # Activate the gem (if installed). The default browser will be set
130
- # to the first gem that activates.
131
- def activate_gem gem_name, option
132
- begin
133
- gem gem_name
134
- @@default ||= option
135
- rescue Gem::LoadError
136
- end
137
- end
138
- def set_sub_options
139
- sub_options = @@sub_options[Watir.options[:browser]]
140
- return if sub_options.nil?
141
- specified_options = Watir.options.reject {|k, v| !sub_options.include? k}
142
- self.set_options specified_options
143
- end
144
- end
145
- end
146
-
147
- end
148
-
149
- require 'watir/browsers'
@@ -1,13 +0,0 @@
1
- #--
2
- # watir/browsers
3
- # Define browsers supported by Watir
4
-
5
- Watir::Browser.support :name => 'ie', :class => 'Watir::IE',
6
- :library => 'watir/ie', :gem => 'watir',
7
- :options => [:speed, :visible, :zero_based_indexing]
8
-
9
- Watir::Browser.support :name => 'firefox', :class => 'FireWatir::Firefox',
10
- :library => 'firewatir'
11
-
12
- Watir::Browser.support :name => 'safari', :class => 'Watir::Safari',
13
- :library => 'safariwatir'
@@ -1,69 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Watir
4
- # This assumes that Element#visible? is defined
5
- module ElementExtensions
6
-
7
- #
8
- # Wraps a {Celerity,Watir}::Element so that any subsequent method calls are
9
- # put on hold until the element is present on the page.
10
- #
11
-
12
- class WhenPresentDecorator
13
- def initialize(element, timeout)
14
- @element = element
15
- @timeout = timeout
16
- end
17
-
18
- def method_missing(m, *args, &block)
19
- Watir::Wait.until(@timeout) { @element.present? }
20
- @element.send(m, *args, &block)
21
- end
22
-
23
- # Returns element id
24
- def id
25
- Watir::Wait.until(@timeout) { @element.present? }
26
- @element.id
27
- end
28
-
29
- end
30
-
31
- #
32
- # Returns true if the element exists and is visible on the page
33
- #
34
-
35
- def present?
36
- exists? && visible? rescue false
37
- end
38
-
39
- #
40
- # Waits until the element is present.
41
- #
42
- # Optional argument:
43
- #
44
- # timeout - seconds to wait before timing out (default: 60)
45
- #
46
- # browser.button(:id, 'foo').when_present.click
47
- # browser.div(:id, 'bar').when_present { |div| ... }
48
- # browser.p(:id, 'baz').when_present(60).text
49
- #
50
-
51
- def when_present(timeout = 60)
52
- if block_given?
53
- Watir::Wait.until(timeout) { self.present? }
54
- yield self
55
- else
56
- return WhenPresentDecorator.new(self, timeout)
57
- end
58
- end
59
-
60
- def wait_until_present(timeout = 60)
61
- Watir::Wait.until(timeout) { self.present? }
62
- end
63
-
64
- def wait_while_present(timeout = 60)
65
- Watir::Wait.while(timeout) { self.present? }
66
- end
67
-
68
- end # module ElementExtensions
69
- end
@@ -1,50 +0,0 @@
1
- module Watir
2
- module Exception
3
-
4
- # Root class for all Watir Exceptions
5
- class WatirException < RuntimeError
6
- def initialize(message="")
7
- super(message)
8
- end
9
- end
10
-
11
- # This exception is raised if an attempt is made to access an object that doesn't exist
12
- class UnknownObjectException < WatirException; end
13
- # This exception is raised if an attempt is made to access an object that is in a disabled state
14
- class ObjectDisabledException < WatirException; end
15
- # This exception is raised if an attempt is made to access a frame that cannot be found
16
- class UnknownFrameException < WatirException; end
17
- # This exception is raised if an attempt is made to access a frame that IE is denying access to
18
- class FrameAccessDeniedException < WatirException; end
19
- # This exception is raised if an attempt is made to access a form that cannot be found
20
- class UnknownFormException< WatirException; end
21
- # This exception is raised if an attempt is made to access an object that is in a read only state
22
- class ObjectReadOnlyException < WatirException; end
23
- # This exception is raised if an attempt is made to access an object when the specified value cannot be found
24
- class NoValueFoundException < WatirException; end
25
- # This exception gets raised if part of finding an object is missing
26
- class MissingWayOfFindingObjectException < WatirException; end
27
- # this exception is raised if an attempt is made to access a table cell that doesnt exist
28
- class UnknownCellException < WatirException; end
29
- # This exception is raised if the window cannot be found
30
- class NoMatchingWindowFoundException < WatirException; end
31
- # This exception is raised if an attemp is made to acces the status bar of the browser when it doesnt exist
32
- class NoStatusBarException < WatirException; end
33
- # This exception is raised if an http error, such as a 404, 500 etc is encountered while navigating
34
- class NavigationException < WatirException; end
35
- # This exception is raised when an event is fired that we don't know how to handle
36
- class UnhandledEventException < WatirException; end
37
- # This exception is raised if a timeout is exceeded
38
- class TimeOutException < WatirException
39
- def initialize(duration, timeout)
40
- @duration, @timeout = duration, timeout
41
- end
42
- attr_reader :duration, :timeout
43
- end
44
-
45
- # Return an error message for when unable to locate the element
46
- def self.message_for_unable_to_locate(specifiers)
47
- "Unable to locate element, using #{specifiers.inspect}"
48
- end
49
- end
50
- end