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,97 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "TableBody" 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 body exists (page context)" do
12
- browser.tbody(:id, 'first').should exist
13
- browser.tbody(:id, /first/).should exist
14
- browser.tbody(:index, 0).should exist
15
- browser.tbody(:xpath, "//tbody[@id='first']").should exist
16
- end
17
-
18
- it "returns true if the table body exists (table context)" do
19
- browser.table(:index, 0).tbody(:id, 'first').should exist
20
- browser.table(:index, 0).tbody(:id, /first/).should exist
21
- browser.table(:index, 0).tbody(:index, 1).should exist
22
- browser.table(:index, 0).tbody(:xpath, "//tbody[@id='first']").should exist
23
- end
24
-
25
- it "returns the first table body if given no args" do
26
- browser.table.tbody.should exist
27
- end
28
-
29
- it "returns false if the table body doesn't exist (page context)" do
30
- browser.tbody(:id, 'no_such_id').should_not exist
31
- browser.tbody(:id, /no_such_id/).should_not exist
32
- browser.tbody(:index, 1337).should_not exist
33
- browser.tbody(:xpath, "//tbody[@id='no_such_id']").should_not exist
34
- end
35
-
36
- it "returns false if the table body doesn't exist (table context)" do
37
- browser.table(:index, 0).tbody(:id, 'no_such_id').should_not exist
38
- browser.table(:index, 0).tbody(:id, /no_such_id/).should_not exist
39
- browser.table(:index, 0).tbody(:index, 1337).should_not exist
40
- browser.table(:index, 0).tbody(:xpath, "//tbody[@id='no_such_id']").should_not exist
41
- end
42
-
43
- it "raises TypeError when 'what' argument is invalid" do
44
- lambda { browser.tbody(:id, 3.14).exists? }.should raise_error(TypeError)
45
- lambda { browser.table(:index, 0).tbody(:id, 3.14).exists? }.should raise_error(TypeError)
46
- end
47
-
48
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
49
- lambda { browser.tbody(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
50
- lambda { browser.table(:index, 0).tbody(: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.tbody(:id, 'first')[0].text.should == 'March 2008'
57
- browser.tbody(:id, 'first')[1][0].text.should == 'Gregory House'
58
- browser.tbody(:id, 'first')[2][0].text.should == 'Hugh Laurie'
59
- end
60
-
61
- it "returns the row at the given index (table context)" do
62
- browser.table(:index, 0).tbody(:id, 'first')[0].text.should == 'March 2008'
63
- browser.table(:index, 0).tbody(:id, 'first')[1][0].text.should == 'Gregory House'
64
- browser.table(:index, 0).tbody(:id, 'first')[2][0].text.should == 'Hugh Laurie'
65
- end
66
- end
67
-
68
- describe "#row" do
69
- it "finds the first row matching the selector" do
70
- row = browser.tbody(:id, 'first').row(:id => "gregory")
71
-
72
- row.tag_name.should == "tr"
73
- row.id.should == "gregory"
74
- end
75
- end
76
-
77
- describe "#rows" do
78
- it "finds rows matching the selector" do
79
- rows = browser.tbody(:id, 'first').rows(:id => /h$/)
80
-
81
- rows.size.should == 2
82
-
83
- rows.first.id.should == "march"
84
- rows.last.id.should == "hugh"
85
- end
86
- end
87
-
88
- describe "#strings" do
89
- it "returns the text of child cells" do
90
- browser.tbody(:id, 'first').strings.should == [
91
- ["March 2008", "", "", ""],
92
- ["Gregory House", "5 934", "1 347", "4 587"],
93
- ["Hugh Laurie", "6 300", "1 479", "4 821"]
94
- ]
95
- end
96
- end
97
- end
@@ -1,65 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "TableBodies" 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.tbodys(:id => "first").to_a.should == [browser.tbody(:id => "first")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the correct number of table bodies (page context)" do
20
- browser.tbodys.length.should == 5
21
- end
22
-
23
- it "returns the correct number of table bodies (table context)" do
24
- browser.table(:index, 0).tbodys.length.should == 2
25
- end
26
- end
27
-
28
- describe "#[]" do
29
- it "returns the row at the given index (page context)" do
30
- browser.tbodys[0].id.should == "first"
31
- end
32
-
33
- it "returns the row at the given index (table context)" do
34
- browser.table(:index, 0).tbodys[0].id.should == "first"
35
- end
36
- end
37
-
38
- describe "#each" do
39
- it "iterates through table bodies correctly (table context)" do
40
- count = 0
41
-
42
- browser.tbodys.each_with_index do |body, index|
43
- body.id.should == browser.tbody(:index, index).id
44
-
45
- count += 1
46
- end
47
-
48
- count.should > 0
49
- end
50
-
51
- it "iterates through table bodies correctly (table context)" do
52
- table = browser.table(:index, 0)
53
- count = 0
54
-
55
- table.tbodys.each_with_index do |body, index|
56
- body.id.should == table.tbody(:index, index).id
57
-
58
- count += 1
59
- end
60
-
61
- count.should > 0
62
- end
63
- end
64
-
65
- end
@@ -1,72 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "TableCell" 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 when the table cell exists" do
13
- browser.td(:id, 't1_r2_c1').should exist
14
- browser.td(:id, /t1_r2_c1/).should exist
15
- browser.td(:text, 'Table 1, Row 3, Cell 1').should exist
16
- browser.td(:text, /Table 1/).should exist
17
- browser.td(:index, 0).should exist
18
- browser.td(:xpath, "//td[@id='t1_r2_c1']").should exist
19
- end
20
-
21
- it "returns the first cell if given no args" do
22
- browser.td.should exist
23
- end
24
-
25
- it "returns false when the table cell does not exist" do
26
- browser.td(:id, 'no_such_id').should_not exist
27
- browser.td(:id, /no_such_id/).should_not exist
28
- browser.td(:text, 'no_such_text').should_not exist
29
- browser.td(:text, /no_such_text/).should_not exist
30
- browser.td(:index, 1337).should_not exist
31
- browser.td(:xpath, "//td[@id='no_such_id']").should_not exist
32
- end
33
-
34
- it "raises TypeError when 'what' argument is invalid" do
35
- lambda { browser.td(:id, 3.14).exists? }.should raise_error(TypeError)
36
- end
37
-
38
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
39
- lambda { browser.td(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
40
- end
41
- end
42
-
43
- describe "#click" do
44
- it "fires the table's onclick event" do
45
- browser.td(:id, 't2_r1_c1').click
46
- messages.should include('td')
47
- end
48
- end
49
-
50
- # Attribute methods
51
- describe "#text" do
52
- it "returns the text inside the table cell" do
53
- browser.td(:id, 't1_r2_c1').text.should == 'Table 1, Row 2, Cell 1'
54
- browser.td(:id, 't2_r1_c1').text.should == 'Table 2, Row 1, Cell 1'
55
- end
56
- end
57
-
58
- describe "#colspan" do
59
- it "gets the colspan attribute" do
60
- browser.td(:id, 'colspan_2').colspan.should == 2
61
- browser.td(:id, 'no_colspan').colspan.should == 1
62
- end
63
- end
64
-
65
- describe "#respond_to?" do
66
- it "returns true for all attribute methods" do
67
- browser.td(:index, 0).should respond_to(:text)
68
- browser.td(:index, 0).should respond_to(:colspan)
69
- end
70
- end
71
-
72
- end
@@ -1,60 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "TableCells" 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.tds(:headers => "before_tax").to_a.should == [browser.td(:headers => "before_tax")]
14
- end
15
- end
16
- end
17
-
18
- # describe "#length" do
19
- # it "returns the number of cells" do
20
- # browser.table(:id, 'outer').cells.length.should == 6
21
- # browser.table(:id, 'inner').cells.length.should == 2
22
- # end
23
- # end
24
- #
25
- # describe "#[]" do
26
- # it "returns the row at the given index" do
27
- # browser.table(:id, 'outer').cells[0].text.should == "Table 1, Row 1, Cell 1"
28
- # browser.table(:id, 'inner').cells[0].text.should == "Table 2, Row 1, Cell 1"
29
- # browser.table(:id, 'outer').cells[6].text.should == "Table 1, Row 3, Cell 2"
30
- # end
31
- # end
32
-
33
- describe "#each" do
34
- it "iterates through all cells on the page correctly" do
35
- count = 0
36
-
37
- browser.tds.each_with_index do |c, index|
38
- c.id.should == browser.td(:index, index).id
39
- c.value.should == browser.td(:index, index).value
40
-
41
- count += 1
42
- end
43
-
44
- count.should > 0
45
- end
46
-
47
- it "iterates through cells inside a table" do
48
- count = 0
49
-
50
- inner_table = browser.table(:id, 'inner')
51
- inner_table.tds.each_with_index do |c, index|
52
- c.id.should == inner_table.td(:index, index).id
53
- c.value.should == inner_table.td(:index, index).value
54
-
55
- count += 1
56
- end
57
- end
58
-
59
- end
60
- end
@@ -1,283 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "TextField" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
8
- end
9
-
10
- # Exists method
11
- describe "#exists?" do
12
- it "returns true if the element exists" do
13
- browser.text_field(:id, 'new_user_email').should exist
14
- browser.text_field(:id, /new_user_email/).should exist
15
- browser.text_field(:name, 'new_user_email').should exist
16
- browser.text_field(:name, /new_user_email/).should exist
17
- browser.text_field(:value, 'Developer').should exist
18
- browser.text_field(:value, /Developer/).should exist
19
- browser.text_field(:value, "Default comment.").should exist # textarea
20
- browser.text_field(:text, 'Developer').should exist
21
- browser.text_field(:text, /Developer/).should exist
22
- browser.text_field(:class, 'name').should exist
23
- browser.text_field(:class, /name/).should exist
24
- browser.text_field(:index, 0).should exist
25
- browser.text_field(:xpath, "//input[@id='new_user_email']").should exist
26
- browser.text_field(:label, "First name").should exist
27
- browser.text_field(:label, /(Last|First) name/).should exist
28
- end
29
-
30
- it "returns the first text field if given no args" do
31
- browser.text_field.should exist
32
- end
33
-
34
- it "returns true if the element exists (no type attribute)" do
35
- browser.text_field(:id, 'new_user_first_name').should exist
36
- end
37
-
38
- it "returns true if the element exists (invalid type attribute)" do
39
- browser.text_field(:id, 'new_user_last_name').should exist
40
- end
41
-
42
- it "returns false if the element does not exist" do
43
- browser.text_field(:id, 'no_such_id').should_not exist
44
- browser.text_field(:id, /no_such_id/).should_not exist
45
- browser.text_field(:name, 'no_such_name').should_not exist
46
- browser.text_field(:name, /no_such_name/).should_not exist
47
- browser.text_field(:value, 'no_such_value').should_not exist
48
- browser.text_field(:value, /no_such_value/).should_not exist
49
- browser.text_field(:text, 'no_such_text').should_not exist
50
- browser.text_field(:text, /no_such_text/).should_not exist
51
- browser.text_field(:class, 'no_such_class').should_not exist
52
- browser.text_field(:class, /no_such_class/).should_not exist
53
- browser.text_field(:index, 1337).should_not exist
54
- browser.text_field(:xpath, "//input[@id='no_such_id']").should_not exist
55
- browser.text_field(:label, "bad label").should_not exist
56
- browser.text_field(:label, /bad label/).should_not exist
57
- end
58
-
59
- it "raises TypeError when 'what' argument is invalid" do
60
- lambda { browser.text_field(:id, 3.14).exists? }.should raise_error(TypeError)
61
- end
62
-
63
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
64
- lambda { browser.text_field(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
65
- end
66
- end
67
-
68
- # Attribute methods
69
- describe "#id" do
70
- it "returns the id attribute if the text field exists" do
71
- browser.text_field(:index, 3).id.should == "new_user_occupation"
72
- end
73
-
74
- it "raises UnknownObjectException if the text field doesn't exist" do
75
- lambda { browser.text_field(:index, 1337).id }.should raise_error(UnknownObjectException)
76
- end
77
- end
78
-
79
- describe "#name" do
80
- it "returns the name attribute if the text field exists" do
81
- browser.text_field(:index, 3).name.should == "new_user_occupation"
82
- end
83
-
84
- it "raises UnknownObjectException if the text field doesn't exist" do
85
- lambda { browser.text_field(:index, 1337).name }.should raise_error(UnknownObjectException)
86
- end
87
- end
88
-
89
- describe "#title" do
90
- it "returns the title attribute if the text field exists" do
91
- browser.text_field(:id, "new_user_code").title.should == "Your personal code"
92
- end
93
-
94
- it "raises UnknownObjectException if the text field doesn't exist" do
95
- lambda { browser.text_field(:index, 1337).title }.should raise_error(UnknownObjectException)
96
- end
97
- end
98
-
99
- describe "#type" do
100
- it "returns the type attribute if the text field exists" do
101
- browser.text_field(:index, 3).type.should == "text"
102
- end
103
-
104
- it "returns 'text' if the type attribute is invalid" do
105
- browser.text_field(:id, 'new_user_last_name').type.should == "text"
106
- end
107
-
108
- it "returns 'text' if the type attribute does not exist" do
109
- browser.text_field(:id, 'new_user_first_name').type.should == "text"
110
- end
111
-
112
- it "raises UnknownObjectException if the text field doesn't exist" do
113
- lambda { browser.text_field(:index, 1337).type }.should raise_error(UnknownObjectException)
114
- end
115
- end
116
-
117
- describe "#value" do
118
- it "returns the value attribute if the text field exists" do
119
- browser.text_field(:name, "new_user_occupation").value.should == "Developer"
120
- browser.text_field(:index, 3).value.should == "Developer"
121
- browser.text_field(:name, /new_user_occupation/i).value.should == "Developer"
122
- end
123
-
124
- it "raises UnknownObjectException if the text field doesn't exist" do
125
- lambda { browser.text_field(:index, 1337).value }.should raise_error(UnknownObjectException)
126
- end
127
- end
128
-
129
- describe "#respond_to?" do
130
- it "returns true for all attribute methods" do
131
- browser.text_field(:index, 0).should respond_to(:class_name)
132
- browser.text_field(:index, 0).should respond_to(:id)
133
- browser.text_field(:index, 0).should respond_to(:name)
134
- browser.text_field(:index, 0).should respond_to(:title)
135
- browser.text_field(:index, 0).should respond_to(:type)
136
- browser.text_field(:index, 0).should respond_to(:value)
137
- end
138
- end
139
-
140
- # Access methods
141
- describe "#enabled?" do
142
- it "returns true for enabled text fields" do
143
- browser.text_field(:name, "new_user_occupation").should be_enabled
144
- browser.text_field(:id, "new_user_email").should be_enabled
145
- end
146
-
147
- it "returns false for disabled text fields" do
148
- browser.text_field(:name, "new_user_species").should_not be_enabled
149
- end
150
-
151
- it "raises UnknownObjectException if the text field doesn't exist" do
152
- lambda { browser.text_field(:id, "no_such_id").enabled? }.should raise_error(UnknownObjectException)
153
- end
154
- end
155
-
156
- describe "#disabled?" do
157
- it "returns true if the text field is disabled" do
158
- browser.text_field(:id, 'new_user_species').should be_disabled
159
- end
160
-
161
- it "returns false if the text field is enabled" do
162
- browser.text_field(:index, 0).should_not be_disabled
163
- end
164
-
165
- it "raises UnknownObjectException if the text field doesn't exist" do
166
- lambda { browser.text_field(:index, 1337).disabled? }.should raise_error(UnknownObjectException)
167
- end
168
- end
169
-
170
- describe "#readonly?" do
171
- it "returns true for read-only text fields" do
172
- browser.text_field(:name, "new_user_code").should be_readonly
173
- browser.text_field(:id, "new_user_code").should be_readonly
174
- end
175
-
176
- it "returns false for writeable text fields" do
177
- browser.text_field(:name, "new_user_email").should_not be_readonly
178
- end
179
-
180
- it "raises UnknownObjectException if the text field doesn't exist" do
181
- lambda { browser.text_field(:id, 'no_such_id').readonly? }.should raise_error(UnknownObjectException)
182
- end
183
- end
184
-
185
- # Manipulation methods
186
- describe "#append" do
187
- bug "http://code.google.com/p/selenium/issues/detail?id=698", [:webdriver, :ie] do
188
- it "appends the text to the text field" do
189
- browser.text_field(:name, "new_user_occupation").append(" Append This")
190
- browser.text_field(:name, "new_user_occupation").value.should == "Developer Append This"
191
- end
192
- end
193
-
194
- bug "http://code.google.com/p/selenium/issues/detail?id=698", [:webdriver, :ie] do
195
- it "appends multi-byte characters" do
196
- browser.text_field(:name, "new_user_occupation").append(" ijij")
197
- browser.text_field(:name, "new_user_occupation").value.should == "Developer ijij"
198
- end
199
- end
200
-
201
- it "raises ObjectReadOnlyException if the object is read only" do
202
- lambda { browser.text_field(:id, "new_user_code").append("Append This") }.should raise_error(ObjectReadOnlyException)
203
- end
204
-
205
- it "raises ObjectDisabledException if the object is disabled" do
206
- lambda { browser.text_field(:name, "new_user_species").append("Append This") }.should raise_error(ObjectDisabledException)
207
- end
208
-
209
- it "raises UnknownObjectException if the object doesn't exist" do
210
- lambda { browser.text_field(:name, "no_such_name").append("Append This") }.should raise_error(UnknownObjectException)
211
- end
212
- end
213
-
214
- describe "#clear" do
215
- it "removes all text from the text field" do
216
- browser.text_field(:name, "new_user_occupation").clear
217
- browser.text_field(:name, "new_user_occupation").value.should be_empty
218
- browser.text_field(:id, "delete_user_comment").clear
219
- browser.text_field(:id, "delete_user_comment").value.should be_empty
220
- end
221
-
222
- it "raises UnknownObjectException if the text field doesn't exist" do
223
- lambda { browser.text_field(:id, "no_such_id").clear }.should raise_error(UnknownObjectException)
224
- end
225
- end
226
-
227
- describe "#value=" do
228
- it "sets the value of the element" do
229
- browser.text_field(:id, 'new_user_email').value = 'Hello Cruel World'
230
- browser.text_field(:id, "new_user_email").value.should == 'Hello Cruel World'
231
- end
232
-
233
- it "is able to set multi-byte characters" do
234
- browser.text_field(:name, "new_user_occupation").value = "ijij"
235
- browser.text_field(:name, "new_user_occupation").value.should == "ijij"
236
- end
237
-
238
- it "sets the value of a textarea element" do
239
- browser.text_field(:id, 'delete_user_comment').value = 'Hello Cruel World'
240
- browser.text_field(:id, "delete_user_comment").value.should == 'Hello Cruel World'
241
- end
242
-
243
- it "raises UnknownObjectException if the text field doesn't exist" do
244
- lambda { browser.text_field(:name, "no_such_name").value = 'yo' }.should raise_error(UnknownObjectException)
245
- end
246
- end
247
-
248
- describe "#set" do
249
- it "sets the value of the element" do
250
- browser.text_field(:id, 'new_user_email').set('Bye Cruel World')
251
- browser.text_field(:id, "new_user_email").value.should == 'Bye Cruel World'
252
- end
253
-
254
- it "sets the value of a textarea element" do
255
- browser.text_field(:id, 'delete_user_comment').set('Hello Cruel World')
256
- browser.text_field(:id, "delete_user_comment").value.should == 'Hello Cruel World'
257
- end
258
-
259
- it "fires events" do
260
- browser.text_field(:id, "new_user_username").set("Hello World")
261
- browser.span(:id, "current_length").text.should == "11"
262
- end
263
-
264
- it "sets the value of a password field" do
265
- browser.text_field(:name, 'new_user_password').set('secret')
266
- browser.text_field(:name, 'new_user_password').value.should == 'secret'
267
- end
268
-
269
- it "sets the value when accessed through the enclosing Form" do
270
- browser.form(:id, 'new_user').text_field(:name, 'new_user_password').set('secret')
271
- browser.form(:id, 'new_user').text_field(:name, 'new_user_password').value.should == 'secret'
272
- end
273
-
274
- it "is able to set multi-byte characters" do
275
- browser.text_field(:name, "new_user_occupation").set("ijij")
276
- browser.text_field(:name, "new_user_occupation").value.should == "ijij"
277
- end
278
-
279
- it "raises UnknownObjectException if the text field doesn't exist" do
280
- lambda { browser.text_field(:id, "no_such_id").set('secret') }.should raise_error(UnknownObjectException)
281
- end
282
- end
283
- end