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 "Divs" 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.divs(:id => "header").to_a.should == [browser.div(:id => "header")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of divs" do
20
- browser.divs.length.should == 12
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the div at the given index" do
26
- browser.divs[1].id.should == "outer_container"
27
- end
28
- end
29
-
30
- describe "#each" do
31
- it "iterates through divs correctly" do
32
- count = 0
33
-
34
- browser.divs.each_with_index do |d, index|
35
- d.id.should == browser.div(:index, index).id
36
- d.class_name.should == browser.div(:index, index).class_name
37
-
38
- count += 1
39
- end
40
-
41
- count.should > 0
42
- end
43
- end
44
-
45
- end
@@ -1,137 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Dl" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/definition_lists.html")
8
- end
9
-
10
- # Exists method
11
- describe "#exists?" do
12
- it "returns true if the element exists" do
13
- browser.dl(:id, "experience-list").should exist
14
- browser.dl(:class, "list").should exist
15
- browser.dl(:xpath, "//dl[@id='experience-list']").should exist
16
- browser.dl(:index, 0).should exist
17
- end
18
-
19
- it "returns the first dl if given no args" do
20
- browser.dl.should exist
21
- end
22
-
23
- it "returns false if the element does not exist" do
24
- browser.dl(:id, "no_such_id").should_not exist
25
- end
26
-
27
- it "raises TypeError when 'what' argument is invalid" do
28
- lambda { browser.dl(:id, 3.14).exists? }.should raise_error(TypeError)
29
- end
30
-
31
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
32
- lambda { browser.dl(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
33
- end
34
- end
35
-
36
- # Attribute methods
37
- describe "#class_name" do
38
- it "returns the class attribute if the element exists" do
39
- browser.dl(:id, "experience-list").class_name.should == "list"
40
- end
41
-
42
- it "returns an empty string if the element exists but the attribute doesn't" do
43
- browser.dl(:id, "noop").class_name.should == ""
44
- end
45
-
46
- it "raises UnknownObjectException if the element does not exist" do
47
- lambda { browser.dl(:id, "no_such_id").class_name }.should raise_error(UnknownObjectException)
48
- lambda { browser.dl(:title, "no_such_title").class_name }.should raise_error(UnknownObjectException)
49
- lambda { browser.dl(:index, 1337).class_name }.should raise_error(UnknownObjectException)
50
- lambda { browser.dl(:xpath, "//dl[@id='no_such_id']").class_name }.should raise_error(UnknownObjectException)
51
- end
52
- end
53
-
54
- describe "#id" do
55
- it "returns the id attribute if the element exists" do
56
- browser.dl(:class, 'list').id.should == "experience-list"
57
- end
58
-
59
- it "returns an empty string if the element exists, but the attribute doesn't" do
60
- browser.dl(:class, 'personalia').id.should == ""
61
- end
62
-
63
- it "raises UnknownObjectException if the element does not exist" do
64
- lambda {browser.dl(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
65
- lambda {browser.dl(:title, "no_such_id").id }.should raise_error(UnknownObjectException)
66
- lambda {browser.dl(:index, 1337).id }.should raise_error(UnknownObjectException)
67
- end
68
- end
69
-
70
- describe "#title" do
71
- it "returns the id attribute if the element exists" do
72
- browser.dl(:class, 'list').title.should == "experience"
73
- end
74
- end
75
-
76
- describe "#text" do
77
- it "returns the text of the element" do
78
- browser.dl(:id, "experience-list").text.should include("11 years")
79
- end
80
-
81
- it "returns an empty string if the element exists but contains no text" do
82
- browser.dl(:id, 'noop').text.should == ""
83
- end
84
-
85
- it "raises UnknownObjectException if the element does not exist" do
86
- lambda { browser.dl(:id, "no_such_id").text }.should raise_error(UnknownObjectException)
87
- lambda { browser.dl(:title, "no_such_title").text }.should raise_error(UnknownObjectException)
88
- lambda { browser.dl(:index, 1337).text }.should raise_error(UnknownObjectException)
89
- lambda { browser.dl(:xpath, "//dl[@id='no_such_id']").text }.should raise_error(UnknownObjectException)
90
- end
91
- end
92
-
93
- describe "#respond_to?" do
94
- it "returns true for all attribute methods" do
95
- browser.dl(:index, 0).should respond_to(:id)
96
- browser.dl(:index, 0).should respond_to(:class_name)
97
- browser.dl(:index, 0).should respond_to(:style)
98
- browser.dl(:index, 0).should respond_to(:text)
99
- browser.dl(:index, 0).should respond_to(:title)
100
- end
101
- end
102
-
103
- # Manipulation methods
104
- describe "#click" do
105
- it "fires events when clicked" do
106
- browser.dt(:id, 'name').text.should_not == 'changed!'
107
- browser.dt(:id, 'name').click
108
- browser.dt(:id, 'name').text.should == 'changed!'
109
- end
110
-
111
- it "raises UnknownObjectException if the element does not exist" do
112
- lambda { browser.dl(:id, "no_such_id").click }.should raise_error(UnknownObjectException)
113
- lambda { browser.dl(:title, "no_such_title").click }.should raise_error(UnknownObjectException)
114
- lambda { browser.dl(:index, 1337).click }.should raise_error(UnknownObjectException)
115
- lambda { browser.dl(:xpath, "//dl[@id='no_such_id']").click }.should raise_error(UnknownObjectException)
116
- end
117
- end
118
-
119
- describe "#html" do
120
- not_compliant_on [:webdriver, :ie] do
121
- it "returns the HTML of the element" do
122
- html = browser.dl(:id, 'experience-list').html.downcase
123
- html.should include('<dt class="current-industry">')
124
- html.should_not include('</body>')
125
- end
126
- end
127
-
128
- deviates_on [:webdriver, :ie] do
129
- it "returns the HTML of the element" do
130
- html = browser.dl(:id, 'experience-list').html.downcase
131
- html.should include('<dt class=current-industry>')
132
- html.should_not include('</body>')
133
- end
134
- end
135
- end
136
-
137
- end
@@ -1,46 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Dls" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/definition_lists.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.dls(:title => "experience").to_a.should == [browser.dl(:title => "experience")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of dls" do
20
- browser.dls.length.should == 3
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the dl at the given index" do
26
- browser.dls[0].id.should == "experience-list"
27
- end
28
- end
29
-
30
- describe "#each" do
31
- it "iterates through dls correctly" do
32
- count = 0
33
-
34
- browser.dls.each_with_index do |d, index|
35
- d.text.should == browser.dl(:index, index).text
36
- d.id.should == browser.dl(:index, index).id
37
- d.class_name.should == browser.dl(:index, index).class_name
38
-
39
- count += 1
40
- end
41
-
42
- count.should > 0
43
- end
44
- end
45
-
46
- end
@@ -1,127 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Dt" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/definition_lists.html")
8
- end
9
-
10
- # Exists method
11
- describe "#exists?" do
12
- it "returns true if the element exists" do
13
- browser.dt(:id, "experience").should exist
14
- browser.dt(:class, "current-industry").should exist
15
- browser.dt(:xpath, "//dt[@id='experience']").should exist
16
- browser.dt(:index, 0).should exist
17
- end
18
-
19
- it "returns the first dt if given no args" do
20
- browser.dt.should exist
21
- end
22
-
23
- it "returns false if the element does not exist" do
24
- browser.dt(:id, "no_such_id").should_not exist
25
- end
26
-
27
- it "raises TypeError when 'what' argument is invalid" do
28
- lambda { browser.dt(:id, 3.14).exists? }.should raise_error(TypeError)
29
- end
30
-
31
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
32
- lambda { browser.dt(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
33
- end
34
- end
35
-
36
- # Attribute methods
37
- describe "#class_name" do
38
- it "returns the class attribute if the element exists" do
39
- browser.dt(:id , "experience").class_name.should == "industry"
40
- end
41
-
42
- it "returns an empty string if the element exists but the attribute doesn't" do
43
- browser.dt(:id , "education").class_name.should == ""
44
- end
45
-
46
- it "raises UnknownObjectException if the element does not exist" do
47
- lambda { browser.dt(:id, "no_such_id").class_name }.should raise_error(UnknownObjectException)
48
- lambda { browser.dt(:title, "no_such_title").class_name }.should raise_error(UnknownObjectException)
49
- lambda { browser.dt(:index, 1337).class_name }.should raise_error(UnknownObjectException)
50
- lambda { browser.dt(:xpath, "//dt[@id='no_such_id']").class_name }.should raise_error(UnknownObjectException)
51
- end
52
- end
53
-
54
- describe "#id" do
55
- it "returns the id attribute if the element exists" do
56
- browser.dt(:class, 'industry').id.should == "experience"
57
- end
58
-
59
- it "returns an empty string if the element exists, but the attribute doesn't" do
60
- browser.dt(:class, 'current-industry').id.should == ""
61
- end
62
-
63
- it "raises UnknownObjectException if the element does not exist" do
64
- lambda {browser.dt(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
65
- lambda {browser.dt(:title, "no_such_id").id }.should raise_error(UnknownObjectException)
66
- lambda {browser.dt(:index, 1337).id }.should raise_error(UnknownObjectException)
67
- end
68
- end
69
-
70
- describe "#title" do
71
- it "returns the title of the element" do
72
- browser.dt(:id, "experience").title.should == "experience"
73
- end
74
- end
75
-
76
- describe "#text" do
77
- it "returns the text of the element" do
78
- browser.dt(:id, "experience").text.should == "Experience"
79
- end
80
-
81
- it "returns an empty string if the element exists but contains no text" do
82
- browser.dt(:class, 'noop').text.should == ""
83
- end
84
-
85
- it "raises UnknownObjectException if the element does not exist" do
86
- lambda { browser.dt(:id, "no_such_id").text }.should raise_error(UnknownObjectException)
87
- lambda { browser.dt(:title, "no_such_title").text }.should raise_error(UnknownObjectException)
88
- lambda { browser.dt(:index, 1337).text }.should raise_error(UnknownObjectException)
89
- lambda { browser.dt(:xpath, "//dt[@id='no_such_id']").text }.should raise_error(UnknownObjectException)
90
- end
91
- end
92
-
93
- describe "#respond_to?" do
94
- it "returns true for all attribute methods" do
95
- browser.dt(:index, 0).should respond_to(:id)
96
- browser.dt(:index, 0).should respond_to(:class_name)
97
- browser.dt(:index, 0).should respond_to(:style)
98
- browser.dt(:index, 0).should respond_to(:text)
99
- browser.dt(:index, 0).should respond_to(:title)
100
- end
101
- end
102
-
103
- # Manipulation methods
104
- describe "#click" do
105
- it "fires events when clicked" do
106
- browser.dt(:id, 'education').text.should_not == 'changed'
107
- browser.dt(:id, 'education').click
108
- browser.dt(:id, 'education').text.should == 'changed'
109
- end
110
-
111
- it "raises UnknownObjectException if the element does not exist" do
112
- lambda { browser.dt(:id, "no_such_id").click }.should raise_error(UnknownObjectException)
113
- lambda { browser.dt(:title, "no_such_title").click }.should raise_error(UnknownObjectException)
114
- lambda { browser.dt(:index, 1337).click }.should raise_error(UnknownObjectException)
115
- lambda { browser.dt(:xpath, "//dt[@id='no_such_id']").click }.should raise_error(UnknownObjectException)
116
- end
117
- end
118
-
119
- describe "#html" do
120
- it "returns the HTML of the element" do
121
- html = browser.dt(:id, 'name').html
122
- html.should =~ %r[<div>.*Name.*</div>]mi
123
- html.should_not include('</body>')
124
- end
125
- end
126
-
127
- end
@@ -1,45 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Dts" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/definition_lists.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.dts(:class => "current-industry").to_a.should == [browser.dt(:class => "current-industry")]
14
- end
15
- end
16
- end
17
-
18
- describe "#length" do
19
- it "returns the number of dts" do
20
- browser.dts.length.should == 11
21
- end
22
- end
23
-
24
- describe "#[]" do
25
- it "returns the dt at the given index" do
26
- browser.dts[0].id.should == "experience"
27
- end
28
- end
29
-
30
- describe "#each" do
31
- it "iterates through dts correctly" do
32
- count = 0
33
-
34
- browser.dts.each_with_index do |d, index|
35
- d.id.should == browser.dt(:index, index).id
36
- d.class_name.should == browser.dt(:index, index).class_name
37
-
38
- count += 1
39
- end
40
-
41
- count.should > 0
42
- end
43
- end
44
-
45
- end
@@ -1,149 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path("../spec_helper", __FILE__)
3
-
4
- describe "Element" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
8
- end
9
-
10
- describe ".new" do
11
- it "finds elements matching the conditions when given a hash of :how => 'what' arguments" do
12
- browser.checkbox(:name => 'new_user_interests', :title => 'Dancing is fun!').value.should == 'dancing'
13
- browser.text_field(:class_name => 'name', :index => 1).id.should == 'new_user_last_name'
14
- end
15
-
16
- it "raises UnknownObjectException with a sane error message when given a hash of :how => 'what' arguments (non-existing object)" do
17
- lambda { browser.text_field(:index => 100, :name => "foo").id }.should raise_error(UnknownObjectException)
18
- end
19
-
20
- it "raises ArgumentError if given the wrong number of arguments" do
21
- container = mock("container").as_null_object
22
- lambda { Element.new(container, 1,2,3,4) }.should raise_error(ArgumentError)
23
- lambda { Element.new(container, "foo") }.should raise_error(ArgumentError)
24
- end
25
- end
26
-
27
- describe "#== and #eql?" do
28
- before { browser.goto(WatirSpec.files + "/definition_lists.html") }
29
-
30
- it "returns true if the two elements point to the same DOM element" do
31
- a = browser.dl(:id => "experience-list")
32
- b = browser.dl
33
-
34
- a.should == b
35
- a.should eql(b)
36
- end
37
-
38
- it "returns false if the two elements are not the same" do
39
- a = browser.dls[0]
40
- b = browser.dls[1]
41
-
42
- a.should_not == b
43
- a.should_not eql(b)
44
- end
45
-
46
- it "returns false if the other object is not an Element" do
47
- browser.dl.should_not == 1
48
- end
49
- end
50
-
51
- describe "data-* attributes" do
52
- before { browser.goto("file://" + File.expand_path("html/data_attributes.html", File.dirname(__FILE__))) }
53
-
54
- bug "http://github.com/jarib/celerity/issues#issue/27", :celerity do
55
- it "finds elements by a data-* attribute" do
56
- browser.p(:data_type => "ruby-library").should exist
57
- end
58
-
59
- it "returns the value of a data-* attribute" do
60
- browser.p.data_type.should == "ruby-library"
61
- end
62
- end
63
- end
64
-
65
- describe "finding with unknown tag name" do
66
- it "finds an element by xpath" do
67
- browser.element(:xpath => "//*[@for='new_user_first_name']").should exist
68
- end
69
-
70
- it "finds an element by arbitrary attribute" do
71
- browser.element(:id => "new_user").should exist
72
- end
73
-
74
- it "finds several elements by xpath" do
75
- browser.elements(:xpath => "//a").length.should == 1
76
- end
77
-
78
- it "finds finds several elements by arbitrary attribute" do
79
- browser.elements(:name => /^new_user/).length.should == 30
80
- end
81
- end
82
-
83
- describe "#to_subtype" do
84
- it "returns a more precise subtype of Element" do
85
- el = browser.element(:xpath => "//input[@type='radio']").to_subtype
86
- el.should be_kind_of(Watir::Radio)
87
- end
88
- end
89
-
90
- describe "#focus" do
91
- bug "http://github.com/jarib/watir-webdriver/issues/issue/20", [:webdriver, :firefox] do
92
- it "fires the onfocus event for the given element" do
93
- tf = browser.text_field(:id, "new_user_occupation")
94
- tf.value.should == "Developer"
95
- tf.focus
96
- browser.div(:id, "onfocus_test").text.should == "changed by onfocus event"
97
- end
98
- end
99
- end
100
-
101
- describe "#fire_event" do
102
- it "should fire the given event" do
103
- browser.div(:id, "onfocus_test").text.should be_empty
104
- browser.text_field(:id, "new_user_occupation").fire_event('onfocus')
105
- browser.div(:id, "onfocus_test").text.should == "changed by onfocus event"
106
- end
107
- end
108
-
109
- describe "#parent" do
110
- bug "http://github.com/jarib/celerity/issues#issue/28", :celerity do
111
- it "gets the parent of this element" do
112
- browser.text_field(:id, "new_user_email").parent.should be_instance_of(FieldSet)
113
- end
114
- end
115
- end
116
-
117
- describe "#visible?" do
118
- it "returns true if the element is visible" do
119
- browser.text_field(:id, "new_user_email").should be_visible
120
- end
121
-
122
- it "returns false if the element is input element where type == 'hidden'" do
123
- browser.text_field(:id, "new_user_interests_dolls").should_not be_visible
124
- end
125
-
126
- it "returns false if the element has style='display: none;'" do
127
- browser.div(:id, 'changed_language').should_not be_visible
128
- end
129
-
130
- it "returns false if the element has style='visibility: hidden;" do
131
- browser.div(:id, 'wants_newsletter').should_not be_visible
132
- end
133
-
134
- it "returns false if one of the parent elements is hidden" do
135
- browser.div(:id, 'hidden_parent').should_not be_visible
136
- end
137
- end
138
-
139
- describe "#exist?" do
140
- it "doesn't raise when called on nested elements" do
141
- browser.div(:id, 'no_such_div').link(:id, 'no_such_id').should_not exist
142
- end
143
-
144
- it "raises ArgumentError error if selector hash with :xpath has multiple entries" do
145
- lambda { browser.div(:xpath => "//div", :class => "foo").exists? }.should raise_error(ArgumentError)
146
- end
147
- end
148
-
149
- end