Created
July 17, 2012 14:18
-
-
Save bbonamin/3129666 to your computer and use it in GitHub Desktop.
Capybara drag and drop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shared_examples_for "driver with javascript support" do | |
before { @driver.visit('/with_js') } | |
describe '#find' do | |
it "should find dynamically changed nodes" do | |
@driver.find('//p').first.text.should == 'I changed it' | |
end | |
end | |
describe '#drag_to' do | |
it "should drag and drop an object" do | |
draggable = @driver.find('//div[@id="drag"]').first | |
droppable = @driver.find('//div[@id="drop"]').first | |
draggable.drag_to(droppable) | |
@driver.find('//div[contains(., "Dropped!")]').should_not be_nil | |
end | |
end | |
describe "#evaluate_script" do | |
it "should return the value of the executed script" do | |
@driver.evaluate_script('1+1').should == 2 | |
end | |
end | |
end | |
(http://blog.plataformatec.com.br/2010/04/best-ruby-open-source-test-suites-awards/) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment