Created
January 16, 2013 13:21
-
-
Save jean-francois-labbe/4547098 to your computer and use it in GitHub Desktop.
while rspec executes the test 'can see document sections linked to an Aipo' capybara founds the img but the click action does nothing. the page doesn't load.
When I use the command prompt to interact with capybara it works si Console_input file
This file contains hidden or 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
require "selenium-webdriver" | |
require 'capybara/dsl' | |
Capybara.default_driver = :selenium | |
Capybara.default_selector = :css | |
Capybara.default_wait_time = 5 | |
Capybara.app_host = 'http://localhost:8080/TM' | |
CapybaraApi = Object.new | |
CapybaraApi.extend(Capybara) | |
require 'irb' | |
def IRB.start_capybara_console | |
IRB.setup(__FILE__) | |
irb = IRB::Irb.new(IRB::WorkSpace.new(CapybaraApi)) | |
@CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC] | |
@CONF[:MAIN_CONTEXT] = irb.context | |
trap("SIGINT") do | |
irb.signal_handle | |
end | |
begin | |
catch(:IRB_EXIT) do | |
irb.eval_input | |
end | |
ensure | |
irb_at_exit | |
end | |
end | |
IRB.start_capybara_console |
This file contains hidden or 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
Capybara.find(:xpath,"//img[@alt='viewActor119']").click | |
# the link is found and the click action opens the web page |
This file contains hidden or 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
require 'spec_helper' | |
describe 'Aipo' do | |
context 'editor' do | |
before(:each){ | |
login_with(get_tf_editor) | |
visit '/tf/actor/listActors.seam' | |
} | |
it 'can see document sections linked to an Aipo', :js => true do | |
find(:xpath,"//img[@alt='viewActor119']").click ## The image is found the the click does nothing | |
page.should have_content('Edit') | |
end | |
end | |
end |
This file contains hidden or 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
<td> | |
<img id="listActorsResultsForm:actorList:1:viewActionImage" src="/TM/img/icons64/kfind.gif" alt="viewActor119" height="28" onclick="A4J.AJAX.Submit('listActorsResultsForm',event,{'similarityGroupingId':'listActorsResultsForm:actorList:1:j_id712','parameters':{'listActorsResultsForm:actorList:1:j_id712':'listActorsResultsForm:actorList:1:j_id712'} } )" style="cursor:pointer;" title="Voir" width="28"> | |
</td> |
This file contains hidden or 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
require 'rspec' | |
require 'capybara' | |
module CapybaraStandalone | |
def self.setup | |
Capybara.configure do |config| | |
config.app_host = 'http://localhost:8080/TM' | |
config.run_server = false | |
config.default_driver = :selenium | |
# config.javascript_driver = :webkit | |
end | |
end | |
end | |
Dir["./spec/helpers/*.rb"].each {|f| require f} | |
RSpec.configure do |config| | |
config.include Capybara::DSL | |
config.include User | |
config.before(:all) do | |
CapybaraStandalone.setup | |
end | |
config.after do | |
Capybara.reset_sessions! | |
Capybara.use_default_driver | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment