watir-webdriver 0.1.4 → 0.1.5
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/.gitignore +9 -0
- data/Gemfile +3 -3
- data/Rakefile +3 -28
- data/lib/watir-webdriver.rb +1 -0
- data/lib/watir-webdriver/version.rb +3 -0
- data/watir-webdriver.gemspec +23 -247
- metadata +34 -326
- data/VERSION +0 -1
- data/spec/watirspec/area_spec.rb +0 -77
- data/spec/watirspec/areas_spec.rb +0 -45
- data/spec/watirspec/browser_spec.rb +0 -274
- data/spec/watirspec/button_spec.rb +0 -255
- data/spec/watirspec/buttons_spec.rb +0 -58
- data/spec/watirspec/checkbox_spec.rb +0 -276
- data/spec/watirspec/checkboxes_spec.rb +0 -47
- data/spec/watirspec/collections_spec.rb +0 -20
- data/spec/watirspec/dd_spec.rb +0 -127
- data/spec/watirspec/dds_spec.rb +0 -45
- data/spec/watirspec/del_spec.rb +0 -145
- data/spec/watirspec/dels_spec.rb +0 -45
- data/spec/watirspec/div_spec.rb +0 -221
- data/spec/watirspec/divs_spec.rb +0 -45
- data/spec/watirspec/dl_spec.rb +0 -137
- data/spec/watirspec/dls_spec.rb +0 -46
- data/spec/watirspec/dt_spec.rb +0 -127
- data/spec/watirspec/dts_spec.rb +0 -45
- data/spec/watirspec/element_spec.rb +0 -149
- data/spec/watirspec/em_spec.rb +0 -101
- data/spec/watirspec/ems_spec.rb +0 -46
- data/spec/watirspec/filefield_spec.rb +0 -156
- data/spec/watirspec/filefields_spec.rb +0 -46
- data/spec/watirspec/font_spec.rb +0 -32
- data/spec/watirspec/form_spec.rb +0 -63
- data/spec/watirspec/forms_spec.rb +0 -47
- data/spec/watirspec/frame_spec.rb +0 -144
- data/spec/watirspec/frames_spec.rb +0 -83
- data/spec/watirspec/hidden_spec.rb +0 -103
- data/spec/watirspec/hiddens_spec.rb +0 -46
- data/spec/watirspec/hn_spec.rb +0 -97
- data/spec/watirspec/hns_spec.rb +0 -42
- data/spec/watirspec/image_spec.rb +0 -208
- data/spec/watirspec/images_spec.rb +0 -45
- data/spec/watirspec/ins_spec.rb +0 -146
- data/spec/watirspec/inses_spec.rb +0 -45
- data/spec/watirspec/label_spec.rb +0 -81
- data/spec/watirspec/labels_spec.rb +0 -45
- data/spec/watirspec/li_spec.rb +0 -116
- data/spec/watirspec/lib/guards.rb +0 -59
- data/spec/watirspec/lib/implementation.rb +0 -48
- data/spec/watirspec/lib/runner.rb +0 -83
- data/spec/watirspec/lib/server.rb +0 -194
- data/spec/watirspec/lib/watirspec.rb +0 -75
- data/spec/watirspec/link_spec.rb +0 -174
- data/spec/watirspec/links_spec.rb +0 -49
- data/spec/watirspec/lis_spec.rb +0 -45
- data/spec/watirspec/map_spec.rb +0 -80
- data/spec/watirspec/maps_spec.rb +0 -46
- data/spec/watirspec/meta_spec.rb +0 -24
- data/spec/watirspec/metas_spec.rb +0 -43
- data/spec/watirspec/ol_spec.rb +0 -90
- data/spec/watirspec/ols_spec.rb +0 -45
- data/spec/watirspec/option_spec.rb +0 -152
- data/spec/watirspec/p_spec.rb +0 -132
- data/spec/watirspec/pre_spec.rb +0 -116
- data/spec/watirspec/pres_spec.rb +0 -45
- data/spec/watirspec/ps_spec.rb +0 -45
- data/spec/watirspec/radio_spec.rb +0 -262
- data/spec/watirspec/radios_spec.rb +0 -46
- data/spec/watirspec/select_list_spec.rb +0 -335
- data/spec/watirspec/select_lists_spec.rb +0 -49
- data/spec/watirspec/span_spec.rb +0 -146
- data/spec/watirspec/spans_spec.rb +0 -45
- data/spec/watirspec/spec_helper.rb +0 -20
- data/spec/watirspec/strong_spec.rb +0 -93
- data/spec/watirspec/strongs_spec.rb +0 -46
- data/spec/watirspec/table_nesting_spec.rb +0 -50
- data/spec/watirspec/table_spec.rb +0 -150
- data/spec/watirspec/tables_spec.rb +0 -47
- data/spec/watirspec/tbody_spec.rb +0 -97
- data/spec/watirspec/tbodys_spec.rb +0 -65
- data/spec/watirspec/td_spec.rb +0 -72
- data/spec/watirspec/tds_spec.rb +0 -60
- data/spec/watirspec/text_field_spec.rb +0 -283
- data/spec/watirspec/text_fields_spec.rb +0 -49
- data/spec/watirspec/tfoot_spec.rb +0 -92
- data/spec/watirspec/tfoots_spec.rb +0 -71
- data/spec/watirspec/thead_spec.rb +0 -92
- data/spec/watirspec/theads_spec.rb +0 -71
- data/spec/watirspec/tr_spec.rb +0 -88
- data/spec/watirspec/trs_spec.rb +0 -68
- data/spec/watirspec/ul_spec.rb +0 -80
- data/spec/watirspec/uls_spec.rb +0 -44
- data/spec/watirspec/window_switching_spec.rb +0 -164
data/spec/watirspec/trs_spec.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "TableRows" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
|
11
|
-
describe "with selectors" do
|
12
|
-
it "returns the matching elements" do
|
13
|
-
browser.trs(:id => "outer_second").to_a.should == [browser.tr(:id => "outer_second")]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#length" do
|
19
|
-
it "returns the correct number of cells (table context)" do
|
20
|
-
browser.table(:id, 'inner').trs.length.should == 1
|
21
|
-
browser.table(:id, 'outer').trs.length.should == 4
|
22
|
-
end
|
23
|
-
|
24
|
-
it "returns the correct number of cells (page context)" do
|
25
|
-
browser.trs.length.should == 14
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "#[]" do
|
30
|
-
it "returns the row at the given index (table context)" do
|
31
|
-
browser.table(:id, 'outer').trs[0].id.should == "outer_first"
|
32
|
-
end
|
33
|
-
|
34
|
-
it "returns the row at the given index (page context)" do
|
35
|
-
browser.trs[0].id.should == "thead_row_1"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "#each" do
|
40
|
-
it "iterates through rows correctly" do
|
41
|
-
inner_table = browser.table(:id, 'inner')
|
42
|
-
count = 0
|
43
|
-
|
44
|
-
inner_table.trs.each_with_index do |r, index|
|
45
|
-
r.id.should == inner_table.tr(:index, index).id
|
46
|
-
r.value.should == inner_table.tr(:index, index).value
|
47
|
-
|
48
|
-
count += 1
|
49
|
-
end
|
50
|
-
count.should > 0
|
51
|
-
end
|
52
|
-
|
53
|
-
it "iterates through the outer table correctly" do
|
54
|
-
outer_table = browser.table(:id, 'outer')
|
55
|
-
count = 0
|
56
|
-
|
57
|
-
outer_table.trs.each_with_index do |r, index|
|
58
|
-
r.id.should == outer_table.tr(:index, index).id
|
59
|
-
r.value.should == outer_table.tr(:index, index).value
|
60
|
-
|
61
|
-
count += 1
|
62
|
-
end
|
63
|
-
|
64
|
-
count.should > 0
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
data/spec/watirspec/ul_spec.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Ul" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
# Exists method
|
11
|
-
describe "#exist?" do
|
12
|
-
it "returns true if the 'ul' exists" do
|
13
|
-
browser.ul(:id, "navbar").should exist
|
14
|
-
browser.ul(:id, /navbar/).should exist
|
15
|
-
browser.ul(:index, 0).should exist
|
16
|
-
browser.ul(:xpath, "//ul[@id='navbar']").should exist
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns the first ul if given no args" do
|
20
|
-
browser.ul.should exist
|
21
|
-
end
|
22
|
-
|
23
|
-
it "returns false if the 'ul' doesn't exist" do
|
24
|
-
browser.ul(:id, "no_such_id").should_not exist
|
25
|
-
browser.ul(:id, /no_such_id/).should_not exist
|
26
|
-
browser.ul(:text, "no_such_text").should_not exist
|
27
|
-
browser.ul(:text, /no_such_text/).should_not exist
|
28
|
-
browser.ul(:class, "no_such_class").should_not exist
|
29
|
-
browser.ul(:class, /no_such_class/).should_not exist
|
30
|
-
browser.ul(:index, 1337).should_not exist
|
31
|
-
browser.ul(:xpath, "//ul[@id='no_such_id']").should_not exist
|
32
|
-
end
|
33
|
-
|
34
|
-
it "raises TypeError when 'what' argument is invalid" do
|
35
|
-
lambda { browser.ul(:id, 3.14).exists? }.should raise_error(TypeError)
|
36
|
-
end
|
37
|
-
|
38
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
39
|
-
lambda { browser.ul(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# Attribute methods
|
44
|
-
describe "#class_name" do
|
45
|
-
it "returns the class attribute" do
|
46
|
-
browser.ul(:id, 'navbar').class_name.should == 'navigation'
|
47
|
-
end
|
48
|
-
|
49
|
-
it "returns an empty string if the element exists and the attribute doesn't" do
|
50
|
-
browser.ul(:index, 1).class_name.should == ''
|
51
|
-
end
|
52
|
-
|
53
|
-
it "raises UnknownObjectException if the ul doesn't exist" do
|
54
|
-
lambda { browser.ul(:id, 'no_such_id').class_name }.should raise_error(UnknownObjectException)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "#id" do
|
59
|
-
it "returns the id attribute" do
|
60
|
-
browser.ul(:class, 'navigation').id.should == "navbar"
|
61
|
-
end
|
62
|
-
|
63
|
-
it "returns an empty string if the element exists and the attribute doesn't" do
|
64
|
-
browser.ul(:index, 1).id.should == ''
|
65
|
-
end
|
66
|
-
|
67
|
-
it "raises UnknownObjectException if the ul doesn't exist" do
|
68
|
-
lambda { browser.ul(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
69
|
-
lambda { browser.ul(:index, 1337).id }.should raise_error(UnknownObjectException)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "#respond_to?" do
|
74
|
-
it "returns true for all attribute methods" do
|
75
|
-
browser.ul(:index, 0).should respond_to(:class_name)
|
76
|
-
browser.ul(:index, 0).should respond_to(:id)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
data/spec/watirspec/uls_spec.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Uls" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
|
11
|
-
describe "with selectors" do
|
12
|
-
it "returns the matching elements" do
|
13
|
-
browser.uls(:class => "navigation").to_a.should == [browser.ul(:class => "navigation")]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#length" do
|
19
|
-
it "returns the number of uls" do
|
20
|
-
browser.uls.length.should == 2
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#[]" do
|
25
|
-
it "returns the ul at the given index" do
|
26
|
-
browser.uls[0].id.should == "navbar"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#each" do
|
31
|
-
it "iterates through uls correctly" do
|
32
|
-
count = 0
|
33
|
-
|
34
|
-
browser.uls.each_with_index do |ul, index|
|
35
|
-
ul.id.should == browser.ul(:index, index).id
|
36
|
-
ul.value.should == browser.ul(:index, index).value
|
37
|
-
|
38
|
-
count += 1
|
39
|
-
end
|
40
|
-
|
41
|
-
count.should > 0
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,164 +0,0 @@
|
|
1
|
-
require File.expand_path("../spec_helper", __FILE__)
|
2
|
-
|
3
|
-
describe Browser do
|
4
|
-
|
5
|
-
before do
|
6
|
-
url = "file://" + File.expand_path("html/window_switching.html", File.dirname(__FILE__))
|
7
|
-
browser.goto url
|
8
|
-
browser.a(:id => "open").click
|
9
|
-
end
|
10
|
-
|
11
|
-
after do
|
12
|
-
begin
|
13
|
-
browser.window(:title => "closeable window").close
|
14
|
-
rescue
|
15
|
-
# not ideal - clean these up
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#windows" do
|
20
|
-
it "returns an array of window handles" do
|
21
|
-
wins = browser.windows
|
22
|
-
wins.should_not be_empty
|
23
|
-
wins.each { |win| win.should be_kind_of(Window) }
|
24
|
-
end
|
25
|
-
|
26
|
-
it "only returns windows matching the given selector" do
|
27
|
-
browser.windows(:title => "closeable window").size.should == 1
|
28
|
-
end
|
29
|
-
|
30
|
-
it "raises ArgumentError if the selector is invalid" do
|
31
|
-
lambda { browser.windows(:name => "foo") }.should raise_error(ArgumentError)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "raises returns an empty array if no window matches the selector" do
|
35
|
-
browser.windows(:title => "noop").should == []
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "#window" do
|
40
|
-
it "finds window by :url" do
|
41
|
-
w = browser.window(:url => /closeable\.html/)
|
42
|
-
w.should be_kind_of(Window)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "finds window by :title" do
|
46
|
-
w = browser.window(:title => "closeable window")
|
47
|
-
w.should be_kind_of(Window)
|
48
|
-
end
|
49
|
-
|
50
|
-
it "returns the current window if no argument is given" do
|
51
|
-
browser.window.url.should =~ /window_switching\.html/
|
52
|
-
end
|
53
|
-
|
54
|
-
bug "http://github.com/jarib/celerity/issues#issue/17", :celerity do
|
55
|
-
it "it executes the given block in the window" do
|
56
|
-
browser.window(:title => "closeable window") do
|
57
|
-
link = browser.a(:id => "close")
|
58
|
-
link.should exist
|
59
|
-
link.click
|
60
|
-
end
|
61
|
-
|
62
|
-
browser.windows.size.should == 1
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
it "raises ArgumentError if the selector is invalid" do
|
67
|
-
lambda { browser.window(:name => "foo") }.should raise_error(ArgumentError)
|
68
|
-
end
|
69
|
-
|
70
|
-
it "raises an error if no window matches the selector" do
|
71
|
-
lambda { browser.window(:title => "noop") }.should raise_error
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
bug "http://github.com/jarib/celerity/issues#issue/17", :celerity do
|
78
|
-
describe Window do
|
79
|
-
before do
|
80
|
-
url = "file://" + File.expand_path("html/window_switching.html", File.dirname(__FILE__))
|
81
|
-
browser.goto url
|
82
|
-
browser.a(:id => "open").click
|
83
|
-
end
|
84
|
-
|
85
|
-
after do
|
86
|
-
browser.window(:title => "closeable window").close
|
87
|
-
end
|
88
|
-
|
89
|
-
bug "http://github.com/jarib/watir-webdriver/issues/issue/35", :webdriver do
|
90
|
-
describe "#close" do
|
91
|
-
it "closes the window" do
|
92
|
-
browser.windows.size.should == 2
|
93
|
-
|
94
|
-
browser.a(:id => "open").click
|
95
|
-
browser.windows.size.should == 3
|
96
|
-
|
97
|
-
browser.windows(:title => "closeable window").close
|
98
|
-
browser.windows.size.should == 2
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe "#use" do
|
103
|
-
it "switches to the window" do
|
104
|
-
browser.window(:title => "closeable window").use
|
105
|
-
browser.title.should == "closeable window"
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
describe "#current?" do
|
111
|
-
it "returns true if it is the current window" do
|
112
|
-
browser.window(:title => browser.title).should be_current
|
113
|
-
end
|
114
|
-
|
115
|
-
it "returns false if it is not the current window" do
|
116
|
-
browser.window(:title => "closeable window").should_not be_current
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe "#title" do
|
121
|
-
it "returns the title of the window" do
|
122
|
-
titles = browser.windows.map { |e| e.title }
|
123
|
-
titles.size.should == 2
|
124
|
-
|
125
|
-
["window switching", "closeable window"].each do |title|
|
126
|
-
titles.should include(title)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
it "does not change the current window" do
|
131
|
-
browser.title.should == "window switching"
|
132
|
-
browser.windows.find { |w| w.title == "closeable window" }.should_not be_nil
|
133
|
-
browser.title.should == "window switching"
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
describe "#url" do
|
138
|
-
it "returns the url of the window" do
|
139
|
-
browser.windows.size.should == 2
|
140
|
-
browser.windows.select { |w| w.url =~ /window_switching\.html/ }.size.should == 1
|
141
|
-
browser.windows.select { |w| w.url =~ /closeable\.html$/ }.size.should == 1
|
142
|
-
end
|
143
|
-
|
144
|
-
it "does not change the current window" do
|
145
|
-
browser.url.should =~ /window_switching\.html/
|
146
|
-
browser.windows.find { |w| w.url =~ /closeable\.html/ }.should_not be_nil
|
147
|
-
browser.url.should =~ /window_switching/
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe "#==" do
|
152
|
-
it "knows when two windows are equal" do
|
153
|
-
browser.window.should == browser.window
|
154
|
-
end
|
155
|
-
|
156
|
-
it "knows when two windows are not equal" do
|
157
|
-
win1 = browser.window
|
158
|
-
win2 = browser.window(:title => "closeable window")
|
159
|
-
|
160
|
-
win1.should_not == win2
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|