commonwatir 1.6.5 → 1.6.6.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +461 -0
- data/{README.txt → LICENSE} +22 -48
- data/Rakefile +13 -11
- data/VERSION +1 -0
- data/lib/commonwatir.rb +3 -3
- data/lib/watir.rb +7 -6
- data/lib/watir/assertions.rb +44 -44
- data/lib/watir/browser.rb +149 -149
- data/lib/watir/browsers.rb +13 -12
- data/lib/watir/exceptions.rb +47 -47
- data/lib/watir/matches.rb +17 -17
- data/lib/watir/options.rb +53 -52
- data/lib/watir/testcase.rb +97 -58
- data/lib/watir/waiter.rb +91 -91
- data/unittests/attach_to_existing_window_test.rb +71 -0
- data/unittests/browser_test.rb +18 -0
- data/unittests/buttons_test.rb +224 -0
- data/unittests/dd_test.rb +70 -0
- data/unittests/dl_test.rb +68 -0
- data/unittests/dt_test.rb +68 -0
- data/unittests/element_collections_test.rb +22 -0
- data/unittests/em_test.rb +67 -0
- data/unittests/form2_test.rb +22 -0
- data/unittests/html/blankpage.html +12 -0
- data/unittests/html/buttons1.html +41 -0
- data/unittests/html/buttons2.html +61 -0
- data/unittests/html/definition_lists.html +48 -0
- data/unittests/html/emphasis.html +12 -0
- data/unittests/html/entertainment_com.html +668 -0
- data/unittests/html/frame_buttons.html +4 -0
- data/unittests/html/images/button.jpg +0 -0
- data/unittests/html/pass.html +10 -0
- data/unittests/html/phrase_elements.html +15 -0
- data/unittests/html/select_lists.html +18 -0
- data/unittests/html/utf8.html +12 -0
- data/unittests/html/visibility.html +90 -0
- data/unittests/html/watir_unit_tests.css +64 -0
- data/unittests/html/whitespace.html +29 -0
- data/unittests/inspect_test.rb +29 -0
- data/unittests/options.yml.example +13 -0
- data/unittests/select_list_test.rb +19 -0
- data/unittests/setup.rb +17 -0
- data/unittests/setup/browser.rb +14 -0
- data/unittests/setup/capture_io_helper.rb +17 -0
- data/unittests/setup/filter.rb +24 -0
- data/unittests/setup/lib.rb +22 -0
- data/unittests/setup/options.rb +29 -0
- data/unittests/setup/testUnitAddons.rb +8 -0
- data/unittests/setup/watir-unittest.rb +74 -0
- data/unittests/strong_test.rb +32 -0
- data/unittests/utf8_test.rb +24 -0
- data/unittests/visibility_test.rb +47 -0
- data/unittests/whitespace_test.rb +40 -0
- metadata +121 -39
- data/History.txt +0 -5
- data/Manifest.txt +0 -14
@@ -0,0 +1,8 @@
|
|
1
|
+
module Test::Unit::Assertions
|
2
|
+
def assert_false(boolean, message=nil)
|
3
|
+
_wrap_assertion do
|
4
|
+
assert_block("assert should not be called with a block.") { !block_given? }
|
5
|
+
assert_block(build_message(message, "<?> is not false.", boolean)) { !boolean }
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end # module test
|
@@ -0,0 +1,74 @@
|
|
1
|
+
$htmlRoot = "file:///#{$myDir}/html/"
|
2
|
+
|
3
|
+
module Watir::UnitTest
|
4
|
+
# navigate the browser to the specified page in unittests/html
|
5
|
+
def goto_page page
|
6
|
+
new_url = self.class.html_root + page
|
7
|
+
browser.goto new_url
|
8
|
+
end
|
9
|
+
# navigate the browser to the specified page in unittests/html IF the browser is not already on that page.
|
10
|
+
def uses_page page # only works with IE
|
11
|
+
new_url = self.class.html_root + page
|
12
|
+
browser.goto new_url unless browser.url == new_url
|
13
|
+
end
|
14
|
+
def browser
|
15
|
+
$browser
|
16
|
+
end
|
17
|
+
|
18
|
+
def assert_class element, klass
|
19
|
+
assert_match(Regexp.new(klass, Regexp::IGNORECASE), element.class.to_s, "element class should be #{klass}; got #{element.class}")
|
20
|
+
end
|
21
|
+
|
22
|
+
@@filter = []
|
23
|
+
class << self
|
24
|
+
def filter
|
25
|
+
@@filter
|
26
|
+
end
|
27
|
+
def filter= proc
|
28
|
+
@@filter = proc
|
29
|
+
end
|
30
|
+
# Add a filter that excludes tests matching the provided block
|
31
|
+
def filter_out &block
|
32
|
+
@@filter << Proc.new do |test|
|
33
|
+
block.call(test) ? false : nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
def filter_out_tests_tagged tag
|
37
|
+
filter_out do |test|
|
38
|
+
test.tagged? tag
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class Test::Unit::TestCase
|
45
|
+
include Watir::UnitTest
|
46
|
+
include Watir::Exception
|
47
|
+
|
48
|
+
class << self
|
49
|
+
def tags *names
|
50
|
+
@tags ||= []
|
51
|
+
@tags += names
|
52
|
+
end
|
53
|
+
def tag_method method_name, *tags
|
54
|
+
self.method_tags[method_name.to_s] = tags
|
55
|
+
end
|
56
|
+
def method_tags
|
57
|
+
@method_tags ||= Hash.new []
|
58
|
+
end
|
59
|
+
def html_root
|
60
|
+
return "file:///#{File.expand_path @html_dir}/" if @html_dir
|
61
|
+
$htmlRoot
|
62
|
+
end
|
63
|
+
def location path
|
64
|
+
@html_dir = File.join File.dirname(path), 'html'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def tagged? tag
|
69
|
+
self.class.tags.include?(tag) ||
|
70
|
+
self.class.method_tags[@method_name].include?(tag)
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
2
|
+
require 'unittests/setup'
|
3
|
+
|
4
|
+
class TC_Strong < Test::Unit::TestCase
|
5
|
+
include Watir::Exception
|
6
|
+
location __FILE__
|
7
|
+
|
8
|
+
def setup
|
9
|
+
uses_page "phrase_elements.html"
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_exists
|
13
|
+
assert browser.strong(:id, "strong_id").exists?, "Could not find <strong> by :id"
|
14
|
+
assert browser.strong(:class, "strong_class").exists?, "Could not find <strong> by :class"
|
15
|
+
assert browser.strong(:xpath, "//strong[@id='strong_id']").exists?, "Could not find <strong> by :xpath"
|
16
|
+
assert browser.strong(:index, 1).exists?, "Could not find <strong> by :index"
|
17
|
+
assert browser.strong(:text, /this is a/).exists?, "Could not finr <strong> by :text"
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_strong_iterator
|
21
|
+
assert_equal(2, browser.strongs.length)
|
22
|
+
assert_equal("this is a strong", browser.strongs[1].text)
|
23
|
+
|
24
|
+
browser.strongs.each_with_index do |strong, idx|
|
25
|
+
assert_equal(browser.strong(:index,idx+1).text, strong.text)
|
26
|
+
assert_equal(browser.strong(:index,idx+1).id, strong.id)
|
27
|
+
assert_equal(browser.strong(:index,idx+1).class_name , strong.class_name)
|
28
|
+
assert_equal(browser.strong(:index,idx+1).title, strong.title)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
+
require 'unittests/setup'
|
5
|
+
|
6
|
+
class TC_Utf8 < Test::Unit::TestCase
|
7
|
+
location __FILE__
|
8
|
+
|
9
|
+
def setup
|
10
|
+
uses_page "utf8.html"
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_is_correct_encoding
|
14
|
+
txt = browser.div(:id, 'utf8_string').text
|
15
|
+
if RUBY_VERSION =~ /^1\.8/
|
16
|
+
assert_equal("\303\246\303\270\303\245", txt)
|
17
|
+
else
|
18
|
+
assert(txt.force_encoding("UTF-8").valid_encoding?, "#{txt.inspect} is not valid UTF-8")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# feature tests for Visibility
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
+
require 'unittests/setup'
|
5
|
+
|
6
|
+
class TC_Visibility < Test::Unit::TestCase
|
7
|
+
location __FILE__
|
8
|
+
|
9
|
+
def setup
|
10
|
+
uses_page "visibility.html"
|
11
|
+
end
|
12
|
+
|
13
|
+
# will check for divs which are visible on the screen (not inline style)
|
14
|
+
def test_initial_divs
|
15
|
+
assert_equal(true, browser.div(:id, "div1").visible?)
|
16
|
+
assert_equal(false, browser.div(:id, "div2").visible?)
|
17
|
+
assert_equal(false, browser.div(:id, "div3").visible?)
|
18
|
+
end
|
19
|
+
|
20
|
+
# will check for textfields which are visible on the screen (not inline style)
|
21
|
+
# if any textfields style displays true, it checks if all the parents are true else displays false
|
22
|
+
def test_initial_text_fields
|
23
|
+
assert_equal(true, browser.text_field(:id, "lgnId1").visible?)
|
24
|
+
assert_equal(false, browser.text_field(:id, "lgnId2").visible?)
|
25
|
+
assert_equal(false, browser.text_field(:id, "lgnId3").visible?)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Check if the second div becomes visible (inline visibility test)
|
29
|
+
def test_make_visible_second_div
|
30
|
+
browser.link(:id, "div2vis").click
|
31
|
+
#wait_until { browser.div(:id, "div2").visible? }
|
32
|
+
assert_equal(true, browser.div(:id, "div2").visible? )
|
33
|
+
assert_equal(true, browser.text_field(:id, "lgnId2").visible? )
|
34
|
+
end
|
35
|
+
|
36
|
+
# Check if the second div becomes visible (inline Display block test)
|
37
|
+
def test_make_display_third_div
|
38
|
+
browser.link(:id, "div3blk").click
|
39
|
+
#wait_until { browser.div(:id, "div3").visible? }
|
40
|
+
assert_equal(true, browser.div(:id, "div3").visible? )
|
41
|
+
assert_equal(true, browser.text_field(:id, "lgnId3").visible? )
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_hidden_element
|
45
|
+
assert_equal(false, browser.hidden(:id, 'hidden-type').visible? )
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# feature tests for white space
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
+
require 'unittests/setup'
|
5
|
+
|
6
|
+
class TC_WhiteSpace < Test::Unit::TestCase
|
7
|
+
location __FILE__
|
8
|
+
|
9
|
+
def setup
|
10
|
+
uses_page "whitespace.html"
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_text_with_nbsp
|
14
|
+
assert_equal 'Login', browser.link(:index => 1).text
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_nbsp_beginning_and_end
|
18
|
+
assert browser.link(:text, 'Login').exists?
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_single_nbsp
|
22
|
+
assert_equal "Test for nbsp.", browser.span(:id, 'single_nbsp').text
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_multiple_spaces
|
26
|
+
assert_equal "Test for multiple spaces.", browser.span(:id, 'multiple_spaces').text
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_multiple_spaces_access
|
30
|
+
assert_equal 'multiple_spaces', browser.span(:text, "Test for multiple spaces.").id
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_space_tab
|
34
|
+
assert_equal "Test for space and tab.", browser.span(:id, 'space_tab').text
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_space_w_cr
|
38
|
+
assert_equal "Test for space and cr.", browser.span(:id, 'space_w_cr').text
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commonwatir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 977940598
|
5
|
+
prerelease: true
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 6
|
9
|
+
- 6
|
10
|
+
- rc1
|
11
|
+
version: 1.6.6.rc1
|
5
12
|
platform: ruby
|
6
13
|
authors:
|
7
14
|
- Bret Pettichord
|
@@ -9,46 +16,32 @@ autorequire:
|
|
9
16
|
bindir: bin
|
10
17
|
cert_chain: []
|
11
18
|
|
12
|
-
date:
|
19
|
+
date: 2010-09-24 00:00:00 -06:00
|
13
20
|
default_executable:
|
14
21
|
dependencies:
|
15
22
|
- !ruby/object:Gem::Dependency
|
16
23
|
name: user-choices
|
17
|
-
|
18
|
-
|
19
|
-
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
20
27
|
requirements:
|
21
28
|
- - ">="
|
22
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
23
33
|
version: "0"
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
version_requirement:
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 2.3.3
|
34
|
-
version:
|
35
|
-
description: Common code used by Watir and FireWatir
|
36
|
-
email:
|
37
|
-
- bret@pettichord.com
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
description: Common library for Watir and FireWatir
|
37
|
+
email: bret@pettichord.com
|
38
38
|
executables: []
|
39
39
|
|
40
40
|
extensions: []
|
41
41
|
|
42
|
-
extra_rdoc_files:
|
43
|
-
|
44
|
-
- Manifest.txt
|
45
|
-
- README.txt
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
46
44
|
files:
|
47
|
-
- History.txt
|
48
|
-
- Manifest.txt
|
49
|
-
- README.txt
|
50
|
-
- Rakefile
|
51
|
-
- lib/watir.rb
|
52
45
|
- lib/commonwatir.rb
|
53
46
|
- lib/watir/assertions.rb
|
54
47
|
- lib/watir/browser.rb
|
@@ -58,34 +51,123 @@ files:
|
|
58
51
|
- lib/watir/options.rb
|
59
52
|
- lib/watir/testcase.rb
|
60
53
|
- lib/watir/waiter.rb
|
54
|
+
- lib/watir.rb
|
55
|
+
- Rakefile
|
56
|
+
- LICENSE
|
57
|
+
- CHANGES
|
58
|
+
- VERSION
|
59
|
+
- unittests/attach_to_existing_window_test.rb
|
60
|
+
- unittests/browser_test.rb
|
61
|
+
- unittests/buttons_test.rb
|
62
|
+
- unittests/dd_test.rb
|
63
|
+
- unittests/dl_test.rb
|
64
|
+
- unittests/dt_test.rb
|
65
|
+
- unittests/element_collections_test.rb
|
66
|
+
- unittests/em_test.rb
|
67
|
+
- unittests/form2_test.rb
|
68
|
+
- unittests/html/blankpage.html
|
69
|
+
- unittests/html/buttons1.html
|
70
|
+
- unittests/html/buttons2.html
|
71
|
+
- unittests/html/definition_lists.html
|
72
|
+
- unittests/html/emphasis.html
|
73
|
+
- unittests/html/entertainment_com.html
|
74
|
+
- unittests/html/frame_buttons.html
|
75
|
+
- unittests/html/images/button.jpg
|
76
|
+
- unittests/html/pass.html
|
77
|
+
- unittests/html/phrase_elements.html
|
78
|
+
- unittests/html/select_lists.html
|
79
|
+
- unittests/html/utf8.html
|
80
|
+
- unittests/html/visibility.html
|
81
|
+
- unittests/html/watir_unit_tests.css
|
82
|
+
- unittests/html/whitespace.html
|
83
|
+
- unittests/inspect_test.rb
|
84
|
+
- unittests/options.yml.example
|
85
|
+
- unittests/select_list_test.rb
|
86
|
+
- unittests/setup/browser.rb
|
87
|
+
- unittests/setup/capture_io_helper.rb
|
88
|
+
- unittests/setup/filter.rb
|
89
|
+
- unittests/setup/lib.rb
|
90
|
+
- unittests/setup/options.rb
|
91
|
+
- unittests/setup/testUnitAddons.rb
|
92
|
+
- unittests/setup/watir-unittest.rb
|
93
|
+
- unittests/setup.rb
|
94
|
+
- unittests/strong_test.rb
|
95
|
+
- unittests/utf8_test.rb
|
96
|
+
- unittests/visibility_test.rb
|
97
|
+
- unittests/whitespace_test.rb
|
61
98
|
has_rdoc: true
|
62
99
|
homepage: http://www.watir.com
|
63
100
|
licenses: []
|
64
101
|
|
65
102
|
post_install_message:
|
66
|
-
rdoc_options:
|
67
|
-
|
68
|
-
- README.txt
|
103
|
+
rdoc_options: []
|
104
|
+
|
69
105
|
require_paths:
|
70
106
|
- lib
|
71
107
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
72
109
|
requirements:
|
73
110
|
- - ">="
|
74
111
|
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
75
115
|
version: "0"
|
76
|
-
version:
|
77
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
78
118
|
requirements:
|
79
|
-
- - "
|
119
|
+
- - ">"
|
80
120
|
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
|
121
|
+
hash: 25
|
122
|
+
segments:
|
123
|
+
- 1
|
124
|
+
- 3
|
125
|
+
- 1
|
126
|
+
version: 1.3.1
|
83
127
|
requirements: []
|
84
128
|
|
85
129
|
rubyforge_project: wtr
|
86
|
-
rubygems_version: 1.3.
|
130
|
+
rubygems_version: 1.3.7
|
87
131
|
signing_key:
|
88
132
|
specification_version: 3
|
89
|
-
summary: Common
|
90
|
-
test_files:
|
91
|
-
|
133
|
+
summary: Common library for Watir and FireWatir
|
134
|
+
test_files:
|
135
|
+
- unittests/attach_to_existing_window_test.rb
|
136
|
+
- unittests/browser_test.rb
|
137
|
+
- unittests/buttons_test.rb
|
138
|
+
- unittests/dd_test.rb
|
139
|
+
- unittests/dl_test.rb
|
140
|
+
- unittests/dt_test.rb
|
141
|
+
- unittests/element_collections_test.rb
|
142
|
+
- unittests/em_test.rb
|
143
|
+
- unittests/form2_test.rb
|
144
|
+
- unittests/html/blankpage.html
|
145
|
+
- unittests/html/buttons1.html
|
146
|
+
- unittests/html/buttons2.html
|
147
|
+
- unittests/html/definition_lists.html
|
148
|
+
- unittests/html/emphasis.html
|
149
|
+
- unittests/html/entertainment_com.html
|
150
|
+
- unittests/html/frame_buttons.html
|
151
|
+
- unittests/html/images/button.jpg
|
152
|
+
- unittests/html/pass.html
|
153
|
+
- unittests/html/phrase_elements.html
|
154
|
+
- unittests/html/select_lists.html
|
155
|
+
- unittests/html/utf8.html
|
156
|
+
- unittests/html/visibility.html
|
157
|
+
- unittests/html/watir_unit_tests.css
|
158
|
+
- unittests/html/whitespace.html
|
159
|
+
- unittests/inspect_test.rb
|
160
|
+
- unittests/options.yml.example
|
161
|
+
- unittests/select_list_test.rb
|
162
|
+
- unittests/setup/browser.rb
|
163
|
+
- unittests/setup/capture_io_helper.rb
|
164
|
+
- unittests/setup/filter.rb
|
165
|
+
- unittests/setup/lib.rb
|
166
|
+
- unittests/setup/options.rb
|
167
|
+
- unittests/setup/testUnitAddons.rb
|
168
|
+
- unittests/setup/watir-unittest.rb
|
169
|
+
- unittests/setup.rb
|
170
|
+
- unittests/strong_test.rb
|
171
|
+
- unittests/utf8_test.rb
|
172
|
+
- unittests/visibility_test.rb
|
173
|
+
- unittests/whitespace_test.rb
|