added specs for with_frame
This commit is contained in:
parent
8ad161b041
commit
28605a5d9c
|
@ -1,7 +1,7 @@
|
|||
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
||||
|
||||
shared_examples_for 'driver with frame support' do
|
||||
it_should_behave_like 'within_frame'
|
||||
it_should_behave_like 'with_frame'
|
||||
end
|
||||
shared_examples_for 'driver' do
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
module WithFrameSpec
|
||||
shared_examples_for "with_frame" do
|
||||
describe '#with_frame' do
|
||||
before(:each) do
|
||||
@driver.visit('/with_frames')
|
||||
end
|
||||
|
||||
it "should find the div in frameOne" do
|
||||
@driver.with_frame("frameOne") do
|
||||
@driver.find("//*[@id='divInFrameOne']")[0].text.should eql 'This is the text of divInFrameOne'
|
||||
end
|
||||
end
|
||||
it "should find the div in FrameTwo" do
|
||||
@driver.with_frame("frameTwo") do
|
||||
@driver.find("//*[@id='divInFrameTwo']")[0].text.should eql 'This is the text of divInFrameTwo'
|
||||
end
|
||||
end
|
||||
it "should find the text div in the main window after finding text in frameOne" do
|
||||
@driver.with_frame("frameOne") do
|
||||
@driver.find("//*[@id='divInFrameOne']")[0].text.should eql 'This is the text of divInFrameOne'
|
||||
end
|
||||
@driver.find("//*[@id='divInMainWindow']")[0].text.should eql 'This is the text for divInMainWindow'
|
||||
end
|
||||
it "should find the text div in the main window after finding text in frameTwo" do
|
||||
@driver.with_frame("frameTwo") do
|
||||
@driver.find("//*[@id='divInFrameTwo']")[0].text.should eql 'This is the text of divInFrameTwo'
|
||||
end
|
||||
@driver.find("//*[@id='divInMainWindow']")[0].text.should eql 'This is the text for divInMainWindow'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>This is the title of frame one</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="divInFrameOne">This is the text of divInFrameOne</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>This is the title of frame two</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="divInFrameTwo">This is the text of divInFrameTwo</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>With Frames</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="divInMainWindow">This is the text for divInMainWindow</div>
|
||||
<iframe src="/frame_one" id="frameOne"></iframe>
|
||||
<iframe src="/frame_two" id="frameTwo"></iframe>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue