我正在通过rspec玩selenium,但不满意,我看到了给捣蛋鬼的建议。当我尝试用我的测试运行它时,它似乎没有出现在它应该出现的地方。我有点困惑,在哪里架测试适合恶作剧,但我尝试了许多不同的东西。然后,我找到了这个简单的例子,并试图让它发挥作用,但仍然没有运气。我在windows上使用jruby。
我正在使用以下示例:https://gist.github.com/pzol/1607842 --我将所有代码移动到一个文件中,本例中没有规范助手
我确实安装了幻影,并为幻影运行了一个小小的hello world示例,它就在我的路径上。
require 'rspec'
require 'capybara/rspec'
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, debug: true)
end
describe 'poltergeist', :type => :request, :js => true do
it 'should find github poltergeist in google' do
visit 'http://www.google.com/'
fill_in "q", :with => "github poltergeist"
click_button "btnK"
page.should have_content 'jonleighton/poltergeist'
end
endjruby -S rspec poltergeist-test2.rb F
失败:
1) poltergeist应该在google Failure/Error中找到github poltergeist:http://www.google.com/‘NoMethodError:未定义的方法visit' for #<RSpec::Core::ExampleGroup::Nested_1:0x4324 4fd9> # ./poltergeist-test2.rb:18:in(root)’
0.01秒内完成1例,1例失败
失败的例子:
rspec ./ poltergeist -test2.rb:17 # poltergeist应该在google中找到github poltergeist
发布于 2013-10-30 15:07:41
嗯,好吧,我又看了一些水豚的文档,我改变了这句话:
describe 'poltergeist', :type => :request, :js => true do在这一行中,我做了:输入to be :feature,现在它似乎还可以。
describe 'poltergeist', :type => :feature, :js => true do似乎在我的谷歌搜索前几天,我看到了一些东西,但我不确定,目前我不清楚有什么区别,但我正在取得进展,它似乎
https://stackoverflow.com/questions/19684402
复制相似问题