user-delete-spec.rb
应用的user-edit-spec.rb
和Failures:
1) User delete user can delete own account
Failure/Error: visit edit_user_registration_path(user)
Selenium::WebDriver::Error::ServerError:
status code 500
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/response.rb:72:in `assert_ok'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/response.rb:32:in `initialize'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/http/common.rb:83:in `new'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/http/common.rb:83:in `create_response'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/http/default.rb:107:in `request'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/http/common.rb:61:in `call'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/w3c_bridge.rb:640:in `execute'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/w3c_bridge.rb:114:in `create_session'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/w3c_bridge.rb:76:in `initialize'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/firefox/w3c_bridge.rb:45:in `initialize'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/common/driver.rb:52:in `new'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/common/driver.rb:52:in `for'
# /home/rof/cache/bundler/ruby/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver.rb:88:in `for'
# /home/rof/cache/bundler/ruby/2.3.0/gems/capybara-2.14.0/lib/capybara/selenium/driver.rb:22:in `browser'
# /home/rof/cache/bundler/ruby/2.3.0/gems/capybara-2.14.0/lib/capybara/selenium/driver.rb:62:in `visit'
# /home/rof/cache/bundler/ruby/2.3.0/gems/capybara-2.14.0/lib/capybara/session.rb:269:in `visit'
# /home/rof/cache/bundler/ruby/2.3.0/gems/capybara-2.14.0/lib/capybara/dsl.rb:50:in `block (2 levels) in <module:DSL>'
# ./spec/features/users/user_delete_spec.rb:21:in `block (2 levels) in <top (required)>'
2) User edit user changes email address
Failure/Error: visit edit_user_registration_path(user)
Selenium::WebDriver::Error::ServerError:
status code 500
# [removed stack trace]
3) User edit user cannot cannot edit another user's profile
Failure/Error: visit edit_user_registration_path(other)
Selenium::WebDriver::Error::ServerError:
status code 500
# [removed stack trace]
Finished in 23.21 seconds (files took 2.99 seconds to load)
31 examples, 3 failures
Failed examples:
rspec ./spec/features/users/user_delete_spec.rb:18 # User delete user can delete own account
rspec ./spec/features/users/user_edit_spec.rb:18 # User edit user changes email address
rspec ./spec/features/users/user_edit_spec.rb:45 # User edit user cannot cannot edit another user's profile
的Selenium测试在Codeship的CI中运行时似乎会中断。 rspec在我的本地机器上工作正常,但在Codeship中断了。
我得到的rspec输出如下:
scenario 'user can delete own account' do
# skip 'skip a slow test' [removed from the original file]
user = FactoryGirl.create(:user)
login_as(user, :scope => :user)
visit edit_user_registration_path(user)
click_button 'Cancel my account'
page.driver.browser.switch_to.alert.accept
expect(page).to have_content I18n.t 'devise.registrations.destroyed'
end
这是其中一个失败方案的示例:
<a href="#" style="background-color:red; display:inline-block; height:100px;">Don’t click me</a>
这里出了什么问题,如何修改这个以便测试通过? (为了澄清,我在本地部署的任何页面上都没有错误500,也没有基于rails-devise-roles的我的应用程序的Heroku实时部署。)
答案 0 :(得分:0)
与Codeship支持人员联系,他们非常乐于助人,并告诉我这是一个问题,Firefox和geckodriver都需要在Codeship VM上更新Firefox。如果其他人也遇到此问题,那么使其工作的代码如下:
export FIREFOX_VERSION=53.0.3
curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/firefox.sh | bash -s
export GECKODRIVER_VERSION=0.17.0
source /dev/stdin <<< "$(curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/languages/rust.sh)"
curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/geckodriver.sh | bash -s
来自Codeship支持团队的Joe Siewert向我提出这个问题的巨大道具!