我们有一个中间人网站正在运行一些水豚验收测试。一切都可以在测试环境之外找到,但是我们尝试使用capybara和selenium,所以我们可以通过send_keys方法https://github.com/thoughtbot/capybara-webkit/issues/870
测试codemirror编辑器元素我们的spec_helper.rb如下所示:
require 'middleman'
require 'rspec'
require 'capybara/rspec'
require 'middleman-core/load_paths'
Middleman.setup_load_paths
Capybara.default_driver = :selenium
Capybara.app = Middleman::Application.server.inst do
set :root, File.expand_path(File.join(File.dirname(__FILE__), '..'))
set :environment, :test
set :show_exceptions, false
end
Selenium为我们打开了firefox浏览器,但是我们遇到了以下问题:
Error: File to import not found or unreadable: makers_styles.
Load paths:
/Users/tansaku/Documents/Github/MakersAcademy/apply/source/stylesheets
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/compass-core-1.0.3/stylesheets
Compass::SpriteImporter
on line 5 of /Users/tansaku/Documents/Github/MakersAcademy/apply/source/stylesheets/site.css.scss
1: //= require _vendor/pygment_solarized_light
2: //= require _vendor/codemirror-solarized
3: //= require codemirror
4:
5: @import "makers_styles";
6:
7: .align-left {
8: text-align: left;
9: }
10:
使用网络面板我可以看到进一步的回溯:
Backtrace:
/Users/tansaku/Documents/Github/MakersAcademy/apply/source/stylesheets/site.css.scss:5
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/import_node.rb:67:in `rescue in import'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/import_node.rb:45:in `import'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/import_node.rb:28:in `imported_file'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/import_node.rb:37:in `css_import?'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/perform.rb:311:in `visit_import'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/stack.rb:79:in `block in with_base'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/stack.rb:115:in `with_frame'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/stack.rb:79:in `with_base'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/perform.rb:158:in `visit'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/base.rb:52:in `map'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/base.rb:52:in `visit_children'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/perform.rb:186:in `visit_root'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/perform.rb:157:in `visit'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/visitors/perform.rb:8:in `visit'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/root_node.rb:36:in `css_tree'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/tree/root_node.rb:20:in `render'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/sass-3.4.21/lib/sass/engine.rb:278:in `render'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/compass-import-once-1.0.5/lib/compass/import-once/engine.rb:17:in `block in render'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/compass-import-once-1.0.5/lib/compass/import-once/engine.rb:29:in `with_import_scope'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/compass-import-once-1.0.5/lib/compass/import-once/engine.rb:16:in `render'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/renderers/sass.rb:87:in `evaluate'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/rendering.rb:303:in `render_individual_file'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/rendering.rb:181:in `_render_with_all_renderers'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/rendering.rb:149:in `render_template'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/sitemap/resource.rb:127:in `block in render'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/activesupport-4.1.14/lib/active_support/notifications.rb:161:in `instrument'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/util.rb:41:in `instrument'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/application.rb:235:in `instrument'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/sitemap/resource.rb:14:in `instrument'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/sitemap/resource.rb:100:in `render'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/request.rb:260:in `process_request'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/request.rb:210:in `block in call!'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/request.rb:209:in `catch'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/request.rb:209:in `call!'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/request.rb:195:in `call'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/capybara-2.5.0/lib/capybara/server.rb:19:in `call'
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'
/Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
有什么想法吗?这一切在正常操作中都能很好地工作(我们通过凉亭安装maker_styles,并且在测试环境之外看起来都很好),但是在这个水豚硒设置中没有......
似乎链轮可能没有在测试设置中添加正确的额外负载路径...