gpt4 book ai didi

ruby-on-rails - travis ci 和 selenium-webdriver 无法在 60 秒内获得稳定的 firefox 连接 (127.0.0.1 :7055)

转载 作者:行者123 更新时间:2023-12-04 06:12:01 24 4
gpt4 key购买 nike

我有一个正在开发的博客,我添加了一些 javascript 以在您单击新帖子时弹出该博客的表单。一切正常。我使用 minitest 和 capybara 进行了测试,我安装了 gem selenium-webdriver,当我在本地测试时一切正常。但是,当我推送到 Github 并且 travis-ci 获取我的信息并运行我的测试时,它给了我这个错误

unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)

我有点困惑,因为在我将 gem selenium-webdriver 更新到版本 2.39.0 之前,我一直在本地遇到该错误。据我所知,我刚刚下载了 firefox,一切都是最新的。如果有帮助,这里是我的一些文件。

我的测试

feature "as a student I want a working blog so people can post" do
# this is line 10
scenario "User can make a post", :js => true do
dude_sign_up
dude_log_in
visit posts_path
click_on "New Post"
create_post
page.must_have_content "Post was successfully created"
end
# this is line 19

gem 文件

group :development, :test do
gem 'sqlite3'
gem 'minitest-rails'
gem 'launchy'
gem 'coveralls', require: false
gem 'minitest-rails-capybara'
gem 'turn'
gem 'pry'
gem "selenium-webdriver", "~> 2.39.0"
end

.travis.yml文件

language: ruby
rvm:
- "2.0.0"
env:
- DB=sqlite
script:
- RAILS_ENV=test bundle exec rake db:migrate --trace
- bundle exec rake db:test:prepare
- rake minitest:features
bundler_args: --binstubs=./bundler_stubs

测试辅助文件

require 'simplecov'
SimpleCov.start 'rails'
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment", __FILE__)
require "rails/test_help"
require "minitest/rails"
require "minitest/rails/capybara"
require 'selenium-webdriver'
require 'coveralls'
Coveralls.wear!

# To add Capybara feature tests add `gem "minitest-rails-capybara"`
# to the test group in the Gemfile and uncomment the following:
# require "minitest/rails/capybara"

# Uncomment for awesome colorful output
# require "minitest/pride"

class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
fixtures :all

# Add more helper methods to be used by all tests here...
end

class ActionDispatch::IntegrationTest
include Rails.application.routes.url_helpers
#include Capybara::RSpecMatchers
include Capybara::DSL
end

Turn.config.format = :outline

def dude_sign_up
visit new_user_path
fill_in "Name", with: "thedude"
fill_in "Email", with: "thedude@cool.com"
fill_in "Password", with: 'password'
fill_in "Bio", with: "the bio"
fill_in "Password confirmation", with: 'password'
click_on "Submit"
end

def dude_log_in
visit new_session_path
fill_in "Email", with: "thedude@cool.com"
fill_in "Password", with: 'password'
click_on "Log In"
end

def create_post
fill_in "Title", with: "this is a test title"
fill_in "Content", with: "oh how this is some crazzzzy content"
click_on "Create Post"
end

travis 完全错误

test_0002_User can make a post                            1:00:23.767 ERROR
unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
Exception `Selenium::WebDriver::Error::WebDriverError' at:
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/firefox/launcher.rb:79:in `connect_until_stable'
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/firefox/launcher.rb:37:in `block in launch'
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/firefox/socket_lock.rb:20:in `locked'
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/firefox/launcher.rb:32:in `launch'
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/firefox/bridge.rb:24:in `initialize'
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/common/driver.rb:31:in `new'
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver/common/driver.rb:31:in `for'
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/selenium-webdriver-2.39.0/lib/selenium/webdriver.rb:67:in `for'
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/capybara-2.1.0/lib/capybara/selenium/driver.rb:11:in `browser'
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/capybara-2.1.0/lib/capybara/selenium/driver.rb:43:in `visit'
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/capybara-2.1.0/lib/capybara/session.rb:193:in `visit'
/home/travis/.rvm/gems/ruby-2.0.0-p353/gems/capybara-2.1.0/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
test/test_helper.rb:35:in `dude_sign_up'
test/features/blog_system_works_test.rb:12:in `block (2 levels) in <top (required)>'

有谁知道为什么这在本地有效但在 travis-ci 中无效?

最佳答案

嘿,雷克,你给我指明了正确的方向;然而,我发现问题出在我的 .travis.yml 文件中

如果你去

http://karma-runner.github.io/0.8/plus/Travis-CI.html

他们会告诉你要设置 travis 以使用 firefox 你需要添加

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

到您的 travis 文件。

将我的 .travis.yml 文件更改为

language: ruby
rvm:
- "2.0.0"
env:
- DB=sqlite
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script:
- RAILS_ENV=test bundle exec rake db:migrate --trace
- bundle exec rake db:test:prepare
- rake minitest:features
bundler_args: --binstubs=./bundler_stubs

travis 一切正常

关于ruby-on-rails - travis ci 和 selenium-webdriver 无法在 60 秒内获得稳定的 firefox 连接 (127.0.0.1 :7055),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21065812/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com