steam 0.0.4 → 0.0.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/Gemfile +2 -0
- data/lib/core_ext/ruby/string/camelize.rb +1 -1
- data/lib/core_ext/ruby/string/underscore.rb +8 -1
- data/lib/steam/browser/html_unit.rb +9 -5
- data/lib/steam/browser/html_unit/client.rb +14 -2
- data/lib/steam/browser/html_unit/connection.rb +10 -10
- data/lib/steam/browser/html_unit/web_response.rb +0 -1
- data/lib/steam/connection/net_http.rb +4 -4
- data/lib/steam/java.rb +7 -6
- data/lib/steam/request.rb +88 -35
- data/lib/steam/session/rails.rb +1 -1
- data/lib/steam/version.rb +1 -1
- metadata +23 -50
- data/Rakefile +0 -23
- data/test/all.rb +0 -3
- data/test/browser/html_unit/actions_test.rb +0 -183
- data/test/browser/html_unit/javascript_test.rb +0 -60
- data/test/browser/html_unit/rails_actions_test.rb +0 -150
- data/test/browser/html_unit_test.rb +0 -98
- data/test/connection/cascade_test.rb +0 -42
- data/test/connection/mock_test.rb +0 -58
- data/test/connection/rails_test.rb +0 -16
- data/test/connection/static_test.rb +0 -14
- data/test/example/webrat_compat_steps_test.rb +0 -307
- data/test/fixtures/html_fakes.rb +0 -191
- data/test/java_test.rb +0 -29
- data/test/playground/connection.rb +0 -19
- data/test/playground/dragdrop_behavior.rb +0 -60
- data/test/playground/drb.rb +0 -55
- data/test/playground/java_signature.rb +0 -22
- data/test/playground/nokogiri.rb +0 -15
- data/test/playground/put_headers.rb +0 -83
- data/test/playground/rack.rb +0 -11
- data/test/playground/rjb_bind.rb +0 -42
- data/test/playground/stack_level_problem.rb +0 -129
- data/test/playground/thread_problem.rb +0 -57
- data/test/playground/web_response_data.rb +0 -21
- data/test/playground/webrat.rb +0 -48
- data/test/playground/xhr_accept_headers.rb +0 -61
- data/test/process_test.rb +0 -55
- data/test/session_test.rb +0 -40
- data/test/test_helper.rb +0 -80
data/Rakefile
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
$: << File.expand_path('../lib', __FILE__)
|
2
|
-
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'steam/version'
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'jeweler'
|
8
|
-
Jeweler::Tasks.new do |s|
|
9
|
-
s.name = 'steam'
|
10
|
-
s.version = Steam::VERSION
|
11
|
-
s.summary = 'Headless integration testing w/ HtmlUnit: enables testing JavaScript-driven web sites '
|
12
|
-
s.email = 'svenfuchs@artweb-design.de'
|
13
|
-
s.homepage = 'http://github.com/svenfuchs/steam'
|
14
|
-
s.description = 'Steam is a headless integration testing tool driving HtmlUnit to enable testing JavaScript-driven web sites.'
|
15
|
-
s.authors = ['Sven Fuchs', 'Clemens Kofler']
|
16
|
-
s.files = FileList['[A-Z]*', 'lib/steam.rb', 'lib/{core_ext,steam}/**/*']
|
17
|
-
|
18
|
-
s.add_dependency 'rjb', '>= 1.2.0'
|
19
|
-
s.add_dependency 'locator', '>= 0.0.6'
|
20
|
-
end
|
21
|
-
rescue LoadError
|
22
|
-
puts 'Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com'
|
23
|
-
end
|
data/test/all.rb
DELETED
@@ -1,183 +0,0 @@
|
|
1
|
-
require File.expand_path('../../../test_helper', __FILE__)
|
2
|
-
require 'fixtures/html_fakes'
|
3
|
-
|
4
|
-
class HtmlUnitActionsTest < Test::Unit::TestCase
|
5
|
-
include Steam, HtmlFakes
|
6
|
-
|
7
|
-
def setup
|
8
|
-
mock = Steam::Connection::Mock.new
|
9
|
-
static = Steam::Connection::Static.new(:root => FIXTURES_PATH)
|
10
|
-
@browser = Steam::Browser::HtmlUnit.new(Rack::Cascade.new([static, mock]))
|
11
|
-
end
|
12
|
-
|
13
|
-
test "click_on clicks on an element" do
|
14
|
-
perform :get, 'http://localhost:3000/', html
|
15
|
-
|
16
|
-
assert_response_contains('LINK') do
|
17
|
-
mock :get, 'http://localhost:3000/link', 'LINK'
|
18
|
-
@browser.click_on('link')
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
test "click_on clicks a button" do
|
23
|
-
perform :get, 'http://localhost:3000/', html(:fields => :text)
|
24
|
-
|
25
|
-
assert_response_contains('FORM') do
|
26
|
-
mock :get, 'http://localhost:3000/form?field=', 'FORM'
|
27
|
-
@browser.click_on(:button, 'button')
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
test "click_link clicks a link" do
|
32
|
-
perform :get, 'http://localhost:3000/', html
|
33
|
-
|
34
|
-
assert_response_contains('LINK') do
|
35
|
-
mock :get, 'http://localhost:3000/link', 'LINK'
|
36
|
-
@browser.click_link('link')
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
test "click_button clicks a button" do
|
41
|
-
perform :get, 'http://localhost:3000/', html(:fields => :text)
|
42
|
-
|
43
|
-
assert_response_contains('FORM') do
|
44
|
-
mock :get, 'http://localhost:3000/form?field=', 'FORM'
|
45
|
-
@browser.click_button('button')
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
test "fill_in fills in a text input" do
|
50
|
-
perform :get, 'http://localhost:3000/', html(:fields => :text)
|
51
|
-
|
52
|
-
assert_response_contains('FIELD') do
|
53
|
-
mock :get, 'http://localhost:3000/form?field=text', 'FIELD'
|
54
|
-
@browser.fill_in('field', :with => 'text')
|
55
|
-
@browser.click_button('button')
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
test "fill_in fills in a textarea" do
|
60
|
-
perform :get, 'http://localhost:3000/', html(:fields => :textarea)
|
61
|
-
|
62
|
-
assert_response_contains('TEXTAREA') do
|
63
|
-
mock :get, 'http://localhost:3000/form?textarea=text', 'TEXTAREA'
|
64
|
-
@browser.fill_in('textarea', :with => 'text')
|
65
|
-
@browser.click_button('button')
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
test "check checks a checkbox" do
|
70
|
-
perform :get, 'http://localhost:3000/', html(:fields => :checkbox)
|
71
|
-
|
72
|
-
assert_response_contains('CHECKED') do
|
73
|
-
mock :get, 'http://localhost:3000/form?checkbox=1', 'CHECKED'
|
74
|
-
@browser.check('checkbox')
|
75
|
-
@browser.click_button('button')
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
test "uncheck unchecks a checkbox" do
|
80
|
-
perform :get, 'http://localhost:3000/', html(:fields => :checkbox)
|
81
|
-
|
82
|
-
assert_response_contains('FORM') do
|
83
|
-
mock :get, 'http://localhost:3000/form', 'FORM'
|
84
|
-
@browser.check('checkbox')
|
85
|
-
@browser.uncheck('checkbox')
|
86
|
-
@browser.click_button('button')
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
test "choose activates a radio button" do
|
91
|
-
perform :get, 'http://localhost:3000/', html(:fields => :radio)
|
92
|
-
|
93
|
-
assert_response_contains('RADIO') do
|
94
|
-
mock :get, 'http://localhost:3000/form?radio=radio', 'RADIO'
|
95
|
-
@browser.choose('radio')
|
96
|
-
@browser.click_button('button')
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
test "select selects an option from a select box" do
|
101
|
-
perform :get, 'http://localhost:3000/', html(:fields => :select)
|
102
|
-
|
103
|
-
assert_response_contains('SELECT') do
|
104
|
-
mock :get, 'http://localhost:3000/form?select=foo', 'SELECT'
|
105
|
-
@browser.select('foo', :from => 'select')
|
106
|
-
@browser.click_button('button')
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
test "set_hidden_field sets a value to a hidden field" do
|
111
|
-
perform :get, 'http://localhost:3000/', html(:fields => :hidden)
|
112
|
-
|
113
|
-
assert_response_contains('SELECT') do
|
114
|
-
mock :get, 'http://localhost:3000/form?hidden=foo', 'SELECT'
|
115
|
-
@browser.set_hidden_field('hidden', :to => 'foo')
|
116
|
-
@browser.click_button('button')
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
test "attach_file sets a filename to a file field" do
|
121
|
-
perform :get, 'http://localhost:3000/', html(:fields => :file)
|
122
|
-
|
123
|
-
assert_response_contains('FILE') do
|
124
|
-
mock :get, 'http://localhost:3000/form?file=rails.png', 'FILE'
|
125
|
-
@browser.attach_file('file', "#{TEST_ROOT}/fixtures/rails.png")
|
126
|
-
@browser.click_button('button')
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
test "submit_form submits a form" do
|
131
|
-
perform :get, 'http://localhost:3000/', html(:fields => :text)
|
132
|
-
|
133
|
-
assert_response_contains('FORM') do
|
134
|
-
mock :get, 'http://localhost:3000/form?field=', 'FORM'
|
135
|
-
@browser.submit_form('form')
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
test "drag drags an draggable and drop drops the draggable onto a droppable" do
|
140
|
-
perform :get, 'http://localhost:3000/', html(:scripts => [:jquery, :jquery_ui, :drag])
|
141
|
-
|
142
|
-
@browser.drag('link')
|
143
|
-
@browser.drop('form')
|
144
|
-
assert_equal 'DROPPED!', @browser.page.getTitleText
|
145
|
-
end
|
146
|
-
|
147
|
-
test "drag_and_drop drags a draggable and drops it onto a droppable" do
|
148
|
-
perform :get, 'http://localhost:3000/', html(:scripts => [:jquery, :jquery_ui, :drag])
|
149
|
-
|
150
|
-
@browser.drag_and_drop('link', :to => 'form')
|
151
|
-
assert_equal 'DROPPED!', @browser.page.getTitleText
|
152
|
-
end
|
153
|
-
|
154
|
-
test "hover triggers a mouseOver event on an element" do
|
155
|
-
perform :get, 'http://localhost:3000/', html(:scripts => [:jquery, :jquery_ui, :hover])
|
156
|
-
|
157
|
-
@browser.hover('paragraph')
|
158
|
-
assert_equal 'HOVERED!', @browser.page.getTitleText
|
159
|
-
end
|
160
|
-
|
161
|
-
test "focus triggers a focus event on an element" do
|
162
|
-
perform :get, 'http://localhost:3000/', html(:fields => :text, :scripts => [:jquery, :jquery_ui, :focus])
|
163
|
-
|
164
|
-
@browser.focus('field')
|
165
|
-
assert_equal 'FOCUSED!', @browser.page.getTitleText
|
166
|
-
end
|
167
|
-
|
168
|
-
test "blur triggers a blur event on an element" do
|
169
|
-
perform :get, 'http://localhost:3000/', html(:fields => :text, :scripts => [:jquery, :jquery_ui, :blur])
|
170
|
-
|
171
|
-
@browser.focus('field')
|
172
|
-
@browser.blur('field')
|
173
|
-
assert_equal 'BLURRED!', @browser.page.getTitleText
|
174
|
-
end
|
175
|
-
|
176
|
-
test "double_click doubleclicks an element" do
|
177
|
-
perform :get, 'http://localhost:3000/', html(:scripts => [:jquery, :jquery_ui, :double_click])
|
178
|
-
|
179
|
-
@browser.double_click('paragraph')
|
180
|
-
assert_equal 'DOUBLE CLICKED!', @browser.page.getTitleText
|
181
|
-
end
|
182
|
-
|
183
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
require File.expand_path('../../../test_helper', __FILE__)
|
2
|
-
require 'fixtures/html_fakes'
|
3
|
-
|
4
|
-
class HtmlUnitJavascriptTest < Test::Unit::TestCase
|
5
|
-
include Steam, HtmlFakes
|
6
|
-
|
7
|
-
def setup
|
8
|
-
@connection = Steam::Connection::Mock.new
|
9
|
-
static = Steam::Connection::Static.new(:root => FIXTURES_PATH)
|
10
|
-
@browser = Steam::Browser::HtmlUnit.new(Rack::Cascade.new([static, @connection]))
|
11
|
-
end
|
12
|
-
|
13
|
-
test "jquery: div:not([id]) selector" do
|
14
|
-
html = <<-html
|
15
|
-
<html>
|
16
|
-
<head>
|
17
|
-
<script src="/javascripts/jquery.js" type="text/javascript"></script>
|
18
|
-
<script>
|
19
|
-
$(document).ready(function() {
|
20
|
-
$('div:not([id])').each(function() {
|
21
|
-
document.title = $(this).html();
|
22
|
-
});
|
23
|
-
});
|
24
|
-
</script>
|
25
|
-
</head>
|
26
|
-
<body>
|
27
|
-
<div id="foo">foo</div>
|
28
|
-
<div>bar</div>
|
29
|
-
</body>
|
30
|
-
</html>
|
31
|
-
html
|
32
|
-
|
33
|
-
perform(:get, 'http://localhost:3000/', html)
|
34
|
-
assert_equal 'bar', @browser.page.getTitleText
|
35
|
-
end
|
36
|
-
|
37
|
-
test "jquery: div[id*=bar] selector" do
|
38
|
-
html = <<-html
|
39
|
-
<html>
|
40
|
-
<head>
|
41
|
-
<script src="/javascripts/jquery.js" type="text/javascript"></script>
|
42
|
-
<script>
|
43
|
-
$(document).ready(function() {
|
44
|
-
$('div[id*=bar]').each(function() {
|
45
|
-
document.title = $(this).html();
|
46
|
-
});
|
47
|
-
});
|
48
|
-
</script>
|
49
|
-
</head>
|
50
|
-
<body>
|
51
|
-
<div id="sidebar">foobar</div>
|
52
|
-
</body>
|
53
|
-
</html>
|
54
|
-
html
|
55
|
-
|
56
|
-
perform(:get, 'http://localhost:3000/', html)
|
57
|
-
assert_equal 'foobar', @browser.page.getTitleText
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
@@ -1,150 +0,0 @@
|
|
1
|
-
require File.expand_path('../../../test_helper', __FILE__)
|
2
|
-
require 'fixtures/html_fakes'
|
3
|
-
|
4
|
-
class HtmlUnitRailsActionsTest < Test::Unit::TestCase
|
5
|
-
include Steam, HtmlFakes
|
6
|
-
|
7
|
-
def setup
|
8
|
-
connection = Steam::Connection::Mock.new
|
9
|
-
@browser = Steam::Browser::HtmlUnit.new(connection)
|
10
|
-
|
11
|
-
mock :get, "http://localhost:3000/form?event_date(1i)=2009&event_date(2i)=11&event_date(3i)=7", 'DATE'
|
12
|
-
mock :get, "http://localhost:3000/form?event_datetime(1i)=2009&event_datetime(2i)=11&event_datetime(3i)=7&event_datetime(4i)=19&event_datetime(5i)=0", 'DATETIME'
|
13
|
-
mock :get, "http://localhost:3000/form?event_time(4i)=19&event_time(5i)=0", 'TIME'
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_select_date
|
17
|
-
perform :get, 'http://localhost:3000/', html(:fields => :date)
|
18
|
-
|
19
|
-
assert_response_contains('DATE') do
|
20
|
-
@browser.select_date('7 November 2009', :from => 'event_date')
|
21
|
-
@browser.submit_form('form')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_select_date_works_with_date_object
|
26
|
-
perform :get, 'http://localhost:3000/', html(:fields => :date)
|
27
|
-
|
28
|
-
assert_response_contains('DATE') do
|
29
|
-
@browser.select_date(Date.parse('7 November 2009'), :from => 'event_date')
|
30
|
-
@browser.submit_form('form')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_select_date_works_with_label
|
35
|
-
perform :get, 'http://localhost:3000/', html(:fields => :date)
|
36
|
-
|
37
|
-
assert_response_contains('DATE') do
|
38
|
-
@browser.select_date('7 November 2009', :from => 'Date')
|
39
|
-
@browser.submit_form('form')
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_select_date_works_without_from_option
|
44
|
-
perform :get, 'http://localhost:3000/', html(:fields => :date)
|
45
|
-
|
46
|
-
assert_response_contains('DATE') do
|
47
|
-
@browser.select_date('7 November 2009')
|
48
|
-
@browser.submit_form('form')
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_select_date_works_with_id_prefix_option
|
53
|
-
perform :get, 'http://localhost:3000/', html(:fields => :date)
|
54
|
-
|
55
|
-
assert_response_contains('DATE') do
|
56
|
-
@browser.select_date('7 November 2009', :id_prefix => 'event_date')
|
57
|
-
@browser.submit_form('form')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_select_datetime
|
62
|
-
perform :get, 'http://localhost:3000/', html(:fields => :datetime)
|
63
|
-
|
64
|
-
assert_response_contains('DATETIME') do
|
65
|
-
@browser.select_datetime('7 November 2009, 19:00', :from => 'event_datetime')
|
66
|
-
@browser.submit_form('form')
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_select_datetime_works_with_datetime_object
|
71
|
-
perform :get, 'http://localhost:3000/', html(:fields => :datetime)
|
72
|
-
|
73
|
-
assert_response_contains('DATETIME') do
|
74
|
-
@browser.select_datetime(Time.parse('7 November 2009, 19:00'), :from => 'event_datetime')
|
75
|
-
@browser.submit_form('form')
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_select_datetime_works_with_label
|
80
|
-
perform :get, 'http://localhost:3000/', html(:fields => :datetime)
|
81
|
-
|
82
|
-
assert_response_contains('DATETIME') do
|
83
|
-
@browser.select_datetime('7 November 2009, 19:00', :from => 'Datetime')
|
84
|
-
@browser.submit_form('form')
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_select_datetime_works_without_from_option
|
89
|
-
perform :get, 'http://localhost:3000/', html(:fields => :datetime)
|
90
|
-
|
91
|
-
assert_response_contains('DATETIME') do
|
92
|
-
@browser.select_datetime('7 November 2009, 19:00')
|
93
|
-
@browser.submit_form('form')
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_select_datetime_works_with_id_prefix_option
|
98
|
-
perform :get, 'http://localhost:3000/', html(:fields => :datetime)
|
99
|
-
|
100
|
-
assert_response_contains('DATETIME') do
|
101
|
-
@browser.select_datetime('7 November 2009, 19:00', :id_prefix => 'event_datetime')
|
102
|
-
@browser.submit_form('form')
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_select_time
|
107
|
-
perform :get, 'http://localhost:3000/', html(:fields => :time)
|
108
|
-
|
109
|
-
assert_response_contains('TIME') do
|
110
|
-
@browser.select_time('19:00', :from => 'event_time')
|
111
|
-
@browser.submit_form('form')
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_select_time_works_with_time_object
|
116
|
-
perform :get, 'http://localhost:3000/', html(:fields => :time)
|
117
|
-
|
118
|
-
assert_response_contains('TIME') do
|
119
|
-
@browser.select_time(Time.parse('19:00'), :from => 'event_time')
|
120
|
-
@browser.submit_form('form')
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_select_time_works_with_label
|
125
|
-
perform :get, 'http://localhost:3000/', html(:fields => :time)
|
126
|
-
|
127
|
-
assert_response_contains('TIME') do
|
128
|
-
@browser.select_time('19:00', :from => 'Time')
|
129
|
-
@browser.submit_form('form')
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
def test_select_time_works_without_from_option
|
134
|
-
perform :get, 'http://localhost:3000/', html(:fields => :time)
|
135
|
-
|
136
|
-
assert_response_contains('TIME') do
|
137
|
-
@browser.select_time('19:00')
|
138
|
-
@browser.submit_form('form')
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_select_time_works_with_id_prefix_option
|
143
|
-
perform :get, 'http://localhost:3000/', html(:fields => :time)
|
144
|
-
|
145
|
-
assert_response_contains('TIME') do
|
146
|
-
@browser.select_time('19:00', :id_prefix => 'event_time')
|
147
|
-
@browser.submit_form('form')
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', __FILE__)
|
2
|
-
require 'fixtures/html_fakes'
|
3
|
-
require 'locator'
|
4
|
-
|
5
|
-
module HtmlUnitTests
|
6
|
-
include Steam
|
7
|
-
|
8
|
-
def init
|
9
|
-
@connection = Connection::Mock.new
|
10
|
-
@browser = Browser::HtmlUnit.new(@connection)
|
11
|
-
perform(:get, 'http://localhost:3000/', '<div id="foo"><div id="bar"><a id="buz" href="">bar!</a></div></div>')
|
12
|
-
end
|
13
|
-
|
14
|
-
def locate(*args, &block)
|
15
|
-
@browser.locate(*args, &block)
|
16
|
-
end
|
17
|
-
|
18
|
-
def within(*args, &block)
|
19
|
-
@browser.within(*args, &block)
|
20
|
-
end
|
21
|
-
|
22
|
-
test 'locate with node type' do
|
23
|
-
element = locate(:a)
|
24
|
-
assert_equal 'a', element.name
|
25
|
-
end
|
26
|
-
|
27
|
-
test 'locate with attributes' do
|
28
|
-
element = locate(:id => 'buz')
|
29
|
-
assert_equal 'a', element.name
|
30
|
-
end
|
31
|
-
|
32
|
-
test 'locate with search text' do
|
33
|
-
element = locate(:a, 'bar!')
|
34
|
-
assert_equal 'a', element.name
|
35
|
-
end
|
36
|
-
|
37
|
-
test 'locate with xpath' do
|
38
|
-
element = locate(:xpath => '//div/div/a')
|
39
|
-
assert_equal 'a', element.name
|
40
|
-
end
|
41
|
-
|
42
|
-
test 'locate with css' do
|
43
|
-
element = locate(:css => '#foo #bar a')
|
44
|
-
assert_equal 'a', element.name
|
45
|
-
end
|
46
|
-
|
47
|
-
test 'within with node type' do
|
48
|
-
element = within(:div) { within(:div) { locate(:a) } }
|
49
|
-
assert_equal 'a', element.name
|
50
|
-
end
|
51
|
-
|
52
|
-
test 'within with attributes' do
|
53
|
-
element = within(:id => 'foo') { within(:id => 'bar') { locate(:a) } }
|
54
|
-
assert_equal 'a', element.name
|
55
|
-
end
|
56
|
-
|
57
|
-
test 'within with xpath' do
|
58
|
-
element = within('//div/div') { locate(:a) }
|
59
|
-
assert_equal 'a', element.name
|
60
|
-
end
|
61
|
-
|
62
|
-
test 'within with css' do
|
63
|
-
element = within('#foo #bar') { locate(:a) }
|
64
|
-
assert_equal 'a', element.name
|
65
|
-
end
|
66
|
-
|
67
|
-
test 'nesting locate' do
|
68
|
-
element = locate(:id => 'foo') { locate(:id => 'bar') { locate(:a) } }
|
69
|
-
assert_equal 'a', element.name
|
70
|
-
end
|
71
|
-
|
72
|
-
test 'nesting within' do
|
73
|
-
element = within(:id => 'foo') { within(:id => 'bar') { locate(:a) } }
|
74
|
-
assert_equal 'a', element.name
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
class HtmlUnitWithNokogiriAdapterTest < Test::Unit::TestCase
|
79
|
-
include Steam, HtmlUnitTests
|
80
|
-
|
81
|
-
def setup
|
82
|
-
init
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
# class HtmlUnitWithHtmlUnitAdapterTest < Test::Unit::TestCase
|
87
|
-
# include Steam, HtmlUnitTests
|
88
|
-
#
|
89
|
-
# def setup
|
90
|
-
# @old_adapter, Locator::Dom.adapter = Locator::Dom.adapter, Locator::Dom::Htmlunit
|
91
|
-
# init
|
92
|
-
# end
|
93
|
-
#
|
94
|
-
# def teardown
|
95
|
-
# Locator::Dom.adapter = @old_adapter
|
96
|
-
# end
|
97
|
-
# end
|
98
|
-
|