celerity 0.0.1 → 0.0.2

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/History.txt +10 -0
  2. data/README.txt +8 -11
  3. data/Rakefile +5 -3
  4. data/benchmark/bm_2000_spans.rb +48 -0
  5. data/benchmark/bm_digg.rb +26 -0
  6. data/benchmark/bm_google_images.rb +36 -0
  7. data/benchmark/bm_input_locator.rb +69 -0
  8. data/benchmark/loader.rb +9 -0
  9. data/lib/celerity.rb +3 -1
  10. data/lib/celerity/container.rb +23 -171
  11. data/lib/celerity/disabled_element.rb +1 -1
  12. data/lib/celerity/element.rb +78 -47
  13. data/lib/celerity/element_collections.rb +16 -32
  14. data/lib/celerity/element_locator.rb +135 -0
  15. data/lib/celerity/elements/button.rb +15 -0
  16. data/lib/celerity/elements/file_field.rb +1 -1
  17. data/lib/celerity/elements/form.rb +2 -1
  18. data/lib/celerity/elements/frame.rb +18 -21
  19. data/lib/celerity/elements/image.rb +2 -8
  20. data/lib/celerity/elements/label.rb +1 -3
  21. data/lib/celerity/elements/link.rb +1 -1
  22. data/lib/celerity/elements/option.rb +16 -0
  23. data/lib/celerity/elements/radio_check.rb +18 -7
  24. data/lib/celerity/elements/select_list.rb +1 -17
  25. data/lib/celerity/elements/table.rb +4 -4
  26. data/lib/celerity/elements/table_body.rb +6 -8
  27. data/lib/celerity/elements/table_cell.rb +3 -14
  28. data/lib/celerity/elements/table_row.rb +4 -10
  29. data/lib/celerity/elements/text_field.rb +16 -4
  30. data/lib/celerity/extra/method_generator.rb +144 -0
  31. data/lib/celerity/identifier.rb +10 -0
  32. data/lib/celerity/ie.rb +28 -13
  33. data/lib/celerity/input_element.rb +0 -4
  34. data/lib/celerity/non_control_elements.rb +12 -12
  35. data/lib/celerity/version.rb +1 -1
  36. data/spec/area_spec.rb +41 -41
  37. data/spec/areas_spec.rb +11 -11
  38. data/spec/button_spec.rb +73 -68
  39. data/spec/buttons_spec.rb +10 -10
  40. data/spec/checkbox_spec.rb +102 -96
  41. data/spec/checkboxes_spec.rb +10 -10
  42. data/spec/div_spec.rb +78 -73
  43. data/spec/divs_spec.rb +10 -10
  44. data/spec/element_spec.rb +20 -11
  45. data/spec/filefield_spec.rb +36 -41
  46. data/spec/filefields_spec.rb +10 -10
  47. data/spec/form_spec.rb +29 -29
  48. data/spec/forms_spec.rb +11 -11
  49. data/spec/frame_spec.rb +54 -49
  50. data/spec/hidden_spec.rb +43 -43
  51. data/spec/hiddens_spec.rb +10 -10
  52. data/spec/html/2000_spans.html +2009 -0
  53. data/spec/html/forms_with_input_elements.html +15 -9
  54. data/spec/html/non_control_elements.html +4 -2
  55. data/spec/ie_spec.rb +82 -48
  56. data/spec/image_spec.rb +83 -100
  57. data/spec/images_spec.rb +10 -10
  58. data/spec/label_spec.rb +29 -29
  59. data/spec/labels_spec.rb +10 -10
  60. data/spec/li_spec.rb +41 -41
  61. data/spec/link_spec.rb +65 -59
  62. data/spec/links_spec.rb +11 -11
  63. data/spec/lis_spec.rb +10 -10
  64. data/spec/map_spec.rb +30 -30
  65. data/spec/maps_spec.rb +10 -10
  66. data/spec/p_spec.rb +49 -49
  67. data/spec/pre_spec.rb +41 -41
  68. data/spec/pres_spec.rb +10 -10
  69. data/spec/ps_spec.rb +10 -10
  70. data/spec/radio_spec.rb +104 -97
  71. data/spec/radios_spec.rb +11 -11
  72. data/spec/select_list_spec.rb +118 -106
  73. data/spec/select_lists_spec.rb +15 -15
  74. data/spec/span_spec.rb +54 -54
  75. data/spec/spans_spec.rb +11 -11
  76. data/spec/spec.opts +1 -1
  77. data/spec/spec_helper.rb +23 -3
  78. data/spec/table_bodies.rb +8 -8
  79. data/spec/table_bodies_spec.rb +9 -9
  80. data/spec/table_body_spec.rb +28 -27
  81. data/spec/table_cell_spec.rb +25 -25
  82. data/spec/table_cells_spec.rb +16 -16
  83. data/spec/table_row_spec.rb +16 -16
  84. data/spec/table_rows_spec.rb +12 -12
  85. data/spec/table_spec.rb +36 -36
  86. data/spec/tables_spec.rb +12 -12
  87. data/spec/text_field_spec.rb +111 -92
  88. data/spec/text_fields_spec.rb +13 -13
  89. data/tasks/benchmark.rake +3 -0
  90. data/tasks/rspec.rake +2 -2
  91. data/tasks/testserver.rake +15 -0
  92. metadata +58 -46
  93. data/tasks/simple_ci.rake +0 -94
