我正在尝试仅在纯 Ruby 中运行没有 Rails、Cucumber、Rspec 的 Capybara。
我的测试脚本如下所示:
require 'capybara'
require 'selenium-webdriver'
url = "MyAccessKey"
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
capabilities.platform = :LINUX
Capybara.register_driver :sauce do |app|
Capybara::Selenium::Driver.new(app,
:browser => :remote, :url => url,
:desired_capabilities => capabilities)
end
Capybara.default_driver=:sauce
Capybara.app_host="127.0.0.1:8888"
include Capybara::DSL
# include Capybara::RSpecMatchers
visit('')
feature "Signing in" do
scenario "Should sign in" do
within ('#form_content') do
fill_in 'login',:with=>'user'
fill_in 'password',:with=>'pwd'
find(:xpath,'//input[@type="submit"]').click
end
end
end
visit
工作正常......但feature and scenario
给出了 NoMethodError。我应该在这里包括任何东西吗?