I am using Cucumber + Webrat + Mechanize adapter and want to test contents of pages that are iframed or framed into the selected page.
In other words:
Scenario: View header on webpage
Given I visit a page containing a frameset
When there is a header frame
Then I should see login details in frame header
The problem is of course the last step: I need to navigate to the frame header and investigate it's contents. I can verify the frame tag is here
response_body.should have_selector "frame[src][name=header]"
This leaves me with two questions:
This would answer the first part of the question
Then /^I should see login details in frame header$/ do
within 'frame[name=header]' do |frame|
frame_src = frame.dom.attributes["src"].value
visit frame_src
response_body.should contain "Log in with digital certificate"
response_body.should_not contain "Log out"
end
end