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.
Files changed (93) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +3 -3
  3. data/Rakefile +3 -28
  4. data/lib/watir-webdriver.rb +1 -0
  5. data/lib/watir-webdriver/version.rb +3 -0
  6. data/watir-webdriver.gemspec +23 -247
  7. metadata +34 -326
  8. data/VERSION +0 -1
  9. data/spec/watirspec/area_spec.rb +0 -77
  10. data/spec/watirspec/areas_spec.rb +0 -45
  11. data/spec/watirspec/browser_spec.rb +0 -274
  12. data/spec/watirspec/button_spec.rb +0 -255
  13. data/spec/watirspec/buttons_spec.rb +0 -58
  14. data/spec/watirspec/checkbox_spec.rb +0 -276
  15. data/spec/watirspec/checkboxes_spec.rb +0 -47
  16. data/spec/watirspec/collections_spec.rb +0 -20
  17. data/spec/watirspec/dd_spec.rb +0 -127
  18. data/spec/watirspec/dds_spec.rb +0 -45
  19. data/spec/watirspec/del_spec.rb +0 -145
  20. data/spec/watirspec/dels_spec.rb +0 -45
  21. data/spec/watirspec/div_spec.rb +0 -221
  22. data/spec/watirspec/divs_spec.rb +0 -45
  23. data/spec/watirspec/dl_spec.rb +0 -137
  24. data/spec/watirspec/dls_spec.rb +0 -46
  25. data/spec/watirspec/dt_spec.rb +0 -127
  26. data/spec/watirspec/dts_spec.rb +0 -45
  27. data/spec/watirspec/element_spec.rb +0 -149
  28. data/spec/watirspec/em_spec.rb +0 -101
  29. data/spec/watirspec/ems_spec.rb +0 -46
  30. data/spec/watirspec/filefield_spec.rb +0 -156
  31. data/spec/watirspec/filefields_spec.rb +0 -46
  32. data/spec/watirspec/font_spec.rb +0 -32
  33. data/spec/watirspec/form_spec.rb +0 -63
  34. data/spec/watirspec/forms_spec.rb +0 -47
  35. data/spec/watirspec/frame_spec.rb +0 -144
  36. data/spec/watirspec/frames_spec.rb +0 -83
  37. data/spec/watirspec/hidden_spec.rb +0 -103
  38. data/spec/watirspec/hiddens_spec.rb +0 -46
  39. data/spec/watirspec/hn_spec.rb +0 -97
  40. data/spec/watirspec/hns_spec.rb +0 -42
  41. data/spec/watirspec/image_spec.rb +0 -208
  42. data/spec/watirspec/images_spec.rb +0 -45
  43. data/spec/watirspec/ins_spec.rb +0 -146
  44. data/spec/watirspec/inses_spec.rb +0 -45
  45. data/spec/watirspec/label_spec.rb +0 -81
  46. data/spec/watirspec/labels_spec.rb +0 -45
  47. data/spec/watirspec/li_spec.rb +0 -116
  48. data/spec/watirspec/lib/guards.rb +0 -59
  49. data/spec/watirspec/lib/implementation.rb +0 -48
  50. data/spec/watirspec/lib/runner.rb +0 -83
  51. data/spec/watirspec/lib/server.rb +0 -194
  52. data/spec/watirspec/lib/watirspec.rb +0 -75
  53. data/spec/watirspec/link_spec.rb +0 -174
  54. data/spec/watirspec/links_spec.rb +0 -49
  55. data/spec/watirspec/lis_spec.rb +0 -45
  56. data/spec/watirspec/map_spec.rb +0 -80
  57. data/spec/watirspec/maps_spec.rb +0 -46
  58. data/spec/watirspec/meta_spec.rb +0 -24
  59. data/spec/watirspec/metas_spec.rb +0 -43
  60. data/spec/watirspec/ol_spec.rb +0 -90
  61. data/spec/watirspec/ols_spec.rb +0 -45
  62. data/spec/watirspec/option_spec.rb +0 -152
  63. data/spec/watirspec/p_spec.rb +0 -132
  64. data/spec/watirspec/pre_spec.rb +0 -116
  65. data/spec/watirspec/pres_spec.rb +0 -45
  66. data/spec/watirspec/ps_spec.rb +0 -45
  67. data/spec/watirspec/radio_spec.rb +0 -262
  68. data/spec/watirspec/radios_spec.rb +0 -46
  69. data/spec/watirspec/select_list_spec.rb +0 -335
  70. data/spec/watirspec/select_lists_spec.rb +0 -49
  71. data/spec/watirspec/span_spec.rb +0 -146
  72. data/spec/watirspec/spans_spec.rb +0 -45
  73. data/spec/watirspec/spec_helper.rb +0 -20
  74. data/spec/watirspec/strong_spec.rb +0 -93
  75. data/spec/watirspec/strongs_spec.rb +0 -46
  76. data/spec/watirspec/table_nesting_spec.rb +0 -50
  77. data/spec/watirspec/table_spec.rb +0 -150
  78. data/spec/watirspec/tables_spec.rb +0 -47
  79. data/spec/watirspec/tbody_spec.rb +0 -97
  80. data/spec/watirspec/tbodys_spec.rb +0 -65
  81. data/spec/watirspec/td_spec.rb +0 -72
  82. data/spec/watirspec/tds_spec.rb +0 -60
  83. data/spec/watirspec/text_field_spec.rb +0 -283
  84. data/spec/watirspec/text_fields_spec.rb +0 -49
  85. data/spec/watirspec/tfoot_spec.rb +0 -92
  86. data/spec/watirspec/tfoots_spec.rb +0 -71
  87. data/spec/watirspec/thead_spec.rb +0 -92
  88. data/spec/watirspec/theads_spec.rb +0 -71
  89. data/spec/watirspec/tr_spec.rb +0 -88
  90. data/spec/watirspec/trs_spec.rb +0 -68
  91. data/spec/watirspec/ul_spec.rb +0 -80
  92. data/spec/watirspec/uls_spec.rb +0 -44
  93. data/spec/watirspec/window_switching_spec.rb +0 -164
