features/step_definitions/frames_steps.rb in page-object-0.9.5 vs features/step_definitions/frames_steps.rb in page-object-0.9.6
- old
+ new
@@ -26,17 +26,44 @@
text_field(:text_field_2_regex, :name => 'recieverElement', :frame => frame)
end
end
+class IFramePage
+ include PageObject
+
+ in_iframe(:id => 'frame_two_2') do |frame|
+ text_field(:text_field_2_id, :name => 'recieverElement', :frame => frame)
+ end
+ in_iframe(:id => 'frame_one_1') do |frame|
+ text_field(:text_field_1_id, :name => 'senderElement', :frame => frame)
+ end
+
+ in_iframe(:name => 'frame2') do |frame|
+ text_field(:text_field_2_name, :name => 'recieverElement', :frame => frame)
+ end
+ in_iframe(:name => 'frame1') do |frame|
+ text_field(:text_field_1_name, :name => 'senderElement', :frame => frame)
+ end
+
+ in_iframe(:index => 1) do |frame|
+ text_field(:text_field_2_index, :name => 'recieverElement', :frame => frame)
+ end
+ in_iframe(:index => 0) do |frame|
+ text_field(:text_field_1_index, :name => 'senderElement', :frame => frame)
+ end
+
+end
+
+
Given /^I am on the frame elements page$/ do
@page = FramePage.new(@browser)
@page.navigate_to(UrlHelper.frame_elements)
end
Given /^I am on the iframe elements page$/ do
- @page = FramePage.new(@browser)
+ @page = IFramePage.new(@browser)
@page.navigate_to(UrlHelper.iframe_elements)
end
When /^I type "([^\"]*)" into the text field for frame 2 using "([^\"]*)"$/ do |text, arg_type|
@page.send "text_field_2_#{arg_type}=".to_sym, text
@@ -62,10 +89,10 @@
class NestedFramePage
include PageObject
in_frame(:id => 'two') do |frame|
- in_frame({:id => 'three'}, frame) do |nested_frame|
+ in_iframe({:id => 'three'}, frame) do |nested_frame|
link(:nested_link, :id => 'four', :frame => nested_frame)
end
end
end