watir-webdriver 0.0.1.dev5 → 0.0.1.dev6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +13 -19
- data/VERSION +1 -1
- data/lib/watir-webdriver.rb +3 -1
- data/lib/watir-webdriver/base_element.rb +33 -27
- data/lib/watir-webdriver/browser.rb +2 -6
- data/lib/watir-webdriver/elements/font.rb +12 -0
- data/lib/watir-webdriver/elements/generated.rb +1027 -622
- data/lib/watir-webdriver/elements/select_list.rb +3 -3
- data/lib/watir-webdriver/locators/element_locator.rb +2 -2
- data/lib/watir-webdriver/xpath_support.rb +2 -2
- data/support/html5/html5.idl +942 -483
- data/support/html5/old/html5.idl +962 -0
- data/support/html5/{html5_extras.idl → old/html5_extras.idl} +0 -2
- data/support/html5/watir_visitor.rb +23 -19
- metadata +74 -100
- data/spec/watirspec/area_spec.rb +0 -78
- data/spec/watirspec/areas_spec.rb +0 -31
- data/spec/watirspec/browser_spec.rb +0 -274
- data/spec/watirspec/button_spec.rb +0 -242
- data/spec/watirspec/buttons_spec.rb +0 -48
- data/spec/watirspec/checkbox_spec.rb +0 -272
- data/spec/watirspec/checkboxes_spec.rb +0 -32
- data/spec/watirspec/dd_spec.rb +0 -123
- data/spec/watirspec/dds_spec.rb +0 -31
- data/spec/watirspec/div_spec.rb +0 -211
- data/spec/watirspec/divs_spec.rb +0 -31
- data/spec/watirspec/dl_spec.rb +0 -123
- data/spec/watirspec/dls_spec.rb +0 -32
- data/spec/watirspec/dt_spec.rb +0 -123
- data/spec/watirspec/dts_spec.rb +0 -31
- data/spec/watirspec/element_spec.rb +0 -89
- data/spec/watirspec/em_spec.rb +0 -97
- data/spec/watirspec/ems_spec.rb +0 -32
- data/spec/watirspec/filefield_spec.rb +0 -119
- data/spec/watirspec/filefields_spec.rb +0 -32
- data/spec/watirspec/form_spec.rb +0 -63
- data/spec/watirspec/forms_spec.rb +0 -33
- data/spec/watirspec/frame_spec.rb +0 -129
- data/spec/watirspec/frames_spec.rb +0 -62
- data/spec/watirspec/hidden_spec.rb +0 -102
- data/spec/watirspec/hiddens_spec.rb +0 -32
- data/spec/watirspec/hn_spec.rb +0 -93
- data/spec/watirspec/hns_spec.rb +0 -38
- data/spec/watirspec/image_spec.rb +0 -207
- data/spec/watirspec/images_spec.rb +0 -31
- data/spec/watirspec/label_spec.rb +0 -75
- data/spec/watirspec/labels_spec.rb +0 -31
- data/spec/watirspec/li_spec.rb +0 -112
- data/spec/watirspec/lib/guards.rb +0 -59
- data/spec/watirspec/lib/server.rb +0 -127
- data/spec/watirspec/lib/spec_helper.rb +0 -79
- data/spec/watirspec/lib/watirspec.rb +0 -72
- data/spec/watirspec/link_spec.rb +0 -168
- data/spec/watirspec/links_spec.rb +0 -35
- data/spec/watirspec/lis_spec.rb +0 -31
- data/spec/watirspec/map_spec.rb +0 -76
- data/spec/watirspec/maps_spec.rb +0 -32
- data/spec/watirspec/meta_spec.rb +0 -22
- data/spec/watirspec/metas_spec.rb +0 -30
- data/spec/watirspec/ol_spec.rb +0 -78
- data/spec/watirspec/ols_spec.rb +0 -31
- data/spec/watirspec/option_spec.rb +0 -173
- data/spec/watirspec/p_spec.rb +0 -128
- data/spec/watirspec/pre_spec.rb +0 -112
- data/spec/watirspec/pres_spec.rb +0 -31
- data/spec/watirspec/ps_spec.rb +0 -31
- data/spec/watirspec/radio_spec.rb +0 -255
- data/spec/watirspec/radios_spec.rb +0 -32
- data/spec/watirspec/select_list_spec.rb +0 -318
- data/spec/watirspec/select_lists_spec.rb +0 -35
- data/spec/watirspec/span_spec.rb +0 -142
- data/spec/watirspec/spans_spec.rb +0 -31
- data/spec/watirspec/spec_helper.rb +0 -17
- data/spec/watirspec/strong_spec.rb +0 -89
- data/spec/watirspec/strongs_spec.rb +0 -32
- data/spec/watirspec/table_bodies_spec.rb +0 -45
- data/spec/watirspec/table_body_spec.rb +0 -98
- data/spec/watirspec/table_cell_spec.rb +0 -68
- data/spec/watirspec/table_cells_spec.rb +0 -47
- data/spec/watirspec/table_footer_spec.rb +0 -85
- data/spec/watirspec/table_footers_spec.rb +0 -47
- data/spec/watirspec/table_header_spec.rb +0 -85
- data/spec/watirspec/table_headers_spec.rb +0 -45
- data/spec/watirspec/table_row_spec.rb +0 -87
- data/spec/watirspec/table_rows_spec.rb +0 -50
- data/spec/watirspec/table_spec.rb +0 -160
- data/spec/watirspec/tables_spec.rb +0 -33
- data/spec/watirspec/text_field_spec.rb +0 -276
- data/spec/watirspec/text_fields_spec.rb +0 -35
- data/spec/watirspec/ul_spec.rb +0 -76
- data/spec/watirspec/uls_spec.rb +0 -33
- data/support/html5/idl_extractor.rb +0 -73
@@ -1,59 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module WatirSpec
|
3
|
-
module Guards
|
4
|
-
|
5
|
-
class << self
|
6
|
-
def guards
|
7
|
-
@guards ||= Hash.new { |hash, key| hash[key] = [] }
|
8
|
-
end
|
9
|
-
|
10
|
-
def record(guard_name, impls, data)
|
11
|
-
impls.each do |impl|
|
12
|
-
guards[impl] << [guard_name, data]
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def report
|
17
|
-
gs = guards[WatirSpec.implementation]
|
18
|
-
print "\n\nWatirSpec guards for this implementation: "
|
19
|
-
|
20
|
-
if gs.empty?
|
21
|
-
puts "none."
|
22
|
-
else
|
23
|
-
puts
|
24
|
-
gs.each do |guard_name, data|
|
25
|
-
puts "\t#{guard_name.to_s.ljust(20)}: #{data.inspect}"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def deviates_on(*impls)
|
32
|
-
Guards.record :deviates, impls, :file => caller.first
|
33
|
-
return yield if WatirSpec.unguarded?
|
34
|
-
yield if impls.include? WatirSpec.implementation
|
35
|
-
end
|
36
|
-
|
37
|
-
def not_compliant_on(*impls)
|
38
|
-
Guards.record :not_compliant, impls, :file => caller.first
|
39
|
-
return yield if WatirSpec.unguarded?
|
40
|
-
yield unless impls.include? WatirSpec.implementation
|
41
|
-
end
|
42
|
-
|
43
|
-
def compliant_on(*impls)
|
44
|
-
Guards.record :compliant, impls, :file => caller.first
|
45
|
-
return yield if WatirSpec.unguarded?
|
46
|
-
yield if impls.include? WatirSpec.implementation
|
47
|
-
end
|
48
|
-
|
49
|
-
def bug(key, *impls)
|
50
|
-
Guards.record :bug, impls, :file => caller.first, :key => key
|
51
|
-
return yield if WatirSpec.unguarded?
|
52
|
-
yield unless impls.include? WatirSpec.implementation
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
class Object
|
58
|
-
include WatirSpec::Guards
|
59
|
-
end
|
@@ -1,127 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module WatirSpec
|
3
|
-
class Server < Sinatra::Base
|
4
|
-
class << self
|
5
|
-
attr_accessor :autorun
|
6
|
-
|
7
|
-
def run_async
|
8
|
-
case WatirSpec.platform
|
9
|
-
when :java
|
10
|
-
Thread.new { run! }
|
11
|
-
sleep 0.1 until WatirSpec::Server.running?
|
12
|
-
when :windows
|
13
|
-
require "win32/process"
|
14
|
-
pid = Process.create(
|
15
|
-
:app_name => "#{WatirSpec.ruby} #{File.dirname(__FILE__)}/../spec_helper.rb",
|
16
|
-
:process_inherit => true,
|
17
|
-
:thread_inherit => true,
|
18
|
-
:inherit => true
|
19
|
-
).process_id
|
20
|
-
else
|
21
|
-
pid = fork { run! }
|
22
|
-
sleep 1
|
23
|
-
end
|
24
|
-
|
25
|
-
if pid
|
26
|
-
# is this really necessary?
|
27
|
-
at_exit {
|
28
|
-
begin
|
29
|
-
Process.kill 0, pid
|
30
|
-
alive = true
|
31
|
-
rescue Errno::ESRCH
|
32
|
-
alive = false
|
33
|
-
end
|
34
|
-
|
35
|
-
Process.kill(9, pid) if alive
|
36
|
-
}
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def run!
|
41
|
-
handler = detect_rack_handler
|
42
|
-
handler.run(self, :Host => host, :Port => port) { @running = true }
|
43
|
-
end
|
44
|
-
|
45
|
-
def autorun
|
46
|
-
@autorun ||= true
|
47
|
-
end
|
48
|
-
|
49
|
-
def should_run?
|
50
|
-
autorun && !running?
|
51
|
-
end
|
52
|
-
|
53
|
-
def running?
|
54
|
-
defined?(@running) && @running
|
55
|
-
end
|
56
|
-
end # class << Server
|
57
|
-
|
58
|
-
set :public, WatirSpec.html
|
59
|
-
set :static, true
|
60
|
-
set :run, false
|
61
|
-
set :environment, :production
|
62
|
-
set :host, "localhost" if WatirSpec.platform == :windows
|
63
|
-
set :port, 2000
|
64
|
-
set :server, %w[mongrel webrick]
|
65
|
-
|
66
|
-
get '/' do
|
67
|
-
self.class.name
|
68
|
-
end
|
69
|
-
|
70
|
-
post '/post_to_me' do
|
71
|
-
"You posted the following content:\n#{ env['rack.input'].read }"
|
72
|
-
end
|
73
|
-
|
74
|
-
get '/plain_text' do
|
75
|
-
content_type 'text/plain'
|
76
|
-
'This is text/plain'
|
77
|
-
end
|
78
|
-
|
79
|
-
get '/ajax' do
|
80
|
-
sleep 10
|
81
|
-
"A slooow ajax response"
|
82
|
-
end
|
83
|
-
|
84
|
-
get '/charset_mismatch' do
|
85
|
-
content_type 'text/html; charset=UTF-8'
|
86
|
-
<<-HTML
|
87
|
-
<html>
|
88
|
-
<head>
|
89
|
-
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
|
90
|
-
</head>
|
91
|
-
<body>
|
92
|
-
<h1>ø</h1>
|
93
|
-
</body>
|
94
|
-
</html>
|
95
|
-
HTML
|
96
|
-
end
|
97
|
-
|
98
|
-
get '/octet_stream' do
|
99
|
-
content_type 'application/octet-stream'
|
100
|
-
'This is application/octet-stream'
|
101
|
-
end
|
102
|
-
|
103
|
-
get '/set_cookie' do
|
104
|
-
content_type 'text/plain'
|
105
|
-
headers 'Set-Cookie' => "monster=/"
|
106
|
-
|
107
|
-
"C is for cookie, it's good enough for me"
|
108
|
-
end
|
109
|
-
|
110
|
-
get '/header_echo' do
|
111
|
-
content_type 'text/plain'
|
112
|
-
env.inspect
|
113
|
-
end
|
114
|
-
|
115
|
-
get '/authentication' do
|
116
|
-
auth = Rack::Auth::Basic::Request.new(env)
|
117
|
-
|
118
|
-
unless auth.provided? && auth.credentials == %w[foo bar]
|
119
|
-
headers 'WWW-Authenticate' => %(Basic realm="localhost")
|
120
|
-
halt 401, 'Authorization Required'
|
121
|
-
end
|
122
|
-
|
123
|
-
"ok"
|
124
|
-
end
|
125
|
-
|
126
|
-
end # Server
|
127
|
-
end # WatirSpec
|
@@ -1,79 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module WatirSpec
|
3
|
-
module SpecHelper
|
4
|
-
|
5
|
-
module BrowserHelper
|
6
|
-
def browser; @browser; end
|
7
|
-
end
|
8
|
-
|
9
|
-
module PersistentBrowserHelper
|
10
|
-
def browser; $browser; end
|
11
|
-
end
|
12
|
-
|
13
|
-
module MessagesHelper
|
14
|
-
def messages
|
15
|
-
browser.div(:id, 'messages').divs.map { |d| d.text }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
module_function
|
20
|
-
|
21
|
-
def execute
|
22
|
-
load_requires
|
23
|
-
configure
|
24
|
-
start_server
|
25
|
-
add_guard_hook
|
26
|
-
end
|
27
|
-
|
28
|
-
def configure
|
29
|
-
Thread.abort_on_exception = true
|
30
|
-
|
31
|
-
Spec::Runner.configure do |config|
|
32
|
-
config.include(MessagesHelper)
|
33
|
-
|
34
|
-
if WatirSpec.persistent_browser == false
|
35
|
-
config.include(BrowserHelper)
|
36
|
-
|
37
|
-
config.before(:all) { @browser = WatirSpec.new_browser }
|
38
|
-
config.after(:all) { @browser.close if @browser }
|
39
|
-
else
|
40
|
-
config.include(PersistentBrowserHelper)
|
41
|
-
$browser = WatirSpec.new_browser
|
42
|
-
at_exit { $browser.close }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def load_requires
|
48
|
-
# load spec_helper from containing folder, if it exists
|
49
|
-
hook = File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper.rb")
|
50
|
-
raise(Errno::ENOENT, hook) unless File.exist?(hook)
|
51
|
-
|
52
|
-
load hook
|
53
|
-
require "fileutils"
|
54
|
-
require "spec"
|
55
|
-
|
56
|
-
begin
|
57
|
-
require "ruby-debug"
|
58
|
-
Debugger.start
|
59
|
-
Debugger.settings[:autoeval] = true
|
60
|
-
Debugger.settings[:autolist] = 1
|
61
|
-
rescue LoadError
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def start_server
|
66
|
-
if WatirSpec::Server.should_run?
|
67
|
-
WatirSpec::Server.run_async
|
68
|
-
else
|
69
|
-
$stderr.puts "not running WatirSpec::Server"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def add_guard_hook
|
74
|
-
return if WatirSpec.unguarded?
|
75
|
-
at_exit { WatirSpec::Guards.report }
|
76
|
-
end
|
77
|
-
|
78
|
-
end # SpecHelper
|
79
|
-
end # WatirSpec
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module WatirSpec
|
3
|
-
class << self
|
4
|
-
attr_accessor :browser_args, :persistent_browser, :unguarded, :implementation
|
5
|
-
|
6
|
-
def html
|
7
|
-
File.expand_path("#{File.dirname(__FILE__)}/../html")
|
8
|
-
end
|
9
|
-
|
10
|
-
def files
|
11
|
-
"file://#{html}"
|
12
|
-
end
|
13
|
-
|
14
|
-
def host
|
15
|
-
"http://#{Server.host}:#{Server.port}"
|
16
|
-
end
|
17
|
-
|
18
|
-
def unguarded?
|
19
|
-
@unguarded ||= false
|
20
|
-
end
|
21
|
-
|
22
|
-
def platform
|
23
|
-
@platform ||= case RUBY_PLATFORM
|
24
|
-
when /java/
|
25
|
-
:java
|
26
|
-
when /mswin|msys|mingw32/
|
27
|
-
:windows
|
28
|
-
when /darwin/
|
29
|
-
:macosx
|
30
|
-
when /linux/
|
31
|
-
:linux
|
32
|
-
else
|
33
|
-
RUBY_PLATFORM
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def implementation
|
38
|
-
@implementation ||= case Browser.name
|
39
|
-
when "Watir::IE"
|
40
|
-
:watir
|
41
|
-
when "Watir::Firefox", "FireWatir::Firefox"
|
42
|
-
:firewatir
|
43
|
-
when "Celerity::Browser"
|
44
|
-
:celerity
|
45
|
-
else
|
46
|
-
:unknown
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def new_browser
|
51
|
-
args = WatirSpec.browser_args
|
52
|
-
args ? Browser.new(*args) : Browser.new
|
53
|
-
end
|
54
|
-
|
55
|
-
def ruby
|
56
|
-
if @ruby.nil?
|
57
|
-
if defined?(Gem)
|
58
|
-
@ruby = Gem.ruby
|
59
|
-
else
|
60
|
-
require "rbconfig"
|
61
|
-
rb = File.join(RbConfig::CONFIG.values_at('BINDIR', 'RUBY_INSTALL_NAME').compact)
|
62
|
-
ext = RbConfig::CONFIG['EXEEXT']
|
63
|
-
|
64
|
-
@ruby = "#{rb}#{ext}"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
@ruby
|
69
|
-
end
|
70
|
-
|
71
|
-
end # class << WatirSpec
|
72
|
-
end # WatirSpec
|
data/spec/watirspec/link_spec.rb
DELETED
@@ -1,168 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "Link" 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 link exists" do
|
13
|
-
browser.link(:id, 'link_2').should exist
|
14
|
-
browser.link(:id, /link_2/).should exist
|
15
|
-
browser.link(:title, "link_title_2").should exist
|
16
|
-
browser.link(:title, /link_title_2/).should exist
|
17
|
-
browser.link(:text, "Link 2").should exist
|
18
|
-
browser.link(:text, /Link 2/i).should exist
|
19
|
-
browser.link(:url, 'non_control_elements.html').should exist
|
20
|
-
browser.link(:url, /non_control_elements.html/).should exist
|
21
|
-
browser.link(:index, 1).should exist
|
22
|
-
browser.link(:xpath, "//a[@id='link_2']").should exist
|
23
|
-
end
|
24
|
-
|
25
|
-
not_compliant_on :webdriver do
|
26
|
-
# not a technical issue - just not sure if it's really the behaviour we want
|
27
|
-
it "strips spaces from URL attributes when locating elements" do
|
28
|
-
browser.link(:url, /strip_space$/).should exist
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
it "returns false if the link doesn't exist" do
|
33
|
-
browser.link(:id, 'no_such_id').should_not exist
|
34
|
-
browser.link(:id, /no_such_id/).should_not exist
|
35
|
-
browser.link(:title, "no_such_title").should_not exist
|
36
|
-
browser.link(:title, /no_such_title/).should_not exist
|
37
|
-
browser.link(:text, "no_such_text").should_not exist
|
38
|
-
browser.link(:text, /no_such_text/i).should_not exist
|
39
|
-
browser.link(:url, 'no_such_href').should_not exist
|
40
|
-
browser.link(:url, /no_such_href/).should_not exist
|
41
|
-
browser.link(:index, 1337).should_not exist
|
42
|
-
browser.link(:xpath, "//a[@id='no_such_id']").should_not exist
|
43
|
-
end
|
44
|
-
|
45
|
-
it "raises TypeError when 'what' argument is invalid" do
|
46
|
-
lambda { browser.link(:id, 3.14).exists? }.should raise_error(TypeError)
|
47
|
-
end
|
48
|
-
|
49
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
50
|
-
lambda { browser.link(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Attribute methods
|
55
|
-
describe "#class_name" do
|
56
|
-
it "returns the type attribute if the link exists" do
|
57
|
-
browser.link(:index, 1).class_name.should == "external"
|
58
|
-
end
|
59
|
-
|
60
|
-
it "returns an empty string if the link exists and the attribute doesn't" do
|
61
|
-
browser.link(:index, 0).class_name.should == ''
|
62
|
-
end
|
63
|
-
|
64
|
-
it "raises an UnknownObjectException if the link doesn't exist" do
|
65
|
-
lambda { browser.link(:index, 1337).class_name }.should raise_error(UnknownObjectException)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe "#href" do
|
70
|
-
it "returns the href attribute if the link exists" do
|
71
|
-
browser.link(:index, 1).href.should =~ /non_control_elements/
|
72
|
-
end
|
73
|
-
|
74
|
-
it "returns an empty string if the link exists and the attribute doesn't" do
|
75
|
-
browser.link(:index, 0).href.should == ""
|
76
|
-
end
|
77
|
-
|
78
|
-
it "raises an UnknownObjectException if the link doesn't exist" do
|
79
|
-
lambda { browser.link(:index, 1337).href }.should raise_error(UnknownObjectException)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
bug "WTR-366", :watir do
|
84
|
-
describe "#url" do
|
85
|
-
it "returns the href attribute" do
|
86
|
-
browser.link(:index, 1).url.should =~ /non_control_elements/
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe "#id" do
|
92
|
-
it "returns the id attribute if the link exists" do
|
93
|
-
browser.link(:index, 1).id.should == "link_2"
|
94
|
-
end
|
95
|
-
|
96
|
-
it "returns an empty string if the link exists and the attribute doesn't" do
|
97
|
-
browser.link(:index, 0).id.should == ""
|
98
|
-
end
|
99
|
-
|
100
|
-
it "raises an UnknownObjectException if the link doesn't exist" do
|
101
|
-
lambda { browser.link(:index, 1337).id }.should raise_error(UnknownObjectException)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
describe "#text" do
|
106
|
-
it "returns the link text" do
|
107
|
-
browser.link(:index, 1).text.should == "Link 2"
|
108
|
-
end
|
109
|
-
|
110
|
-
it "returns an empty string if the link exists and contains no text" do
|
111
|
-
browser.link(:index, 0).text.should == ""
|
112
|
-
end
|
113
|
-
|
114
|
-
it "raises an UnknownObjectException if the link doesn't exist" do
|
115
|
-
lambda { browser.link(:index, 1337).text }.should raise_error(UnknownObjectException)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
describe "#title" do
|
120
|
-
it "returns the type attribute if the link exists" do
|
121
|
-
browser.link(:index, 1).title.should == "link_title_2"
|
122
|
-
end
|
123
|
-
|
124
|
-
it "returns an empty string if the link exists and the attribute doesn't" do
|
125
|
-
browser.link(:index, 0).title.should == ""
|
126
|
-
end
|
127
|
-
|
128
|
-
it "raises an UnknownObjectException if the link doesn't exist" do
|
129
|
-
lambda { browser.link(:index, 1337).title }.should raise_error(UnknownObjectException)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
describe "#respond_to?" do
|
134
|
-
it "returns true for all attribute methods" do
|
135
|
-
browser.link(:index, 0).should respond_to(:class_name)
|
136
|
-
browser.link(:index, 0).should respond_to(:href)
|
137
|
-
browser.link(:index, 0).should respond_to(:url)
|
138
|
-
browser.link(:index, 0).should respond_to(:id)
|
139
|
-
browser.link(:index, 0).should respond_to(:style)
|
140
|
-
browser.link(:index, 0).should respond_to(:text)
|
141
|
-
browser.link(:index, 0).should respond_to(:title)
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
# Manipulation methods
|
146
|
-
describe "#click" do
|
147
|
-
it "finds an existing link by (:text, String) and click it" do
|
148
|
-
browser.link(:text, "Link 3").click
|
149
|
-
browser.text.include?("User administration").should be_true
|
150
|
-
end
|
151
|
-
|
152
|
-
it "finds an existing link by (:text, Regexp) and click it" do
|
153
|
-
browser.link(:url, /forms_with_input_elements/).click
|
154
|
-
browser.text.include?("User administration").should be_true
|
155
|
-
end
|
156
|
-
|
157
|
-
it "finds an existing link by (:index, Integer) and click it" do
|
158
|
-
browser.link(:index, 2).click
|
159
|
-
browser.text.include?("User administration").should be_true
|
160
|
-
end
|
161
|
-
|
162
|
-
it "raises an UnknownObjectException if the link doesn't exist" do
|
163
|
-
lambda { browser.link(:index, 1337).click }.should raise_error(UnknownObjectException)
|
164
|
-
end
|
165
|
-
|
166
|
-
end
|
167
|
-
|
168
|
-
end
|