page-object 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -87,6 +87,11 @@ describe PageObject::Accessors do
87
87
  let(:watir_page_object) { AccessorsTestPageObject.new(watir_browser) }
88
88
  let(:selenium_page_object) { AccessorsTestPageObject.new(selenium_browser) }
89
89
  let(:block_page_object) { BlockPageObject.new(watir_browser) }
90
+
91
+ before(:each) do
92
+ selenium_browser.stub(:switch_to).and_return(selenium_browser)
93
+ selenium_browser.stub(:default_content)
94
+ end
90
95
 
91
96
  describe "goto a page" do
92
97
  it "should navigate to a page when requested" do
@@ -186,7 +191,8 @@ describe PageObject::Accessors do
186
191
  end
187
192
 
188
193
  it "should set some text on a text field element" do
189
- selenium_browser.should_receive(:find_element).and_return(selenium_browser)
194
+ selenium_browser.should_receive(:find_element).twice.and_return(selenium_browser)
195
+ selenium_browser.should_receive(:clear)
190
196
  selenium_browser.should_receive(:send_keys).with('Katie')
191
197
  selenium_page_object.first_name = 'Katie'
192
198
  end
@@ -157,6 +157,12 @@ describe PageObject::Elements::Element do
157
157
  watir_driver.should_receive(:send_keys).with([:control, 'a'])
158
158
  watir_element.send_keys([:control, 'a'])
159
159
  end
160
+
161
+ it "should clear its' contents" do
162
+ watir_driver.should_receive(:clear)
163
+ watir_element.clear
164
+ end
165
+
160
166
  end
161
167
 
162
168
  context "when using Selenium" do
@@ -241,5 +247,10 @@ describe PageObject::Elements::Element do
241
247
  selenium_driver.should_receive(:send_keys).with([:control, 'a'])
242
248
  selenium_element.send_keys([:control, 'a'])
243
249
  end
250
+
251
+ it "should clear its' contents" do
252
+ selenium_driver.should_receive(:clear)
253
+ selenium_element.clear
254
+ end
244
255
  end
245
256
  end
@@ -95,13 +95,6 @@ describe PageObject do
95
95
  watir_page_object.attach_to_window(:url => "success.html")
96
96
  end
97
97
 
98
- it "should switch to a new frame by index" do
99
- watir_browser.should_receive(:wd).and_return(watir_browser)
100
- watir_browser.should_receive(:switch_to).and_return(watir_browser)
101
- watir_browser.should_receive(:frame).with(0)
102
- watir_page_object.switch_to_frame(0)
103
- end
104
-
105
98
  it "should refresh the page contents" do
106
99
  watir_browser.should_receive(:refresh)
107
100
  watir_page_object.refresh
@@ -169,12 +162,6 @@ describe PageObject do
169
162
  selenium_page_object.attach_to_window(:url => "page.html")
170
163
  end
171
164
 
172
- it "should switch to a new frame by index" do
173
- selenium_browser.should_receive(:switch_to).and_return(selenium_browser)
174
- selenium_browser.should_receive(:frame).with(0)
175
- selenium_page_object.switch_to_frame(0)
176
- end
177
-
178
165
  it "should refresh the page contents" do
179
166
  selenium_browser.should_receive(:navigate).and_return(selenium_browser)
180
167
  selenium_browser.should_receive(:refresh)
@@ -9,6 +9,11 @@ end
9
9
  describe PageObject::Platforms::Selenium::PageObject do
10
10
  let(:selenium_browser) { mock_selenium_browser }
11
11
  let(:selenium_page_object) { SeleniumTestPageObject.new(selenium_browser) }
12
+
13
+ before(:each) do
14
+ selenium_browser.stub(:switch_to).and_return(selenium_browser)
15
+ selenium_browser.stub(:default_content)
16
+ end
12
17
 
13
18
  context "when building identifiers hash" do
14
19
  it "should add tag_name when identifying by text for hidden_field" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: page-object
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeff Morgan
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-29 00:00:00 Z
13
+ date: 2011-08-01 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: watir-webdriver
@@ -91,6 +91,7 @@ files:
91
91
  - features/button.feature
92
92
  - features/check_box.feature
93
93
  - features/div.feature
94
+ - features/element.feature
94
95
  - features/element_attributes.feature
95
96
  - features/form.feature
96
97
  - features/frames.feature
@@ -100,6 +101,10 @@ files:
100
101
  - features/html/frames.html
101
102
  - features/html/iframes.html
102
103
  - features/html/images/circle.png
104
+ - features/html/nested_frame_1.html
105
+ - features/html/nested_frame_2.html
106
+ - features/html/nested_frame_3.html
107
+ - features/html/nested_frames.html
103
108
  - features/html/static_elements.html
104
109
  - features/html/success.html
105
110
  - features/image.feature
@@ -127,6 +132,7 @@ files:
127
132
  - features/unordered_list.feature
128
133
  - lib/page-object.rb
129
134
  - lib/page-object/accessors.rb
135
+ - lib/page-object/core_ext/string.rb
130
136
  - lib/page-object/elements.rb
131
137
  - lib/page-object/elements/button.rb
132
138
  - lib/page-object/elements/check_box.rb
@@ -233,6 +239,7 @@ test_files:
233
239
  - features/button.feature
234
240
  - features/check_box.feature
235
241
  - features/div.feature
242
+ - features/element.feature
236
243
  - features/element_attributes.feature
237
244
  - features/form.feature
238
245
  - features/frames.feature
@@ -242,6 +249,10 @@ test_files:
242
249
  - features/html/frames.html
243
250
  - features/html/iframes.html
244
251
  - features/html/images/circle.png
252
+ - features/html/nested_frame_1.html
253
+ - features/html/nested_frame_2.html
254
+ - features/html/nested_frame_3.html
255
+ - features/html/nested_frames.html
245
256
  - features/html/static_elements.html
246
257
  - features/html/success.html
247
258
  - features/image.feature