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,24 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Meta" do
5
- before :each do
6
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
7
- end
8
-
9
- describe "#exist?" do
10
- it "returns true if the meta tag exists" do
11
- browser.meta(:http_equiv, "Content-Type").should exist
12
- end
13
-
14
- it "returns the first meta if given no args" do
15
- browser.meta.should exist
16
- end
17
- end
18
-
19
- describe "content" do
20
- it "returns the content attribute of the tag" do
21
- browser.meta(:http_equiv, "Content-Type").content.should == "text/html; charset=utf-8"
22
- end
23
- end
24
- end
@@ -1,43 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Metas" 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.metas(:name => "description").to_a.should == [browser.meta(:name => "description")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of meta elements" do
20
- browser.metas.length.should == 2
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the meta element at the given index" do
26
- browser.metas[1].name.should == "description"
27
- end
28
- end
29
-
30
- describe "#each" do
31
- it "iterates through meta elements correctly" do
32
- count = 0
33
-
34
- browser.metas.each_with_index do |m, index|
35
- m.content.should == browser.meta(:index, index).content
36
- count += 1
37
- end
38
-
39
- count.should > 0
40
- end
41
- end
42
-
43
- end
@@ -1,90 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Ol" 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 'ol' exists" do
13
- browser.ol(:id, "favorite_compounds").should exist
14
- browser.ol(:id, /favorite_compounds/).should exist
15
- browser.ol(:index, 0).should exist
16
- browser.ol(:xpath, "//ol[@id='favorite_compounds']").should exist
17
- end
18
-
19
- it "returns the first ol if given no args" do
20
- browser.ol.should exist
21
- end
22
-
23
- it "returns false if the 'ol' doesn't exist" do
24
- browser.ol(:id, "no_such_id").should_not exist
25
- browser.ol(:id, /no_such_id/).should_not exist
26
- browser.ol(:text, "no_such_text").should_not exist
27
- browser.ol(:text, /no_such_text/).should_not exist
28
- browser.ol(:class, "no_such_class").should_not exist
29
- browser.ol(:class, /no_such_class/).should_not exist
30
- browser.ol(:index, 1337).should_not exist
31
- browser.ol(:xpath, "//ol[@id='no_such_id']").should_not exist
32
- end
33
-
34
- it "returns false if the 'ol' doesn't exist" do
35
- browser.ol(:id, "no_such_id").should_not exist
36
- browser.ol(:id, /no_such_id/).should_not exist
37
- browser.ol(:text, "no_such_text").should_not exist
38
- browser.ol(:text, /no_such_text/).should_not exist
39
- browser.ol(:class, "no_such_class").should_not exist
40
- browser.ol(:class, /no_such_class/).should_not exist
41
- browser.ol(:index, 1337).should_not exist
42
- browser.ol(:xpath, "//ol[@id='no_such_id']").should_not exist
43
- end
44
-
45
- it "raises TypeError when 'what' argument is invalid" do
46
- lambda { browser.ol(:id, 3.14).exists? }.should raise_error(TypeError)
47
- end
48
-
49
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
50
- lambda { browser.ol(: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 class attribute" do
57
- browser.ol(:id, 'favorite_compounds').class_name.should == 'chemistry'
58
- end
59
-
60
- it "returns an empty string if the element exists and the attribute doesn't" do
61
- browser.ol(:index, 1).class_name.should == ''
62
- end
63
-
64
- it "raises UnknownObjectException if the ol doesn't exist" do
65
- lambda { browser.ol(:id, 'no_such_id').class_name }.should raise_error(UnknownObjectException)
66
- end
67
- end
68
-
69
- describe "#id" do
70
- it "returns the id attribute" do
71
- browser.ol(:class, 'chemistry').id.should == "favorite_compounds"
72
- end
73
-
74
- it "returns an empty string if the element exists and the attribute doesn't" do
75
- browser.ol(:index, 1).id.should == ''
76
- end
77
-
78
- it "raises UnknownObjectException if the ol doesn't exist" do
79
- lambda { browser.ol(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
80
- lambda { browser.ol(:index, 1337).id }.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.ol(:index, 0).should respond_to(:class_name)
87
- browser.ol(:index, 0).should respond_to(:id)
88
- end
89
- end
90
- end
@@ -1,45 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Ols" 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.ols(:class => "chemistry").to_a.should == [browser.ol(:class => "chemistry")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of ols" do
20
- browser.ols.length.should == 2
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the ol at the given index" do
26
- browser.ols[0].id.should == "favorite_compounds"
27
- end
28
- end
29
-
30
- describe "#each" do
31
- it "iterates through ols correctly" do
32
- count = 0
33
-
34
- browser.ols.each_with_index do |ul, index|
35
- ul.id.should == browser.ol(:index, index).id
36
- ul.value.should == browser.ol(:index, index).value
37
-
38
- count += 1
39
- end
40
-
41
- count.should > 0
42
- end
43
- end
44
-
45
- end
@@ -1,152 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Option" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
8
- end
9
-
10
- describe "#exists?" do
11
- it "returns true if the element exists (page context)" do
12
- browser.option(:id, "nor").should exist
13
- browser.option(:id, /nor/).should exist
14
- browser.option(:value, "2").should exist
15
- browser.option(:value, /2/).should exist
16
- browser.option(:text, "Norway").should exist
17
- browser.option(:text, /Norway/).should exist
18
- browser.option(:class, "scandinavia").should exist
19
- browser.option(:index, 1).should exist
20
- browser.option(:xpath, "//option[@id='nor']").should exist
21
- end
22
-
23
- it "returns the first option if given no args" do
24
- browser.option.should exist
25
- end
26
-
27
- it "returns true if the element exists (select_list context)" do
28
- browser.select_list(:name, "new_user_country").option(:id, "nor").should exist
29
- browser.select_list(:name, "new_user_country").option(:id, /nor/).should exist
30
- browser.select_list(:name, "new_user_country").option(:value, "2").should exist
31
- browser.select_list(:name, "new_user_country").option(:value, /2/).should exist
32
- browser.select_list(:name, "new_user_country").option(:text, "Norway").should exist
33
- browser.select_list(:name, "new_user_country").option(:text, /Norway/).should exist
34
- browser.select_list(:name, "new_user_country").option(:class, "scandinavia").should exist
35
- browser.select_list(:name, "new_user_country").option(:index, 1).should exist
36
- browser.select_list(:name, "new_user_country").option(:xpath, "//option[@id='nor']").should exist
37
- browser.select_list(:name, "new_user_country").option(:xpath, "//option[@id='nor']").should exist
38
- browser.select_list(:name, "new_user_country").option(:label, "Germany").should exist
39
- end
40
-
41
- it "returns false if the element does not exist (page context)" do
42
- browser.option(:id, "no_such_id").should_not exist
43
- browser.option(:id, /no_such_id/).should_not exist
44
- browser.option(:value, "no_such_value").should_not exist
45
- browser.option(:value, /no_such_value/).should_not exist
46
- browser.option(:text, "no_such_text").should_not exist
47
- browser.option(:text, /no_such_text/).should_not exist
48
- browser.option(:class, "no_such_class").should_not exist
49
- browser.option(:index, 1337).should_not exist
50
- browser.option(:xpath, "//option[@id='no_such_id']").should_not exist
51
- end
52
-
53
- it "returns false if the element does not exist (select_list context)" do
54
- browser.select_list(:name, "new_user_country").option(:id, "no_such_id").should_not exist
55
- browser.select_list(:name, "new_user_country").option(:id, /no_such_id/).should_not exist
56
- browser.select_list(:name, "new_user_country").option(:value, "no_such_value").should_not exist
57
- browser.select_list(:name, "new_user_country").option(:value, /no_such_value/).should_not exist
58
- browser.select_list(:name, "new_user_country").option(:text, "no_such_text").should_not exist
59
- browser.select_list(:name, "new_user_country").option(:text, /no_such_text/).should_not exist
60
- browser.select_list(:name, "new_user_country").option(:class, "no_such_class").should_not exist
61
- browser.select_list(:name, "new_user_country").option(:index, 1337).should_not exist
62
- browser.select_list(:name, "new_user_country").option(:xpath, "//option[@id='no_such_id']").should_not exist
63
- end
64
-
65
- it "raises TypeError when 'what' argument is invalid" do
66
- lambda { browser.option(:id, 3.14).exists? }.should raise_error(TypeError)
67
- lambda { browser.select_list(:name, "new_user_country").option(:id, 3.14).exists? }.should raise_error(TypeError)
68
- end
69
-
70
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
71
- lambda { browser.option(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
72
- lambda { browser.select_list(:name, "new_user_country").option(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
73
- end
74
- end
75
-
76
- describe "#select" do
77
- it "selects the chosen option (page context)" do
78
- browser.option(:text, "Denmark").select
79
- browser.select_list(:name, "new_user_country").selected_options.should == ["Denmark"]
80
- end
81
-
82
- it "selects the chosen option (select_list context)" do
83
- browser.select_list(:name, "new_user_country").option(:text, "Denmark").select
84
- browser.select_list(:name, "new_user_country").selected_options.should == ["Denmark"]
85
- end
86
-
87
- it "selects the option when found by text (page context)" do
88
- browser.option(:text, 'Sweden').select
89
- browser.option(:text, 'Sweden').should be_selected
90
- end
91
-
92
- it "selects the option when found by text (select_list context)" do
93
- browser.select_list(:name, 'new_user_country').option(:text, 'Sweden').select
94
- browser.select_list(:name, 'new_user_country').option(:text, 'Sweden').should be_selected
95
- end
96
-
97
- # there's no onclick event for Option in IE
98
- # http://msdn.microsoft.com/en-us/library/ms535877(VS.85).aspx
99
- not_compliant_on [:webdriver, :ie] do
100
- it "fires the onclick event (page context)" do
101
- browser.option(:text, "Username 3").select
102
- browser.text_field(:id, 'delete_user_comment').value.should == 'Don\'t do it!'
103
- end
104
- end
105
-
106
- # there's no onclick event for Option in IE
107
- # http://msdn.microsoft.com/en-us/library/ms535877(VS.85).aspx
108
- not_compliant_on [:webdriver, :ie] do
109
- it "fires onclick event (select_list context)" do
110
- browser.select_list(:id, 'delete_user_username').option(:text, "Username 3").select
111
- browser.text_field(:id, 'delete_user_comment').value.should == 'Don\'t do it!'
112
- end
113
- end
114
-
115
- it "raises UnknownObjectException if the option does not exist (page context)" do
116
- lambda { browser.option(:text, "no_such_text").select }.should raise_error(UnknownObjectException)
117
- lambda { browser.option(:text, /missing/).select }.should raise_error(UnknownObjectException)
118
- end
119
-
120
- it "raises UnknownObjectException if the option does not exist (select_list context)" do
121
- lambda { browser.select_list(:name, "new_user_country").option(:text, "no_such_text").select }.should raise_error(UnknownObjectException)
122
- lambda { browser.select_list(:name, "new_user_country").option(:text, /missing/).select }.should raise_error(UnknownObjectException)
123
- end
124
-
125
- it "raises MissingWayOfFindingObjectException when given a bad 'how' (page context)" do
126
- lambda { browser.option(:missing, "Denmark").select }.should raise_error(MissingWayOfFindingObjectException)
127
- end
128
-
129
- it "raises MissingWayOfFindingObjectException when given a bad 'how' (select_list context)" do
130
- lambda { browser.select_list(:name, "new_user_country").option(:missing, "Denmark").select }.should raise_error(MissingWayOfFindingObjectException)
131
- end
132
- end
133
-
134
- describe "#class_name" do
135
- it "is able to get attributes (page context)" do
136
- browser.option(:text, 'Sweden').class_name.should == "scandinavia"
137
- end
138
-
139
- it "is able to get attributes (select_list context)" do
140
- browser.select_list(:name, "new_user_country").option(:text, 'Sweden').class_name.should == "scandinavia"
141
- end
142
- end
143
-
144
- describe "#respond_to?" do
145
- it "returns true for all attribute methods" do
146
- browser.select_list(:name, "new_user_country").option(:text, 'Sweden').should respond_to(:class_name)
147
- browser.select_list(:name, "new_user_country").option(:text, 'Sweden').should respond_to(:id)
148
- browser.select_list(:name, "new_user_country").option(:text, 'Sweden').should respond_to(:text)
149
- end
150
- end
151
-
152
- end
@@ -1,132 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "P" 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 'p' exists" do
13
- browser.p(:id, "lead").should exist
14
- browser.p(:id, /lead/).should exist
15
- browser.p(:text, "Dubito, ergo cogito, ergo sum.").should exist
16
- browser.p(:text, /Dubito, ergo cogito, ergo sum/).should exist
17
- browser.p(:class, "lead").should exist
18
- browser.p(:class, /lead/).should exist
19
- browser.p(:index, 0).should exist
20
- browser.p(:xpath, "//p[@id='lead']").should exist
21
- end
22
-
23
- it "returns the first p if given no args" do
24
- browser.p.should exist
25
- end
26
-
27
- it "returns false if the 'p' doesn't exist" do
28
- browser.p(:id, "no_such_id").should_not exist
29
- browser.p(:id, /no_such_id/).should_not exist
30
- browser.p(:text, "no_such_text").should_not exist
31
- browser.p(:text, /no_such_text/).should_not exist
32
- browser.p(:class, "no_such_class").should_not exist
33
- browser.p(:class, /no_such_class/).should_not exist
34
- browser.p(:index, 1337).should_not exist
35
- browser.p(:xpath, "//p[@id='no_such_id']").should_not exist
36
- end
37
-
38
- it "raises TypeError when 'what' argument is invalid" do
39
- lambda { browser.p(:id, 3.14).exists? }.should raise_error(TypeError)
40
- end
41
-
42
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
43
- lambda { browser.p(: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.p(:index, 0).class_name.should == 'lead'
51
- end
52
-
53
- it "returns an empty string if the element exists and the attribute doesn't" do
54
- browser.p(:index, 2).class_name.should == ''
55
- end
56
-
57
- it "raises UnknownObjectException if the p doesn't exist" do
58
- lambda { browser.p(: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.p(:index, 0).id.should == "lead"
65
- end
66
-
67
- it "returns an empty string if the element exists and the attribute doesn't" do
68
- browser.p(:index, 2).id.should == ''
69
- end
70
-
71
- it "raises UnknownObjectException if the p doesn't exist" do
72
- lambda { browser.p(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
73
- lambda { browser.p(:index, 1337).id }.should raise_error(UnknownObjectException)
74
- end
75
- end
76
-
77
- describe "#title" do
78
- it "returns the title attribute" do
79
- browser.p(:index, 0).title.should == 'Lorem ipsum'
80
- end
81
-
82
- it "returns an empty string if the element exists and the attribute doesn't" do
83
- browser.p(:index, 2).title.should == ''
84
- end
85
-
86
- it "raises UnknownObjectException if the p doesn't exist" do
87
- lambda { browser.p(:id, 'no_such_id').title }.should raise_error( UnknownObjectException)
88
- lambda { browser.p(:xpath, "//p[@id='no_such_id']").title }.should raise_error( UnknownObjectException)
89
- end
90
- end
91
-
92
- describe "#text" do
93
- it "returns the text of the p" do
94
- browser.p(:index, 1).text.should == 'Sed pretium metus et quam. Nullam odio dolor, vestibulum non, tempor ut, vehicula sed, sapien. Vestibulum placerat ligula at quam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.'
95
- end
96
-
97
- it "returns an empty string if the element doesn't contain any text" do
98
- browser.p(:index, 4).text.should == ''
99
- end
100
-
101
- it "raises UnknownObjectException if the p doesn't exist" do
102
- lambda { browser.p(:id, 'no_such_id').text }.should raise_error( UnknownObjectException)
103
- lambda { browser.p(:xpath , "//p[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
104
- end
105
- end
106
-
107
- describe "#value" do
108
- it "returns the value attribute" do
109
- browser.p(:index, 1).value.should == "invalid_attribute"
110
- end
111
-
112
- it "returns an empty string if the element exists and the attribute doesn't" do
113
- browser.p(:index, 2).value.should == ''
114
- end
115
-
116
- it "raises UnknownObjectException if the p doesn't exist" do
117
- lambda { browser.p(:id , "no_such_id").value }.should raise_error(UnknownObjectException)
118
- lambda { browser.p(:index , 1337).value }.should raise_error(UnknownObjectException)
119
- end
120
- end
121
-
122
- describe "#respond_to?" do
123
- it "returns true for all attribute methods" do
124
- browser.p(:index, 0).should respond_to(:class_name)
125
- browser.p(:index, 0).should respond_to(:id)
126
- browser.p(:index, 0).should respond_to(:title)
127
- browser.p(:index, 0).should respond_to(:text)
128
- browser.p(:index, 0).should respond_to(:value)
129
- end
130
- end
131
-
132
- end