@@ -3,38 +3,38 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
3
3
  describe "FileFields" do
4
4
 
5
5
  before :all do
6
- @ie = IE.new
7
- add_spec_checker(@ie)
6
+ @browser = IE.new
7
+ add_spec_checker(@browser)
8
8
  end
9
9
 
10
10
  before :each do
11
- @ie.goto(TEST_HOST + "/forms_with_input_elements.html")
11
+ @browser.goto(TEST_HOST + "/forms_with_input_elements.html")
12
12
  end
13
13
 
14
14
  describe "#length" do
15
15
  it "should return the correct number of file fields" do
16
- @ie.file_fields.length.should == 2
16
+ @browser.file_fields.length.should == 2
17
17
  end
18
18
  end
19
19
 
20
20
  describe "#[]" do
21
21
  it "should return the file field at the given index" do
22
- @ie.file_fields[1].id.should == "new_user_portrait"
22
+ @browser.file_fields[1].id.should == "new_user_portrait"
23
23
  end
24
24
  end
25
25
 
26
26
  describe "#each" do
27
27
  it "should iterate through file fields correctly" do
28
- @ie.file_fields.each_with_index do |f, index|
29
- f.name.should == @ie.file_field(:index, index+1).name
30
- f.id.should == @ie.file_field(:index, index+1).id
31
- f.value.should == @ie.file_field(:index, index+1).value
28
+ @browser.file_fields.each_with_index do |f, index|
29
+ f.name.should == @browser.file_field(:index, index+1).name
30
+ f.id.should == @browser.file_field(:index, index+1).id
31
+ f.value.should == @browser.file_field(:index, index+1).value
32
32
  end
33
33
  end
34
34
  end
35
35
 
36
36
  after :all do
37
- @ie.close
37
+ @browser.close
38
38
  end
39
39
 
40
40
  end
data/spec/form_spec.rb CHANGED
@@ -2,51 +2,51 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe "Form" do
4
4
  before :all do
5
- @ie = IE.new
6
- add_spec_checker(@ie)
5
+ @browser = IE.new
6
+ add_spec_checker(@browser)
7
7
  end
8
8
 
9
9
  before :each do
10
- @ie.goto(TEST_HOST + "/forms_with_input_elements.html")
10
+ @browser.goto(TEST_HOST + "/forms_with_input_elements.html")
11
11
  end
12
12
 
13
13
  describe "#exists" do
14
14
  it "should return true if the form exists" do
15
- @ie.form(:id, 'new_user').should exist
16
- @ie.form(:id, /new_user/).should exist
17
- @ie.form(:class, 'user').should exist
18
- @ie.form(:class, /user/).should exist
19
- @ie.form(:method, 'post').should exist
20
- @ie.form(:method, /post/).should exist
21
- @ie.form(:action, 'forms_with_input_elements.html').should exist
22
- @ie.form(:action, /forms_with_input_elements.html/).should exist
23
- @ie.form(:index, 1).should exist
24
- @ie.form(:xpath, "//form[@id='new_user']").should exist
15
+ @browser.form(:id, 'new_user').should exist
16
+ @browser.form(:id, /new_user/).should exist
17
+ @browser.form(:class, 'user').should exist
18
+ @browser.form(:class, /user/).should exist
19
+ @browser.form(:method, 'post').should exist
20
+ @browser.form(:method, /post/).should exist
21
+ @browser.form(:action, 'post_to_me').should exist
22
+ @browser.form(:action, /to_me/).should exist
23
+ @browser.form(:index, 1).should exist
24
+ @browser.form(:xpath, "//form[@id='new_user']").should exist
25
25
  end
26
26
  it "should return false if the form doesn't exist" do
27
- @ie.form(:id, 'no_such_id').should_not exist
28
- @ie.form(:id, /no_such_id/).should_not exist
29
- @ie.form(:class, 'no_such_class').should_not exist
30
- @ie.form(:class, /no_such_class/).should_not exist
31
- @ie.form(:method, 'no_such_method').should_not exist
32
- @ie.form(:method, /no_such_method/).should_not exist
33
- @ie.form(:action, 'no_such_action').should_not exist
34
- @ie.form(:action, /no_such_action/).should_not exist
35
- @ie.form(:index, 1337).should_not exist
36
- @ie.form(:xpath, "//form[@id='no_such_id']").should_not exist
27
+ @browser.form(:id, 'no_such_id').should_not exist
28
+ @browser.form(:id, /no_such_id/).should_not exist
29
+ @browser.form(:class, 'no_such_class').should_not exist
30
+ @browser.form(:class, /no_such_class/).should_not exist
31
+ @browser.form(:method, 'no_such_method').should_not exist
32
+ @browser.form(:method, /no_such_method/).should_not exist
33
+ @browser.form(:action, 'no_such_action').should_not exist
34
+ @browser.form(:action, /no_such_action/).should_not exist
35
+ @browser.form(:index, 1337).should_not exist
36
+ @browser.form(:xpath, "//form[@id='no_such_id']").should_not exist
37
37
  end
38
- it "should raise ArgumentError when what argument is invalid" do
39
- lambda { @ie.form(:id, 3.14).exists? }.should raise_error(ArgumentError)
38
+ it "should raise ArgumentError when 'what' argument is invalid" do
39
+ lambda { @browser.form(:id, 3.14).exists? }.should raise_error(ArgumentError)
40
40
  end
41
- it "should raise MissingWayOfFindingObjectException when how argument is invalid" do
42
- lambda { @ie.form(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
41
+ it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
42
+ lambda { @browser.form(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
43
43
  end
44
44
  end
45
45
 
46
46
  describe "#submit" do
47
47
  it "should submit the form" do
48
- @ie.form(:id, "delete_user").submit
49
- @ie.text.should include("Semantic table")
48
+ @browser.form(:id, "delete_user").submit
49
+ @browser.text.should include("Semantic table")
50
50
  end
51
51
  end
52
52
 
data/spec/forms_spec.rb CHANGED
@@ -3,39 +3,39 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
3
3
  describe "Forms" do
4
4
 
5
5
  before :all do
6
- @ie = IE.new
7
- add_spec_checker(@ie)
6
+ @browser = IE.new
7
+ add_spec_checker(@browser)
8
8
  end
9
9
 
10
10
  before :each do
11
- @ie.goto(TEST_HOST + "/forms_with_input_elements.html")
11
+ @browser.goto(TEST_HOST + "/forms_with_input_elements.html")
12
12
  end
13
13
 
14
14
  describe "#length" do
15
15
  it "should return the number of forms in the container" do
16
- @ie.forms.length.should == 2
16
+ @browser.forms.length.should == 2
17
17
  end
18
18
  end
19
19
 
20
20
  describe "#[]n" do
21
21
  it "should provide access to the nth form" do
22
- @ie.forms[1].action.should == 'forms_with_input_elements.html'
23
- @ie.forms[1].attribute_value('method').should == 'post'
22
+ @browser.forms[1].action.should == 'post_to_me'
23
+ @browser.forms[1].attribute_value('method').should == 'post'
24
24
  end
25
25
  end
26
26
 
27
27
  describe "#each" do
28
28
  it "should iterate through forms correctly" do
29
- @ie.forms.each_with_index do |f, index|
30
- f.name.should == @ie.form(:index, index+1).name
31
- f.id.should == @ie.form(:index, index+1).id
32
- f.class_name.should == @ie.form(:index, index+1).class_name
29
+ @browser.forms.each_with_index do |f, index|
30
+ f.name.should == @browser.form(:index, index+1).name
31
+ f.id.should == @browser.form(:index, index+1).id
32
+ f.class_name.should == @browser.form(:index, index+1).class_name
33
33
  end
34
34
  end
35
35
  end
36
36
 
37
37
  after :all do
38
- @ie.close
38
+ @browser.close
39
39
  end
40
40
 
41
41
  end
data/spec/frame_spec.rb CHANGED
@@ -2,96 +2,101 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe "Frame" do
4
4
  before :all do
5
- @ie = IE.new
6
- add_spec_checker(@ie)
5
+ @browser = IE.new
6
+ add_spec_checker(@browser)
7
7
  end
8
8
 
9
9
  before :each do
10
- @ie.goto(TEST_HOST + "/frames.html")
10
+ @browser.goto(TEST_HOST + "/frames.html")
11
11
  end
12
12
 
13
13
  it "should handle crossframe javascript" do
14
- @ie.frame(:id, "frame_1").text_field(:name, 'senderElement').value.should == 'send_this_value'
15
- @ie.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'old_value'
16
- @ie.frame(:id, "frame_1").button(:id, 'send').click
17
- @ie.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'send_this_value'
14
+ @browser.frame(:id, "frame_1").text_field(:name, 'senderElement').value.should == 'send_this_value'
15
+ @browser.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'old_value'
16
+ @browser.frame(:id, "frame_1").button(:id, 'send').click
17
+ @browser.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'send_this_value'
18
18
  end
19
19
 
20
20
  # Exists
21
21
  describe "#exist?" do
22
22
  it "should return true if the frame exists" do
23
- @ie.frame(:id, "frame_1").should exist
24
- @ie.frame(:id, /frame/).should exist
25
- @ie.frame(:name, "frame1").should exist
26
- @ie.frame(:name, /frame/).should exist
27
- @ie.frame(:src, "frame_1.html").should exist
28
- @ie.frame(:src, /frame_1/).should exist
29
- @ie.frame(:class, "half").should exist
30
- @ie.frame(:class, /half/).should exist
31
- @ie.frame(:index, 1).should exist
32
- @ie.frame(:xpath, "//frame[@id='frame_1']").should exist
23
+ @browser.frame(:id, "frame_1").should exist
24
+ @browser.frame(:id, /frame/).should exist
25
+ @browser.frame(:name, "frame1").should exist
26
+ @browser.frame(:name, /frame/).should exist
27
+ @browser.frame(:src, "frame_1.html").should exist
28
+ @browser.frame(:src, /frame_1/).should exist
29
+ @browser.frame(:class, "half").should exist
30
+ @browser.frame(:class, /half/).should exist
31
+ @browser.frame(:index, 1).should exist
32
+ @browser.frame(:xpath, "//frame[@id='frame_1']").should exist
33
33
  end
34
34
  it "should return true if the iframe exists" do
35
- @ie.goto(TEST_HOST + "/iframes.html")
36
- @ie.frame(:id, "frame_1").should exist
37
- @ie.frame(:id, /frame/).should exist
38
- @ie.frame(:name, "frame1").should exist
39
- @ie.frame(:name, /frame/).should exist
40
- @ie.frame(:src, "frame_1.html").should exist
41
- @ie.frame(:src, /frame_1/).should exist
42
- @ie.frame(:class, "iframe").should exist
43
- @ie.frame(:class, /iframe/).should exist
44
- @ie.frame(:index, 1).should exist
45
- @ie.frame(:xpath, "//iframe[@id='frame_1']").should exist
35
+ @browser.goto(TEST_HOST + "/iframes.html")
36
+ @browser.frame(:id, "frame_1").should exist
37
+ @browser.frame(:id, /frame/).should exist
38
+ @browser.frame(:name, "frame1").should exist
39
+ @browser.frame(:name, /frame/).should exist
40
+ @browser.frame(:src, "frame_1.html").should exist
41
+ @browser.frame(:src, /frame_1/).should exist
42
+ @browser.frame(:class, "iframe").should exist
43
+ @browser.frame(:class, /iframe/).should exist
44
+ @browser.frame(:index, 1).should exist
45
+ @browser.frame(:xpath, "//iframe[@id='frame_1']").should exist
46
46
  end
47
47
  #TODO: default how = name
48
48
  it "should return false if the frame doesn't exist" do
49
- @ie.frame(:id, "no_such_id").should_not exist
50
- @ie.frame(:id, /no_such_id/).should_not exist
51
- @ie.frame(:name, "no_such_text").should_not exist
52
- @ie.frame(:name, /no_such_text/).should_not exist
53
- @ie.frame(:src, "no_such_src").should_not exist
54
- @ie.frame(:src, /no_such_src/).should_not exist
55
- @ie.frame(:class, "no_such_class").should_not exist
56
- @ie.frame(:class, /no_such_class/).should_not exist
57
- @ie.frame(:index, 1337).should_not exist
58
- @ie.frame(:xpath, "//frame[@id='no_such_id']").should_not exist
49
+ @browser.frame(:id, "no_such_id").should_not exist
50
+ @browser.frame(:id, /no_such_id/).should_not exist
51
+ @browser.frame(:name, "no_such_text").should_not exist
52
+ @browser.frame(:name, /no_such_text/).should_not exist
53
+ @browser.frame(:src, "no_such_src").should_not exist
54
+ @browser.frame(:src, /no_such_src/).should_not exist
55
+ @browser.frame(:class, "no_such_class").should_not exist
56
+ @browser.frame(:class, /no_such_class/).should_not exist
57
+ @browser.frame(:index, 1337).should_not exist
58
+ @browser.frame(:xpath, "//frame[@id='no_such_id']").should_not exist
59
59
  end
60
- it "should raise ArgumentError when what argument is invalid" do
61
- lambda { @ie.frame(:id, 3.14).exists? }.should raise_error(ArgumentError)
60
+ it "should raise ArgumentError when 'what' argument is invalid" do
61
+ lambda { @browser.frame(:id, 3.14).exists? }.should raise_error(ArgumentError)
62
62
  end
63
- it "should raise MissingWayOfFindingObjectException when how argument is invalid" do
64
- lambda { @ie.frame(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
63
+ it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
64
+ lambda { @browser.frame(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
65
65
  end
66
66
  end
67
67
 
68
68
  it "should raise UnknownFrameException when accessing elements inside non-existing frame" do
69
- lambda { @ie.frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
69
+ lambda { @browser.frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
70
70
  end
71
71
  it "should raise UnknownFrameException when accessing a non-existing frame" do
72
- lambda { @ie.frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
72
+ lambda { @browser.frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
73
73
  end
74
74
  it "should raise UnknownFrameException when accessing a non-existing subframe" do
75
- lambda { @ie.frame(:name, "frame1").frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
75
+ lambda { @browser.frame(:name, "frame1").frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
76
76
  end
77
77
  it "should raise UnknownObjectException when accessing a non-existing element inside an existing frame" do
78
- lambda { @ie.frame(:index, 1).p(:index, 1337).id }.should raise_error(UnknownObjectException)
78
+ lambda { @browser.frame(:index, 1).p(:index, 1337).id }.should raise_error(UnknownObjectException)
79
79
  end
80
80
  it "should be able to send a value to another frame by using Javascript" do
81
+ frame1, frame2 = @browser.frame(:index, 1), @browser.frame(:index, 2)
82
+ frame1.text_field(:index, 1).value.should == "send_this_value"
83
+ frame2.text_field(:index, 1).value.should == "old_value"
84
+ frame1.button(:index, 1).click
85
+ frame2.text_field(:index, 1).value.should == "send_this_value"
81
86
  end
82
87
 
83
88
  describe "#contains_text" do
84
89
  it "should find text in a frame" do
85
- @ie.frame(:name, 'frame1').contains_text('Suspendisse sit amet nisi.').should be_instance_of(Fixnum)
90
+ @browser.frame(:name, 'frame1').contains_text('Suspendisse sit amet nisi.').should be_instance_of(Fixnum)
86
91
  end
87
92
  it "should raise ArgumentError when given an invalid argument" do
88
- lambda { @ie.frame(:name, 'frame1').contains_text(3.14) }.should raise_error(ArgumentError)
93
+ lambda { @browser.frame(:name, 'frame1').contains_text(3.14) }.should raise_error(ArgumentError)
89
94
  end
90
95
  end
91
96
 
92
97
  describe "#to_s" do
93
98
  it "should return a human readable representation of the frame" do
94
- @ie.frame(:index, 1).to_s.should == "tag: frame\n" +
99
+ @browser.frame(:index, 1).to_s.should == "tag: frame\n" +
95
100
  " src: frame_1.html\n" +
96
101
  " id: frame_1\n" +
97
102
  " name: frame1\n" +
data/spec/hidden_spec.rb CHANGED
@@ -5,50 +5,50 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
5
5
  describe "Hidden" do
6
6
 
7
7
  before :all do
8
- @ie = IE.new
9
- add_spec_checker(@ie)
8
+ @browser = IE.new
9
+ add_spec_checker(@browser)
10
10
  end
11
11
 
12
12
  before :each do
13
- @ie.goto(TEST_HOST + "/forms_with_input_elements.html")
13
+ @browser.goto(TEST_HOST + "/forms_with_input_elements.html")
14
14
  end
15
15
 
16
16
  # Exist method
17
17
  describe "#exists?" do
18
18
  it "should return true if the element exists" do
19
- @ie.hidden(:id, 'new_user_interests_dolls').should exist
20
- @ie.hidden(:id, /new_user_interests_dolls/).should exist
21
- @ie.hidden(:name, 'new_user_interests').should exist
22
- @ie.hidden(:name, /new_user_interests/).should exist
23
- @ie.hidden(:value, 'dolls').should exist
24
- @ie.hidden(:value, /dolls/).should exist
25
- #need to figure out what :text means
26
- @ie.hidden(:text, 'dolls').should exist
27
- @ie.hidden(:text, /dolls/).should exist
28
- @ie.hidden(:class, 'fun').should exist
29
- @ie.hidden(:class, /fun/).should exist
30
- @ie.hidden(:index, 1).should exist
31
- @ie.hidden(:xpath, "//input[@id='new_user_interests_dolls']").should exist
19
+ @browser.hidden(:id, 'new_user_interests_dolls').should exist
20
+ @browser.hidden(:id, /new_user_interests_dolls/).should exist
21
+ @browser.hidden(:name, 'new_user_interests').should exist
22
+ @browser.hidden(:name, /new_user_interests/).should exist
23
+ @browser.hidden(:value, 'dolls').should exist
24
+ @browser.hidden(:value, /dolls/).should exist
25
+ # TODO: figure out what :text means for Hidden
26
+ # @browser.hidden(:text, 'dolls').should exist
27
+ # @browser.hidden(:text, /dolls/).should exist
28
+ @browser.hidden(:class, 'fun').should exist
29
+ @browser.hidden(:class, /fun/).should exist
30
+ @browser.hidden(:index, 1).should exist
31
+ @browser.hidden(:xpath, "//input[@id='new_user_interests_dolls']").should exist
32
32
  end
33
33
  it "should return false if the element does not exist" do
34
- @ie.hidden(:id, 'no_such_id').should_not exist
35
- @ie.hidden(:id, /no_such_id/).should_not exist
36
- @ie.hidden(:name, 'no_such_name').should_not exist
37
- @ie.hidden(:name, /no_such_name/).should_not exist
38
- @ie.hidden(:value, 'no_such_value').should_not exist
39
- @ie.hidden(:value, /no_such_value/).should_not exist
40
- @ie.hidden(:text, 'no_such_text').should_not exist
41
- @ie.hidden(:text, /no_such_text/).should_not exist
42
- @ie.hidden(:class, 'no_such_class').should_not exist
43
- @ie.hidden(:class, /no_such_class/).should_not exist
44
- @ie.hidden(:index, 1337).should_not exist
45
- @ie.hidden(:xpath, "//input[@id='no_such_id']").should_not exist
34
+ @browser.hidden(:id, 'no_such_id').should_not exist
35
+ @browser.hidden(:id, /no_such_id/).should_not exist
36
+ @browser.hidden(:name, 'no_such_name').should_not exist
37
+ @browser.hidden(:name, /no_such_name/).should_not exist
38
+ @browser.hidden(:value, 'no_such_value').should_not exist
39
+ @browser.hidden(:value, /no_such_value/).should_not exist
40
+ @browser.hidden(:text, 'no_such_text').should_not exist
41
+ @browser.hidden(:text, /no_such_text/).should_not exist
42
+ @browser.hidden(:class, 'no_such_class').should_not exist
43
+ @browser.hidden(:class, /no_such_class/).should_not exist
44
+ @browser.hidden(:index, 1337).should_not exist
45
+ @browser.hidden(:xpath, "//input[@id='no_such_id']").should_not exist
46
46
  end
47
- it "should raise ArgumentError when what argument is invalid" do
48
- lambda { @ie.hidden(:id, 3.14).exists? }.should raise_error(ArgumentError)
47
+ it "should raise ArgumentError when 'what' argument is invalid" do
48
+ lambda { @browser.hidden(:id, 3.14).exists? }.should raise_error(ArgumentError)
49
49
  end
50
- it "should raise MissingWayOfFindingObjectException when how argument is invalid" do
51
- lambda { @ie.hidden(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
50
+ it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
51
+ lambda { @browser.hidden(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
52
52
  end
53
53
  end
54
54
 
@@ -56,50 +56,50 @@ describe "Hidden" do
56
56
  # Attribute methods
57
57
  describe "#id" do
58
58
  it "should return the id attribute if the text field exists" do
59
- @ie.hidden(:index, 1).id.should == "new_user_interests_dolls"
59
+ @browser.hidden(:index, 1).id.should == "new_user_interests_dolls"
60
60
  end
61
61
  it "should raise UnknownObjectException if the text field doesn't exist" do
62
- lambda { @ie.hidden(:index, 1337).id }.should raise_error(UnknownObjectException)
62
+ lambda { @browser.hidden(:index, 1337).id }.should raise_error(UnknownObjectException)
63
63
  end
64
64
  end
65
65
 
66
66
  describe "#name" do
67
67
  it "should return the name attribute if the text field exists" do
68
- @ie.hidden(:index, 1).name.should == "new_user_interests"
68
+ @browser.hidden(:index, 1).name.should == "new_user_interests"
69
69
  end
70
70
  it "should raise UnknownObjectException if the text field doesn't exist" do
71
- lambda { @ie.hidden(:index, 1337).name }.should raise_error(UnknownObjectException)
71
+ lambda { @browser.hidden(:index, 1337).name }.should raise_error(UnknownObjectException)
72
72
  end
73
73
  end
74
74
 
75
75
  describe "#type" do
76
76
  it "should return the type attribute if the text field exists" do
77
- @ie.hidden(:index, 1).type.should == "hidden"
77
+ @browser.hidden(:index, 1).type.should == "hidden"
78
78
  end
79
79
  it "should raise UnknownObjectException if the text field doesn't exist" do
80
- lambda { @ie.hidden(:index, 1337).type }.should raise_error(UnknownObjectException)
80
+ lambda { @browser.hidden(:index, 1337).type }.should raise_error(UnknownObjectException)
81
81
  end
82
82
  end
83
83
 
84
84
  describe "#value" do
85
85
  it "should return the value attribute if the text field exists" do
86
- @ie.hidden(:index, 1).value.should == "dolls"
86
+ @browser.hidden(:index, 1).value.should == "dolls"
87
87
  end
88
88
  it "should raise UnknownObjectException if the text field doesn't exist" do
89
- lambda { @ie.hidden(:index, 1337).value }.should raise_error(UnknownObjectException)
89
+ lambda { @browser.hidden(:index, 1337).value }.should raise_error(UnknownObjectException)
90
90
  end
91
91
  end
92
92
 
93
93
  # Manipulation methods
94
94
  describe "#value=" do
95
95
  it "should set the value of the element" do
96
- @ie.hidden(:id, 'new_user_interests_dolls').value = 'guns'
97
- @ie.hidden(:id, "new_user_interests_dolls").value.should == 'guns'
96
+ @browser.hidden(:id, 'new_user_interests_dolls').value = 'guns'
97
+ @browser.hidden(:id, "new_user_interests_dolls").value.should == 'guns'
98
98
  end
99
99
  end
100
100
 
101
101
  after :all do
102
- @ie.close
102
+ @browser.close
103
103
  end
104
104
  end
105
105