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
Binary file
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Phrase elements</title>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
6
|
+
</head>
|
7
|
+
|
8
|
+
|
9
|
+
<body>
|
10
|
+
<!-- Add more phrase elements as needed -->
|
11
|
+
<strong id="strong_id" class="strong_class">this is a strong</strong>
|
12
|
+
<strong id="other_strong_id" class="other_strong_class">this is another strong</strong>
|
13
|
+
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
2
|
+
"http://www.w3.org/TR/html4/strict.dtd">
|
3
|
+
<html lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
6
|
+
<title>Select boxes</title>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
<select name="year" id="year">
|
11
|
+
<option value="2009">2009</option>
|
12
|
+
<option value="2010">2010</option>
|
13
|
+
<option value="2011">2011</option>
|
14
|
+
<option value="2012">2012</option>
|
15
|
+
<option value="2013">2013</option>
|
16
|
+
</select>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
2
|
+
"http://www.w3.org/TR/html4/strict.dtd">
|
3
|
+
<html lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
6
|
+
<title>UTF8</title>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
<div id="utf8_string">æøå</div>
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1,90 @@
|
|
1
|
+
<html>
|
2
|
+
<title>Visibility test - Using CSS with and without inline style</title>
|
3
|
+
<head>
|
4
|
+
<style type='text/css'>
|
5
|
+
.stylinvi {
|
6
|
+
visibility: hidden;
|
7
|
+
}
|
8
|
+
.stylblock {
|
9
|
+
display: none
|
10
|
+
}
|
11
|
+
</style>
|
12
|
+
<script type="text/javascript" language="JavaScript">
|
13
|
+
<!--
|
14
|
+
function visi(nr)
|
15
|
+
{
|
16
|
+
t1 = document.getElementById(nr);
|
17
|
+
if (document.getElementById)
|
18
|
+
{
|
19
|
+
if (t1.currentStyle)
|
20
|
+
{
|
21
|
+
vista = (t1.currentStyle.visibility == 'hidden') ? 'visible' : 'hidden';
|
22
|
+
t1.style.visibility = vista;
|
23
|
+
} else if (document.defaultView)
|
24
|
+
{
|
25
|
+
vista = (document.defaultView.getComputedStyle(t1,null).visibility == 'hidden') ? 'visible' : 'hidden';
|
26
|
+
t1.style.visibility = vista;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
function blocking(nr)
|
32
|
+
{
|
33
|
+
t1 = document.getElementById(nr);
|
34
|
+
if (document.getElementById)
|
35
|
+
{
|
36
|
+
if (t1.currentStyle)
|
37
|
+
{
|
38
|
+
vista = (t1.currentStyle.display == 'none') ? 'block' : 'none';
|
39
|
+
t1.style.display = vista;
|
40
|
+
} else if (document.defaultView)
|
41
|
+
{
|
42
|
+
vista = (document.defaultView.getComputedStyle(t1,null).display == 'none') ? 'block' : 'none';
|
43
|
+
t1.style.display = vista;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
-->
|
48
|
+
</script>
|
49
|
+
</head>
|
50
|
+
<body>
|
51
|
+
|
52
|
+
<ol>
|
53
|
+
<li>DIV 1:
|
54
|
+
<ul>
|
55
|
+
<li class=""><a id="div1vis" onclick="visi('div1'); return false" href="#" class="page">Toggle visible/invisible</a>
|
56
|
+
</li><li class="odd"><a id="div1blk" onclick="blocking('div1'); return false;" href="#" class="page">Toggle display block/none</a>
|
57
|
+
</li></ul>
|
58
|
+
</li><li>DIV 2:
|
59
|
+
<ul>
|
60
|
+
<li class=""><a id="div2vis" onclick="visi('div2'); return false" href="#" class="page">Toggle visible/invisible</a>
|
61
|
+
</li>
|
62
|
+
</ul>
|
63
|
+
</li><li>DIV 3:
|
64
|
+
<ul>
|
65
|
+
<li class="odd"><a id="div3blk" onclick="blocking('div3'); return false;" href="#" class="page">Toggle display block/none</a> </li>
|
66
|
+
</ul>
|
67
|
+
</li></ol>
|
68
|
+
|
69
|
+
<div id="div1">
|
70
|
+
<label id="lgnId1lbl1" for="lgnId1">Name 1</label>
|
71
|
+
<input type="text" id="lgnId1" value="" size="25" maxlength="97" name="loginId1"/>
|
72
|
+
<input type="submit" title="Click1" alt="Sign In" tabindex="3" value="Click1" id="submitAol1"/>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<div id="div2" class="stylinvi">
|
76
|
+
<label id="lgnId1lbl2" for="lgnId2">Name 2</label>
|
77
|
+
<input type="text" id="lgnId2" value="" size="25" maxlength="97" name="loginId2"/>
|
78
|
+
<input type="submit" title="Click2" alt="Sign In" tabindex="3" value="Click2" id="submitAol2"/>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<div id="div3" class="stylblock">
|
82
|
+
<label id="lgnId1lbl3" for="lgnId3">Name 3</label>
|
83
|
+
<input type="text" id="lgnId3" value="" size="25" maxlength="97" name="loginId3"/>
|
84
|
+
<input type="submit" title="Click3" alt="Sign In" value="Click3" id="submitAol3"/>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<input type="hidden" id="hidden-type">
|
88
|
+
|
89
|
+
</body>
|
90
|
+
</html>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
DIV {font-size: 24pt;}
|
2
|
+
.redText {color: red;}
|
3
|
+
.blueText {color: blue;}
|
4
|
+
.italicText {font-style: italic;}
|
5
|
+
|
6
|
+
SPAN {font-size: 18pt;}
|
7
|
+
.redText {color: red;}
|
8
|
+
.blueText {color: blue;}
|
9
|
+
.italicText {font-style: italic;}
|
10
|
+
.inherited {color: blue;}
|
11
|
+
|
12
|
+
|
13
|
+
P{font-size: 24pt;}
|
14
|
+
.redText {color: red;}
|
15
|
+
.blueText {color: blue;}
|
16
|
+
.italicText {font-style: italic;}
|
17
|
+
|
18
|
+
.italic_button {
|
19
|
+
background-color: silver;
|
20
|
+
border-width: 3;
|
21
|
+
color: black;
|
22
|
+
font-style: italic;
|
23
|
+
}
|
24
|
+
|
25
|
+
|
26
|
+
.link_class_1 a:link {
|
27
|
+
background-color: red;
|
28
|
+
border-width: 3;
|
29
|
+
color: white;
|
30
|
+
width : 3em ;
|
31
|
+
height : 3em ;
|
32
|
+
font-style: italic;
|
33
|
+
}
|
34
|
+
|
35
|
+
.check_box_style {
|
36
|
+
background-color: red;
|
37
|
+
border-width: 3;
|
38
|
+
color: white;
|
39
|
+
width : 3em ;
|
40
|
+
height : 3em ;
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
.radio_style {
|
45
|
+
background-color: yellow;
|
46
|
+
border-width: 3;
|
47
|
+
color: green;
|
48
|
+
width : 2em ;
|
49
|
+
height : 2em ;
|
50
|
+
}
|
51
|
+
|
52
|
+
select.list_style {
|
53
|
+
background-color: yellow;
|
54
|
+
border-width: 3;
|
55
|
+
color: green;
|
56
|
+
font-style: italic;
|
57
|
+
}
|
58
|
+
|
59
|
+
option.option_style {
|
60
|
+
background-color: red;
|
61
|
+
border-width: 3;
|
62
|
+
color: white;
|
63
|
+
|
64
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>
|
4
|
+
Test page for whitespace
|
5
|
+
</title>
|
6
|
+
<link rel="stylesheet" type="text/css" href="watir_unit_tests.css">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
|
10
|
+
<a href="pass.html"> Login </a>
|
11
|
+
<p>
|
12
|
+
<span id="single_nbsp">
|
13
|
+
Test for nbsp.
|
14
|
+
</span>
|
15
|
+
<p>
|
16
|
+
<span id="multiple_spaces">
|
17
|
+
Test for multiple spaces.
|
18
|
+
</span>
|
19
|
+
<p>
|
20
|
+
<span id="space_tab">
|
21
|
+
Test for space and tab.
|
22
|
+
</span>
|
23
|
+
<p>
|
24
|
+
<span id="space_w_cr">
|
25
|
+
Test for space and
|
26
|
+
cr.
|
27
|
+
</span>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
2
|
+
require 'unittests/setup'
|
3
|
+
|
4
|
+
class TC_Inspect < Test::Unit::TestCase
|
5
|
+
location __FILE__
|
6
|
+
|
7
|
+
def setup
|
8
|
+
uses_page "emphasis.html"
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_inspect_only_returns_url_and_title
|
12
|
+
assert_match(%r{#<#{browser.class}:0x[0-9a-f.]+ url="file://.+/emphasis\.html" title="emphasis">}, browser.inspect)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_element_inspect
|
16
|
+
assert_match(%r{^#<.+::Em:0x[0-9a-f.]+ located=false how=:id what=/em-one/>$}, browser.em(:id, /em-one/).inspect)
|
17
|
+
|
18
|
+
located = browser.em(:id, "em-one")
|
19
|
+
located.exists?
|
20
|
+
|
21
|
+
assert_match(%r{^#<.+::Em:0x[0-9a-f.]+ located=true how=:id what="em-one">$}, located.inspect)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_element_collections_inspect
|
25
|
+
assert_match(%r{#<.+::Ems:0x[0-9a-f.]+ length=3 container=.+>$}, browser.ems.inspect)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# This file specifies options affecting the unit tests.
|
2
|
+
# You need to copy this file to "options.yml" before it to work.
|
3
|
+
|
4
|
+
# These options can also be set using environment variables prefixed with 'watir_'.
|
5
|
+
# These environment variables will override settings from this file.
|
6
|
+
|
7
|
+
# 'ie' (Watir::IE) or 'firefox' (FireWatir::Firefox)
|
8
|
+
browser: ie
|
9
|
+
|
10
|
+
# These options only affect IE.
|
11
|
+
# speed options are fast, slow, and zippy
|
12
|
+
speed: fast
|
13
|
+
visible: true
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
2
|
+
require 'unittests/setup'
|
3
|
+
|
4
|
+
class TC_SelectLists < Test::Unit::TestCase
|
5
|
+
location __FILE__
|
6
|
+
|
7
|
+
def setup
|
8
|
+
uses_page "select_lists.html"
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_select_by_numeric
|
12
|
+
# make sure we still find the right option if passed a number
|
13
|
+
browser.select_list(:id, 'year').select(2011)
|
14
|
+
assert_equal(['2011'], browser.select_list(:id, 'year').selected_options)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
|
data/unittests/setup.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
$SETUP_LOADED = true
|
2
|
+
|
3
|
+
$myDir = File.expand_path(File.dirname(__FILE__))
|
4
|
+
|
5
|
+
# use local development versions of watir, firewatir, commonwatir if available
|
6
|
+
topdir = File.join(File.dirname(__FILE__), '..')
|
7
|
+
$firewatir_dev_lib = File.join(topdir, '..', 'firewatir', 'lib')
|
8
|
+
$watir_dev_lib = File.join(topdir, '..', 'watir', 'lib')
|
9
|
+
$LOAD_PATH.unshift File.expand_path(File.join(topdir, 'lib'))
|
10
|
+
|
11
|
+
require 'watir/browser'
|
12
|
+
Watir::Browser.default = 'ie'
|
13
|
+
require 'unittests/setup/lib'
|
14
|
+
|
15
|
+
Dir.chdir topdir do
|
16
|
+
$all_tests = Dir["unittests/*_test.rb"]
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# setup/browser
|
2
|
+
require 'watir/browser'
|
3
|
+
case Watir.options[:browser]
|
4
|
+
when 'ie'
|
5
|
+
$LOAD_PATH.unshift File.expand_path($watir_dev_lib)
|
6
|
+
when 'firefox'
|
7
|
+
$LOAD_PATH.unshift File.expand_path($firewatir_dev_lib)
|
8
|
+
end
|
9
|
+
$browser = Watir::Browser.new
|
10
|
+
|
11
|
+
# close browser at completion of the tests
|
12
|
+
# the at_exit execute before loading test/unit, otherwise IE will close *before* the tests run.
|
13
|
+
at_exit {$browser.close if $browser}
|
14
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'test/unit/collector/objectspace'
|
4
|
+
|
5
|
+
# Modify the Test::Unit runner in Eclipse, so it only runs our tests
|
6
|
+
module Test::Unit
|
7
|
+
module RDT
|
8
|
+
def self.buildSuite filename
|
9
|
+
collector = Test::Unit::Collector::ObjectSpace.new
|
10
|
+
collector.filter = Watir::UnitTest.filter
|
11
|
+
collector.collect filename
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Invoke default test runner so it only runs our tests
|
17
|
+
at_exit do
|
18
|
+
unless $! || Test::Unit.run?
|
19
|
+
runner = Test::Unit::AutoRunner.new false
|
20
|
+
runner.process_args ARGV
|
21
|
+
runner.filters = Watir::UnitTest.filter
|
22
|
+
exit runner.run
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$myDir.sub!( %r{/cygdrive/(\w)/}, '\1:/' ) # convert from cygwin to dos
|
2
|
+
|
3
|
+
require 'watir/options'
|
4
|
+
Watir.options_file = $suite_options_file = $myDir + '/options.yml'
|
5
|
+
require 'unittests/setup/options'
|
6
|
+
unit_options = Watir::UnitTest::Options.new.execute
|
7
|
+
require 'unittests/setup/browser'
|
8
|
+
require 'unittests/setup/filter'
|
9
|
+
require 'unittests/setup/capture_io_helper'
|
10
|
+
require 'unittests/setup/watir-unittest'
|
11
|
+
|
12
|
+
failure_tag = "fails_on_#{Watir.options[:browser]}".to_sym
|
13
|
+
case unit_options[:coverage]
|
14
|
+
when 'regression'
|
15
|
+
Watir::UnitTest.filter_out_tests_tagged failure_tag
|
16
|
+
when 'known failures'
|
17
|
+
Watir::UnitTest.filter_out do |test|
|
18
|
+
!(test.tagged? failure_tag)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# setup/options
|
2
|
+
require 'user-choices'
|
3
|
+
|
4
|
+
module Watir
|
5
|
+
module UnitTest
|
6
|
+
class Options < UserChoices::Command
|
7
|
+
include UserChoices
|
8
|
+
def add_sources builder
|
9
|
+
builder.add_source EnvironmentSource, :with_prefix, 'watir_'
|
10
|
+
builder.add_source YamlConfigFileSource, :from_complete_path,
|
11
|
+
$suite_options_file
|
12
|
+
end
|
13
|
+
def add_choices builder
|
14
|
+
builder.add_choice :coverage,
|
15
|
+
:type => ['regression', 'all', 'known failures'],
|
16
|
+
:default => 'regression'
|
17
|
+
end
|
18
|
+
def execute
|
19
|
+
Watir::UnitTest.options = @user_choices
|
20
|
+
end
|
21
|
+
end
|
22
|
+
def self.options
|
23
|
+
@@options
|
24
|
+
end
|
25
|
+
def self.options= x
|
26
|
+
@@options = x
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|