mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Fixed bug with within_frame session method and changed naming in spec
This commit is contained in:
parent
1e096ddcc0
commit
35c7089037
2 changed files with 11 additions and 9 deletions
|
@ -34,7 +34,9 @@ module Capybara
|
|||
end
|
||||
|
||||
def within_frame frame_id
|
||||
driver.within_frame frame_id
|
||||
driver.within_frame(frame_id) do
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
def current_url
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
module WithFrameSpec
|
||||
shared_examples_for "with_frame" do
|
||||
describe '#with_frame' do
|
||||
module WithinFrameSpec
|
||||
shared_examples_for "within_frame" do
|
||||
describe '#within_frame' do
|
||||
before(:each) do
|
||||
@driver.visit('/with_frames')
|
||||
@driver.visit('/within_frames')
|
||||
end
|
||||
|
||||
it "should find the div in frameOne" do
|
||||
@driver.with_frame("frameOne") do
|
||||
@driver.within_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.within_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.within_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.within_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'
|
||||
|
|
Loading…
Reference in a new issue