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,45 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Spans" 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.spans(:class => "footer").to_a.should == [browser.span(:class => "footer")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of spans" do
20
- browser.spans.length.should == 6
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the p at the given index" do
26
- browser.spans[0].id.should == "lead"
27
- end
28
- end
29
-
30
- describe "#each" do
31
- it "iterates through spans correctly" do
32
- count = 0
33
-
34
- browser.spans.each_with_index do |s, index|
35
- s.id.should == browser.span(:index, index).id
36
- s.value.should == browser.span(:index, index).value
37
-
38
- count += 1
39
- end
40
-
41
- count.should > 0
42
- end
43
- end
44
-
45
- end
@@ -1,20 +0,0 @@
1
- # encoding: utf-8
2
- begin
3
- require "rubygems"
4
- rescue LoadError
5
- end
6
-
7
- require "sinatra/base"
8
- require "#{File.dirname(__FILE__)}/lib/watirspec"
9
- require "#{File.dirname(__FILE__)}/lib/implementation"
10
- require "#{File.dirname(__FILE__)}/lib/server"
11
- require "#{File.dirname(__FILE__)}/lib/runner"
12
- require "#{File.dirname(__FILE__)}/lib/guards"
13
-
14
- if __FILE__ == $0
15
- # this is needed in order to have a stable Server on Windows + MRI
16
- WatirSpec::Server.run!
17
- else
18
- WatirSpec::Runner.execute_if_necessary
19
- end
20
-
@@ -1,93 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Strong" 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 element exists" do
13
- browser.strong(:id, "descartes").should exist
14
- browser.strong(:id, /descartes/).should exist
15
- browser.strong(:text, "Dubito, ergo cogito, ergo sum.").should exist
16
- browser.strong(:text, /Dubito, ergo cogito, ergo sum/).should exist
17
- browser.strong(:class, "descartes").should exist
18
- browser.strong(:class, /descartes/).should exist
19
- browser.strong(:index, 0).should exist
20
- browser.strong(:xpath, "//strong[@id='descartes']").should exist
21
- end
22
-
23
- it "returns the first strong if given no args" do
24
- browser.strong.should exist
25
- end
26
-
27
- it "returns false if the element doesn't exist" do
28
- browser.strong(:id, "no_such_id").should_not exist
29
- browser.strong(:id, /no_such_id/).should_not exist
30
- browser.strong(:text, "no_such_text").should_not exist
31
- browser.strong(:text, /no_such_text/).should_not exist
32
- browser.strong(:class, "no_such_class").should_not exist
33
- browser.strong(:class, /no_such_class/).should_not exist
34
- browser.strong(:index, 1337).should_not exist
35
- browser.strong(:xpath, "//strong[@id='no_such_id']").should_not exist
36
- end
37
-
38
- it "raises TypeError when 'what' argument is invalid" do
39
- lambda { browser.strong(:id, 3.14).exists? }.should raise_error(TypeError)
40
- end
41
-
42
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
43
- lambda { browser.strong(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
44
- end
45
- end
46
-
47
- # Attribute methods
48
- describe "#class_name" do
49
- it "returns the class attribute" do
50
- browser.strong(:index, 0).class_name.should == 'descartes'
51
- end
52
-
53
- it "returns an empty string if the element exists and the attribute doesn't" do
54
- browser.strong(:index, 1).class_name.should == ''
55
- end
56
-
57
- it "raises UnknownObjectException if the element doesn't exist" do
58
- lambda { browser.strong(:id, 'no_such_id').class_name }.should raise_error(UnknownObjectException)
59
- end
60
- end
61
-
62
- describe "#id" do
63
- it "returns the id attribute" do
64
- browser.strong(:index, 0).id.should == "descartes"
65
- end
66
-
67
- it "raises UnknownObjectException if the element doesn't exist" do
68
- lambda { browser.strong(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
69
- lambda { browser.strong(:index, 1337).id }.should raise_error(UnknownObjectException)
70
- end
71
- end
72
-
73
- describe "#text" do
74
- it "returns the text of the element" do
75
- browser.strong(:index, 0).text.should == "Dubito, ergo cogito, ergo sum."
76
- end
77
-
78
- it "raises UnknownObjectException if the element doesn't exist" do
79
- lambda { browser.strong(:id, 'no_such_id').text }.should raise_error( UnknownObjectException)
80
- lambda { browser.strong(:xpath , "//strong[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
81
- end
82
- end
83
-
84
- describe "#respond_to?" do
85
- it "returns true for all attribute methods" do
86
- browser.strong(:index, 0).should respond_to(:class_name)
87
- browser.strong(:index, 0).should respond_to(:id)
88
- browser.strong(:index, 0).should respond_to(:text)
89
- end
90
- end
91
-
92
- # Other
93
- end
@@ -1,46 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Strongs" 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.strongs(:class => "descartes").to_a.should == [browser.strong(:class => "descartes")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of divs" do
20
- browser.strongs.length.should == 2
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the div at the given index" do
26
- browser.strongs[0].id.should == "descartes"
27
- end
28
- end
29
-
30
- describe "#each" do
31
- it "iterates through divs correctly" do
32
- count = 0
33
-
34
- browser.strongs.each_with_index do |s, index|
35
- strong = browser.strong(:index, index)
36
- s.id.should == strong.id
37
- s.class_name.should == strong.class_name
38
-
39
- count += 1
40
- end
41
-
42
- count.should > 0
43
- end
44
- end
45
-
46
- end
@@ -1,50 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Table" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/nested_tables.html")
8
- end
9
-
10
- it "returns the correct number of rows under a table" do
11
- tables = browser.div(:id => "table-rows-test").tables(:id => /^tbl/)
12
- tables.length.should > 0
13
-
14
- tables.each do |table|
15
- expected = Integer(table.data_row_count)
16
- actual = table.rows.length
17
- browser_count = Integer(table.data_browser_count)
18
-
19
- actual.should eql(expected), "expected #{expected} rows, got #{actual} for table id=#{table.id}, browser reported: #{browser_count}"
20
- end
21
- end
22
-
23
- it "returns the correct number of cells under a row" do
24
- rows = browser.div(:id => "row-cells-test").trs(:id => /^row/)
25
- rows.length.should > 0
26
-
27
- rows.each do |row|
28
- expected = Integer(row.data_cell_count)
29
- actual = row.cells.length
30
- browser_count = Integer(row.data_browser_count)
31
-
32
- actual.should eql(expected), "expected #{expected} cells, got #{actual} for row id=#{row.id}, browser reported: #{browser_count}"
33
- end
34
- end
35
-
36
- it "returns the correct number of rows under a table section" do
37
- tbodies = browser.table(:id => "tbody-rows-test").tbodys(:id => /^body/)
38
- tbodies.length.should > 0
39
-
40
- tbodies.each do |tbody|
41
- expected = Integer(tbody.data_rows_count)
42
- actual = tbody.rows.count
43
- browser_count = Integer(tbody.data_browser_count)
44
-
45
- actual.should eql(expected), "expected #{expected} rows, got #{actual} for tbody id=#{tbody.id}, browser reported: #{browser_count}"
46
- end
47
- end
48
-
49
-
50
- end
@@ -1,150 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Table" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/tables.html")
8
- end
9
-
10
- # Exists
11
- describe "#exists?" do
12
- it "returns true if the table exists" do
13
- browser.table(:id, 'axis_example').should exist
14
- browser.table(:id, /axis_example/).should exist
15
- browser.table(:index, 0).should exist
16
- browser.table(:xpath, "//table[@id='axis_example']").should exist
17
- end
18
-
19
- it "returns the first table if given no args" do
20
- browser.table.should exist
21
- end
22
-
23
- it "returns false if the table does not exist" do
24
- browser.table(:id, 'no_such_id').should_not exist
25
- browser.table(:id, /no_such_id/).should_not exist
26
- browser.table(:index, 1337).should_not exist
27
- browser.table(:xpath, "//table[@id='no_such_id']").should_not exist
28
- end
29
-
30
- it "checks the tag name when locating by xpath" do
31
- browser.table(:xpath, "//table//td").should_not exist
32
- browser.table(:xpath, "//table").should exist
33
- end
34
-
35
- it "raises TypeError when 'what' argument is invalid" do
36
- lambda { browser.table(:id, 3.14).exists? }.should raise_error(TypeError)
37
- end
38
-
39
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
40
- lambda { browser.table(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
41
- end
42
- end
43
-
44
- # Other
45
- describe "#strings" do
46
- it "returns a two-dimensional array representation of the table" do
47
- browser.table(:id, 'inner').strings.should == [
48
- ["Table 2, Row 1, Cell 1",
49
- "Table 2, Row 1, Cell 2"]
50
- ]
51
-
52
- browser.table(:id, 'outer').strings.should == [
53
- ["Table 1, Row 1, Cell 1", "Table 1, Row 1, Cell 2"],
54
- ["Table 1, Row 2, Cell 1", "Table 1, Row 2, Cell 2 Table 2, Row 1, Cell 1 Table 2, Row 1, Cell 2"],
55
- ["Table 1, Row 3, Cell 1", "Table 1, Row 3, Cell 2"]
56
- ]
57
- end
58
- end
59
-
60
- describe "#hashes" do
61
- it "returns an Array of Hashes for the common table usage" do
62
- browser.table(:id => "axis_example").hashes.should == [
63
- { "" => "March 2008", "Before income tax" => "", "Income tax" => "", "After income tax" => "" },
64
- { "" => "Gregory House", "Before income tax" => "5 934", "Income tax" => "1 347", "After income tax" => "4 587" },
65
- { "" => "Hugh Laurie", "Before income tax" => "6 300", "Income tax" => "1 479", "After income tax" => "4 821" },
66
- { "" => "April 2008", "Before income tax" => "", "Income tax" => "", "After income tax" => "" },
67
- { "" => "Gregory House", "Before income tax" => "5 863", "Income tax" => "1 331", "After income tax" => "4 532" },
68
- { "" => "Hugh Laurie", "Before income tax" => "6 252", "Income tax" => "1 420", "After income tax" => "4 832" },
69
- { "" => "Sum", "Before income tax" => "24 349", "Income tax" => "5 577", "After income tax" => "18 722"},
70
- ]
71
- end
72
-
73
- it "raises an error if the table could not be parsed" do
74
- pending
75
- end
76
- end
77
-
78
- describe "#click" do
79
- it "fires the table's onclick event" do
80
- browser.table(:id, 'inner').click
81
- messages.first.should == 'table'
82
- end
83
- end
84
-
85
- describe "#[]" do
86
- it "returns the nth child row" do
87
- browser.table(:id, 'outer')[0].id.should == "outer_first"
88
- browser.table(:id, 'inner')[0].id.should == "inner_first"
89
- browser.table(:id, 'outer')[2].id.should == "outer_last"
90
- end
91
-
92
- not_compliant_on :webdriver do
93
- it "raises UnknownRowException if the index is out of bounds" do
94
- lambda { browser.table(:id, 'outer')[1337] }.should raise_error(UnknownRowException)
95
- end
96
- end
97
- end
98
-
99
- describe "#row" do
100
- let(:table) { browser.table(:id, 'outer') }
101
-
102
- it "finds rows belonging to this table" do
103
- table.row(:id => "outer_last").should exist
104
- table.row(:text => /Table 1, Row 1, Cell 1/).should exist
105
- end
106
-
107
- it "does not find rows from a nested table" do
108
- table.row(:id => "inner_first").should_not exist
109
- table.row(:text => /^Table 2, Row 1, Cell 1 Table 2, Row 1, Cell 2$/).should_not exist
110
- end
111
- end
112
-
113
- describe "#rows" do
114
- it "finds the correct number of rows (excluding nested tables)" do
115
- browser.table(:id, 'inner').rows.length.should == 1
116
- browser.table(:id, 'outer').rows.length.should == 3
117
- end
118
-
119
- it "finds rows matching the selector" do
120
- rows = browser.table(:id, 'outer').rows(:id => /first|last/)
121
-
122
- rows.first.id.should == "outer_first"
123
- rows.last.id.should == "outer_last"
124
- end
125
-
126
- it "does not find rows from a nested table" do
127
- browser.table(:id, "outer").rows(:id => "t2_r1_c1").size.should == 0
128
- end
129
- end
130
-
131
- describe "#tbody" do
132
- it "returns the correct instance of TableSection" do
133
- body = browser.table(:index, 0).tbody(:id, 'first')
134
- body.should be_instance_of(TableSection)
135
- body[0][0].text.should == "March 2008"
136
- end
137
- end
138
-
139
- describe "#tbodys" do
140
- it "returns the correct instance of TableSection" do
141
- bodies = browser.table(:index, 0).tbodys
142
-
143
- bodies.should be_instance_of(TableSectionCollection)
144
-
145
- bodies[0].id.should == "first"
146
- bodies[1].id.should == "second"
147
- end
148
- end
149
-
150
- end
@@ -1,47 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Tables" 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.tables(:rules => "groups").to_a.should == [browser.table(:rules => "groups")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of tables" do
20
- browser.tables.length.should == 4
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the p at the given index" do
26
- browser.tables[0].id.should == "axis_example"
27
- browser.tables[1].id.should == "outer"
28
- browser.tables[2].id.should == "inner"
29
- end
30
- end
31
-
32
- describe "#each" do
33
- it "iterates through tables correctly" do
34
- count = 0
35
-
36
- browser.tables.each_with_index do |t, index|
37
- t.id.should == browser.table(:index, index).id
38
- t.value.should == browser.table(:index, index).value
39
-
40
- count += 1
41
- end
42
-
43
- count.should > 0
44
- end
45
- end
46
-
47
- end