@@ -1,75 +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.bind}:#{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 ||= (
39
- imp = WatirSpec::Implementation.new
40
- yield imp if block_given?
41
-
42
- imp
43
- )
44
- end
45
-
46
- def implementation=(imp)
47
- unless imp.kind_of? WatirSpec::Implementation
48
- raise TypeError, "expected WatirSpec::Implementation, got #{imp.class}"
49
- end
50
-
51
- @implementation = imp
52
- end
53
-
54
- def new_browser
55
- klass = WatirSpec.implementation.browser_class
56
- args = WatirSpec.implementation.browser_args
57
- args ? klass.new(*args) : klass.new
58
- end
59
-
60
- def ruby
61
- @ruby ||= (
62
- if defined?(Gem)
63
- Gem.ruby
64
- else
65
- require "rbconfig"
66
- rb = File.join(RbConfig::CONFIG.values_at('BINDIR', 'RUBY_INSTALL_NAME').compact)
67
- ext = RbConfig::CONFIG['EXEEXT']
68
-
69
- "#{rb}#{ext}"
70
- end
71
- )
72
- end
73
-
74
- end # class << WatirSpec
75
- end # WatirSpec
@@ -1,174 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
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
- not_compliant_on [:webdriver, :ie] do
20
- browser.link(:href, 'non_control_elements.html').should exist
21
- end
22
- browser.link(:href, /non_control_elements.html/).should exist
23
- browser.link(:index, 1).should exist
24
- browser.link(:xpath, "//a[@id='link_2']").should exist
25
- end
26
-
27
- it "returns the first link if given no args" do
28
- browser.link.should exist
29
- end
30
-
31
- it "strips spaces from href attribute when locating elements" do
32
- browser.link(:href, /strip_space$/).should exist
33
- end
34
-
35
- it "returns false if the link doesn't exist" do
36
- browser.link(:id, 'no_such_id').should_not exist
37
- browser.link(:id, /no_such_id/).should_not exist
38
- browser.link(:title, "no_such_title").should_not exist
39
- browser.link(:title, /no_such_title/).should_not exist
40
- browser.link(:text, "no_such_text").should_not exist
41
- browser.link(:text, /no_such_text/i).should_not exist
42
- browser.link(:href, 'no_such_href').should_not exist
43
- browser.link(:href, /no_such_href/).should_not exist
44
- browser.link(:index, 1337).should_not exist
45
- browser.link(:xpath, "//a[@id='no_such_id']").should_not exist
46
- end
47
-
48
- it "raises TypeError when 'what' argument is invalid" do
49
- lambda { browser.link(:id, 3.14).exists? }.should raise_error(TypeError)
50
- end
51
-
52
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
53
- lambda { browser.link(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
54
- end
55
- end
56
-
57
- # Attribute methods
58
- describe "#class_name" do
59
- it "returns the type attribute if the link exists" do
60
- browser.link(:index, 1).class_name.should == "external"
61
- end
62
-
63
- it "returns an empty string if the link exists and the attribute doesn't" do
64
- browser.link(:index, 0).class_name.should == ''
65
- end
66
-
67
- it "raises an UnknownObjectException if the link doesn't exist" do
68
- lambda { browser.link(:index, 1337).class_name }.should raise_error(UnknownObjectException)
69
- end
70
- end
71
-
72
- describe "#href" do
73
- it "returns the href attribute if the link exists" do
74
- browser.link(:index, 1).href.should =~ /non_control_elements/
75
- end
76
-
77
- it "returns an empty string if the link exists and the attribute doesn't" do
78
- browser.link(:index, 0).href.should == ""
79
- end
80
-
81
- it "raises an UnknownObjectException if the link doesn't exist" do
82
- lambda { browser.link(:index, 1337).href }.should raise_error(UnknownObjectException)
83
- end
84
- end
85
-
86
- describe "#href" do
87
- it "returns the href attribute" do
88
- browser.link(:index, 1).href.should =~ /non_control_elements/
89
- end
90
- end
91
-
92
- describe "#id" do
93
- it "returns the id attribute if the link exists" do
94
- browser.link(:index, 1).id.should == "link_2"
95
- end
96
-
97
- it "returns an empty string if the link exists and the attribute doesn't" do
98
- browser.link(:index, 0).id.should == ""
99
- end
100
-
101
- it "raises an UnknownObjectException if the link doesn't exist" do
102
- lambda { browser.link(:index, 1337).id }.should raise_error(UnknownObjectException)
103
- end
104
- end
105
-
106
- describe "#text" do
107
- it "returns the link text" do
108
- browser.link(:index, 1).text.should == "Link 2"
109
- end
110
-
111
- it "returns an empty string if the link exists and contains no text" do
112
- browser.link(:index, 0).text.should == ""
113
- end
114
-
115
- it "raises an UnknownObjectException if the link doesn't exist" do
116
- lambda { browser.link(:index, 1337).text }.should raise_error(UnknownObjectException)
117
- end
118
- end
119
-
120
- describe "#title" do
121
- it "returns the type attribute if the link exists" do
122
- browser.link(:index, 1).title.should == "link_title_2"
123
- end
124
-
125
- it "returns an empty string if the link exists and the attribute doesn't" do
126
- browser.link(:index, 0).title.should == ""
127
- end
128
-
129
- it "raises an UnknownObjectException if the link doesn't exist" do
130
- lambda { browser.link(:index, 1337).title }.should raise_error(UnknownObjectException)
131
- end
132
- end
133
-
134
- describe "#respond_to?" do
135
- it "returns true for all attribute methods" do
136
- browser.link(:index, 0).should respond_to(:class_name)
137
- browser.link(:index, 0).should respond_to(:href)
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 clicks 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 clicks it" do
153
- browser.link(:href, /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 clicks 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
- it "clicks a link with no text content but an img child" do
167
- browser.goto "#{WatirSpec.files}/images.html"
168
- browser.link(:href => /definition_lists.html/).click
169
- browser.title.should == 'definition_lists'
170
- end
171
-
172
- end
173
-
174
- end
@@ -1,49 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Links" 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.links(:title => "link_title_2").to_a.should == [browser.link(:title => "link_title_2")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of links" do
20
- browser.links.length.should == 4
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the link at the given index" do
26
- browser.links[2].id.should == "link_3"
27
- end
28
-
29
- it "returns a Link object also when the index is out of bounds" do
30
- browser.links[2000].should_not be_nil
31
- end
32
- end
33
-
34
- describe "#each" do
35
- it "iterates through links correctly" do
36
- count = 0
37
-
38
- browser.links.each_with_index do |c, index|
39
- c.id.should == browser.link(:index, index).id
40
- c.value.should == browser.link(:index, index).value
41
-
42
- count += 1
43
- end
44
-
45
- count.should > 0
46
- end
47
- end
48
-
49
- end
@@ -1,45 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Lis" 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.lis(:class => "nonlink").to_a.should == [browser.li(:class => "nonlink")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of lis" do
20
- browser.lis.length.should == 18
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the li at the given index" do
26
- browser.lis[4].id.should == "non_link_1"
27
- end
28
- end
29
-
30
- describe "#each" do
31
- it "iterates through lis correctly" do
32
- count = 0
33
-
34
- browser.lis.each_with_index do |l, index|
35
- l.id.should == browser.li(:index, index).id
36
- l.value.should == browser.li(:index, index).value
37
-
38
- count += 1
39
- end
40
-
41
- count.should > 0
42
- end
43
- end
44
-
45
- end
@@ -1,80 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Map" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/images.html")
8
- end
9
-
10
- # Exists method
11
- describe "#exist?" do
12
- it "returns true if the 'map' exists" do
13
- browser.map(:id, "triangle_map").should exist
14
- browser.map(:id, /triangle_map/).should exist
15
- browser.map(:name, "triangle_map").should exist
16
- browser.map(:name, /triangle_map/).should exist
17
- browser.map(:index, 0).should exist
18
- browser.map(:xpath, "//map[@id='triangle_map']").should exist
19
- end
20
-
21
- it "returns the first map if given no args" do
22
- browser.map.should exist
23
- end
24
-
25
- it "returns false if the 'map' doesn't exist" do
26
- browser.map(:id, "no_such_id").should_not exist
27
- browser.map(:id, /no_such_id/).should_not exist
28
- browser.map(:name, "no_such_id").should_not exist
29
- browser.map(:name, /no_such_id/).should_not exist
30
- browser.map(:index, 1337).should_not exist
31
- browser.map(:xpath, "//map[@id='no_such_id']").should_not exist
32
- end
33
-
34
- it "raises TypeError when 'what' argument is invalid" do
35
- lambda { browser.map(:id, 3.14).exists? }.should raise_error(TypeError)
36
- end
37
-
38
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
39
- lambda { browser.map(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
40
- end
41
- end
42
-
43
- # Attribute methods
44
- describe "#id" do
45
- it "returns the id attribute" do
46
- browser.map(:index, 0).id.should == "triangle_map"
47
- end
48
-
49
- it "returns an empty string if the element exists and the attribute doesn't" do
50
- browser.map(:index, 1).id.should == ''
51
- end
52
-
53
- it "raises UnknownObjectException if the p doesn't exist" do
54
- lambda { browser.map(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
55
- lambda { browser.map(:index, 1337).id }.should raise_error(UnknownObjectException)
56
- end
57
- end
58
-
59
- describe "#name" do
60
- it "returns the name attribute" do
61
- browser.map(:index, 0).name.should == "triangle_map"
62
- end
63
-
64
- it "returns an empty string if the element exists and the attribute doesn't" do
65
- browser.map(:index, 1).name.should == ''
66
- end
67
-
68
- it "raises UnknownObjectException if the map doesn't exist" do
69
- lambda { browser.map(:id, "no_such_id").name }.should raise_error(UnknownObjectException)
70
- lambda { browser.map(:index, 1337).name }.should raise_error(UnknownObjectException)
71
- end
72
- end
73
-
74
- describe "#respond_to?" do
75
- it "returns true for all attribute methods" do
76
- browser.map(:index, 0).should respond_to(:id)
77
- browser.map(:index, 0).should respond_to(:name)
78
- end
79
- end
80
- end
@@ -1,46 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Maps" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/images.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.maps(:name => "triangle_map").to_a.should == [browser.map(:name => "triangle_map")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of maps" do
20
- browser.maps.length.should == 2
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the p at the given index" do
26
- browser.maps[0].id.should == "triangle_map"
27
- end
28
- end
29
-
30
- describe "#each" do
31
- it "iterates through maps correctly" do
32
- count = 0
33
-
34
- browser.maps.each_with_index do |m, index|
35
- m.name.should == browser.map(:index, index).name
36
- m.id.should == browser.map(:index, index).id
37
- m.value.should == browser.map(:index, index).value
38
-
39
- count += 1
40
- end
41
-
42
- count.should > 0
43
- end
44
- end
45
-
46
- end