watir-webdriver 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
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,49 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "TextFields" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/forms_with_input_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.text_fields(:name => "new_user_email").to_a.should == [browser.text_field(:name => "new_user_email")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of text fields" do
20
- browser.text_fields.length.should == 9
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the text field at the given index" do
26
- browser.text_fields[0].id.should == "new_user_first_name"
27
- browser.text_fields[1].id.should == "new_user_last_name"
28
- browser.text_fields[2].id.should == "new_user_email"
29
- end
30
- end
31
-
32
- describe "#each" do
33
- it "iterates through text fields correctly" do
34
- count = 0
35
-
36
- browser.text_fields.each_with_index do |r, index|
37
- r.name.should == browser.text_field(:index, index).name
38
- r.id.should == browser.text_field(:index, index).id
39
- r.value.should == browser.text_field(:index, index).value
40
-
41
- count += 1
42
- end
43
-
44
- count.should > 0
45
- end
46
- end
47
-
48
-
49
- end
@@ -1,92 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "TableFooter" do
5
- before :each do
6
- browser.goto(WatirSpec.files + "/tables.html")
7
- end
8
-
9
- describe "#exists?" do
10
- it "returns true if the table tfoot exists (page context)" do
11
- browser.tfoot(:id, 'tax_totals').should exist
12
- browser.tfoot(:id, /tax_totals/).should exist
13
- browser.tfoot(:index, 0).should exist
14
- browser.tfoot(:xpath, "//tfoot[@id='tax_totals']").should exist
15
- end
16
-
17
- it "returns true if the table tfoot exists (table context)" do
18
- browser.table(:index, 0).tfoot(:id, 'tax_totals').should exist
19
- browser.table(:index, 0).tfoot(:id, /tax_totals/).should exist
20
- browser.table(:index, 0).tfoot(:index, 0).should exist
21
- browser.table(:index, 0).tfoot(:xpath, "//tfoot[@id='tax_totals']").should exist
22
- end
23
-
24
- it "returns the first tfoot if given no args" do
25
- browser.tfoot.should exist
26
- end
27
-
28
- it "returns false if the table tfoot doesn't exist (page context)" do
29
- browser.tfoot(:id, 'no_such_id').should_not exist
30
- browser.tfoot(:id, /no_such_id/).should_not exist
31
- browser.tfoot(:index, 1337).should_not exist
32
- browser.tfoot(:xpath, "//tfoot[@id='no_such_id']").should_not exist
33
- end
34
-
35
- it "returns false if the table tfoot doesn't exist (table context)" do
36
- browser.table(:index, 0).tfoot(:id, 'no_such_id').should_not exist
37
- browser.table(:index, 0).tfoot(:id, /no_such_id/).should_not exist
38
- browser.table(:index, 0).tfoot(:index, 1337).should_not exist
39
- browser.table(:index, 0).tfoot(:xpath, "//tfoot[@id='no_such_id']").should_not exist
40
- end
41
-
42
- it "raises TypeError when 'what' argument is invalid" do
43
- lambda { browser.tfoot(:id, 3.14).exists? }.should raise_error(TypeError)
44
- lambda { browser.table(:index, 0).tfoot(:id, 3.14).exists? }.should raise_error(TypeError)
45
- end
46
-
47
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
48
- lambda { browser.tfoot(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
49
- lambda { browser.table(:index, 0).tfoot(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
50
- end
51
- end
52
-
53
- describe "#[]" do
54
- it "returns the row at the given index (page context)" do
55
- browser.tfoot(:id, 'tax_totals')[0].id.should == 'tfoot_row_1'
56
- browser.tfoot(:id, 'tax_totals')[0][1].text.should == '24 349'
57
- browser.tfoot(:id, 'tax_totals')[0][2].text.should == '5 577'
58
- end
59
-
60
- it "returns the row at the given index (table context)" do
61
- browser.table(:index, 0).tfoot(:id, 'tax_totals')[0].id.should == "tfoot_row_1"
62
- browser.table(:index, 0).tfoot(:id, 'tax_totals')[0][1].text.should == '24 349'
63
- browser.table(:index, 0).tfoot(:id, 'tax_totals')[0][2].text.should == '5 577'
64
- end
65
- end
66
-
67
- describe "#row" do
68
- it "finds the first row matching the selector" do
69
- row = browser.tfoot(:id, 'tax_totals').row(:id => "tfoot_row_1")
70
-
71
- row.id.should == "tfoot_row_1"
72
- end
73
- end
74
-
75
- describe "#rows" do
76
- it "finds rows matching the selector" do
77
- rows = browser.tfoot(:id, 'tax_totals').rows(:id => "tfoot_row_1")
78
-
79
- rows.size.should == 1
80
- rows.first.id.should == "tfoot_row_1"
81
- end
82
- end
83
-
84
- describe "#strings" do
85
- it "returns the text of child cells" do
86
- browser.tfoot(:id, 'tax_totals').strings.should == [
87
- ["Sum", "24 349", "5 577", "18 722"]
88
- ]
89
- end
90
- end
91
-
92
- end
@@ -1,71 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "TableFooters" do
5
- before :each do
6
- browser.goto(WatirSpec.files + "/tables.html")
7
- end
8
-
9
- bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
10
- describe "with selectors" do
11
- it "returns the matching elements" do
12
- browser.tfoots(:id => "tax_totals").to_a.should == [browser.tfoot(:id => "tax_totals")]
13
- end
14
- end
15
- end
16
-
17
- describe "#length" do
18
- it "returns the correct number of table tfoots (page context)" do
19
- browser.tfoots.length.should == 1
20
- end
21
-
22
- it "returns the correct number of table tfoots (table context)" do
23
- browser.table(:index, 0).tfoots.length.should == 1
24
- end
25
- end
26
-
27
- describe "#[]" do
28
- it "returns the row at the given index (page context)" do
29
- browser.tfoots[0].id.should == "tax_totals"
30
- end
31
-
32
- it "returns the row at the given index (table context)" do
33
- browser.table(:index, 0).tfoots[0].id.should == "tax_totals"
34
- end
35
- end
36
-
37
- describe "#each" do
38
- it "iterates through table tfoots correctly (page context)" do
39
- browser.tfoots.each_with_index do |tfoot, index|
40
- tfoot.id.should == browser.tfoot(:index, index).id
41
- end
42
- end
43
-
44
- describe "#each" do
45
- it "iterates through table tfoots correctly (page context)" do
46
- count = 0
47
-
48
- browser.tfoots.each_with_index do |tfoot, index|
49
- tfoot.id.should == browser.tfoot(:index, index).id
50
-
51
- count += 1
52
- end
53
-
54
- count.should > 0
55
- end
56
-
57
- it "iterates through table tfoots correctly (table context)" do
58
- table = browser.table(:index, 0)
59
- count = 0
60
-
61
- table.tfoots.each_with_index do |tfoot, index|
62
- tfoot.id.should == table.tfoot(:index, index).id
63
-
64
- count += 1
65
- end
66
-
67
- count.should > 0
68
- end
69
- end
70
- end
71
- end
@@ -1,92 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "TableHeader" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/tables.html")
8
- end
9
-
10
- describe "#exists?" do
11
- it "returns true if the table theader exists (page context)" do
12
- browser.thead(:id, 'tax_headers').should exist
13
- browser.thead(:id, /tax_headers/).should exist
14
- browser.thead(:index, 0).should exist
15
- browser.thead(:xpath, "//thead[@id='tax_headers']").should exist
16
- end
17
-
18
- it "returns the first thead if given no args" do
19
- browser.thead.should exist
20
- end
21
-
22
- it "returns true if the table theader exists (table context)" do
23
- browser.table(:index, 0).thead(:id, 'tax_headers').should exist
24
- browser.table(:index, 0).thead(:id, /tax_headers/).should exist
25
- browser.table(:index, 0).thead(:index, 0).should exist
26
- browser.table(:index, 0).thead(:xpath, "//thead[@id='tax_headers']").should exist
27
- end
28
-
29
- it "returns false if the table theader doesn't exist (page context)" do
30
- browser.thead(:id, 'no_such_id').should_not exist
31
- browser.thead(:id, /no_such_id/).should_not exist
32
- browser.thead(:index, 1337).should_not exist
33
- browser.thead(:xpath, "//thead[@id='no_such_id']").should_not exist
34
- end
35
-
36
- it "returns false if the table theader doesn't exist (table context)" do
37
- browser.table(:index, 0).thead(:id, 'no_such_id').should_not exist
38
- browser.table(:index, 0).thead(:id, /no_such_id/).should_not exist
39
- browser.table(:index, 0).thead(:index, 1337).should_not exist
40
- browser.table(:index, 0).thead(:xpath, "//thead[@id='no_such_id']").should_not exist
41
- end
42
-
43
- it "raises TypeError when 'what' argument is invalid" do
44
- lambda { browser.thead(:id, 3.14).exists? }.should raise_error(TypeError)
45
- lambda { browser.table(:index, 0).thead(:id, 3.14).exists? }.should raise_error(TypeError)
46
- end
47
-
48
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
49
- lambda { browser.thead(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
50
- lambda { browser.table(:index, 0).thead(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
51
- end
52
- end
53
-
54
- describe "#[]" do
55
- it "returns the row at the given index (page context)" do
56
- browser.thead(:id, 'tax_headers')[0].id.should == 'thead_row_1'
57
- browser.thead(:id, 'tax_headers')[0][1].text.should == 'Before income tax'
58
- browser.thead(:id, 'tax_headers')[0][2].text.should == 'Income tax'
59
- end
60
-
61
- it "returns the row at the given index (table context)" do
62
- browser.table(:index, 0).thead(:id, 'tax_headers')[0].id.should == 'thead_row_1'
63
- browser.table(:index, 0).thead(:id, 'tax_headers')[0][1].text.should == 'Before income tax'
64
- browser.table(:index, 0).thead(:id, 'tax_headers')[0][2].text.should == 'Income tax'
65
- end
66
- end
67
-
68
- describe "#row" do
69
- it "finds the first row matching the selector" do
70
- row = browser.thead(:id, 'tax_headers').row(:class => "dark")
71
- row.id.should == "thead_row_1"
72
- end
73
- end
74
-
75
- describe "#rows" do
76
- it "finds rows matching the selector" do
77
- rows = browser.thead(:id, 'tax_headers').rows(:class => "dark")
78
-
79
- rows.size.should == 1
80
- rows.first.id.should == "thead_row_1"
81
- end
82
- end
83
-
84
- describe "#strings" do
85
- it "returns the text of child cells" do
86
- browser.thead(:id, 'tax_headers').strings.should == [
87
- ["", "Before income tax", "Income tax", "After income tax"]
88
- ]
89
- end
90
- end
91
-
92
- end
@@ -1,71 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "TableHeaders" do
5
- before :each do
6
- browser.goto(WatirSpec.files + "/tables.html")
7
- end
8
-
9
- bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
10
- describe "with selectors" do
11
- it "returns the matching elements" do
12
- browser.theads(:id => "tax_headers").to_a.should == [browser.thead(:id => "tax_headers")]
13
- end
14
- end
15
- end
16
-
17
- describe "#length" do
18
- it "returns the correct number of table theads (page context)" do
19
- browser.theads.length.should == 1
20
- end
21
-
22
- it "returns the correct number of table theads (table context)" do
23
- browser.table(:index, 0).theads.length.should == 1
24
- end
25
- end
26
-
27
- describe "#[]" do
28
- it "returns the row at the given index (page context)" do
29
- browser.theads[0].id.should == "tax_headers"
30
- end
31
-
32
- it "returns the row at the given index (table context)" do
33
- browser.table(:index, 0).theads[0].id.should == "tax_headers"
34
- end
35
- end
36
-
37
- describe "#each" do
38
- it "iterates through table theads correctly (page context)" do
39
- browser.theads.each_with_index do |thead, index|
40
- thead.id.should == browser.thead(:index, index).id
41
- end
42
- end
43
-
44
- describe "#each" do
45
- it "iterates through table theads correctly (page context)" do
46
- count = 0
47
-
48
- browser.theads.each_with_index do |thead, index|
49
- thead.id.should == browser.thead(:index, index).id
50
-
51
- count += 1
52
- end
53
-
54
- count.should > 0
55
- end
56
-
57
- it "iterates through table theads correctly (table context)" do
58
- table = browser.table(:index, 0)
59
- count = 0
60
-
61
- table.theads.each_with_index do |thead, index|
62
- thead.id.should == table.thead(:index, index).id
63
-
64
- count += 1
65
- end
66
-
67
- count.should > 0
68
- end
69
- end
70
- end
71
- end
@@ -1,88 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "TableRow" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/tables.html")
8
- end
9
-
10
- describe "#exists?" do
11
- it "returns true if the table row exists" do
12
- browser.tr(:id, "outer_first").should exist
13
- browser.tr(:id, /outer_first/).should exist
14
- browser.tr(:index, 0).should exist
15
- browser.tr(:xpath, "//tr[@id='outer_first']")
16
- end
17
-
18
- it "returns the first row if given no args" do
19
- browser.tr.should exist
20
- end
21
-
22
- it "returns false if the table row doesn't exist" do
23
- browser.tr(:id, "no_such_id").should_not exist
24
- browser.tr(:id, /no_such_id/).should_not exist
25
- browser.tr(:index, 1337).should_not exist
26
- browser.tr(:xpath, "//tr[@id='no_such_id']")
27
- end
28
-
29
- it "raises TypeError when 'what' argument is invalid" do
30
- lambda { browser.tr(:id, 3.14).exists? }.should raise_error(TypeError)
31
- end
32
-
33
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
34
- lambda { browser.tr(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
35
- end
36
- end
37
-
38
- describe "#click" do
39
- bug "http://github.com/jarib/watir-webdriver/issues/issue/32", [:webdriver, :ie] do
40
- it "fires the rows's onclick event" do
41
- browser.tr(:id, 'inner_first').click
42
- messages.should include('tr')
43
- end
44
- end
45
- end
46
-
47
- describe "#[]" do
48
- let(:table) { browser.table(:id => 'outer') }
49
-
50
- it "returns the nth cell of the row" do
51
- table[0][0].text.should == "Table 1, Row 1, Cell 1"
52
- table[2][0].text.should == "Table 1, Row 3, Cell 1"
53
- end
54
-
55
- not_compliant_on :webdriver do
56
- it "raises UnknownCellException if the index is out of bounds" do
57
- lambda { table.tr(:index, 0)[1337] }.should raise_error(UnknownCellException)
58
- lambda { table[0][1337] }.should raise_error(UnknownCellException)
59
- end
60
- end
61
- end
62
-
63
- describe "#cells" do
64
- let(:table) { browser.table(:id => 'outer') }
65
-
66
- it "returns the correct number of cells" do
67
- table[0].cells.length.should == 2
68
- table[1].cells.length.should == 2
69
- table[2].cells.length.should == 2
70
- end
71
-
72
- it "finds cells in the table" do
73
- table[0].cells(:text => /Table 1/).size.should == 2
74
- end
75
-
76
- it "does not find cells from nested tables" do
77
- table[1].cell(:id => "t2_r1_c1").should_not exist
78
- table[1].cell(:id => /t2_r1_c1/).should_not exist
79
- end
80
-
81
- it "iterates correctly through the cells of the row" do
82
- browser.table(:id, 'outer').row(:index => 1).cells.each_with_index do |cell, idx|
83
- cell.id.should == "t1_r2_c#{idx + 1}"
84
- end
85
- end
86
- end
87
-
88
- end