Giter VIP home page Giter VIP logo

capybara-thruster's Introduction

Gem Version Build

Capybara Thruster server

This gem makes it possible to use Thruster as a Capybara server. Run your browser test with HTTP/2 enabled and static assets served via Thruster for faster load times!

Tip

Using AnyCable? This gem works with AnyCable-d Thruster, so you can run your system tests against a real AnyCable server with all its features!

Getting started

Prerequisites

Before adding the gem to your project, ensure you have either thruster or anycable-thruster installed. You can add one of these gems to your Gemfile:

# For thruster
gem "thruster"

# or for anycable-thruster
gem "anycable-thruster"

Adding the gem to your project:

# Gemfile
gem "capybara-thruster", group: :test

Then, configure Capybara to use Thruster as a server:

Capybara.server = :thruster

# You can also specify some options.

# For example, if you want to see the server output,
# pass the `debug: true` option:
Capybara.server = :thruster, {debug: true}

# To customize the server settings, you can pass arbitrary environment
# variables via the `env` option:
Capybara.server = :thruster, {env: {"DEBUG" => "true"}}

# To specify Puma server options, use the `puma_options` option:
Capybara.server = :thruster, {puma_options: {Silent: false}}

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/evilmartians/capybara-thruster.

Credits

This gem is generated via newgem template by @palkan.

License

The gem is available as open source under the terms of the MIT License.

capybara-thruster's People

Contributors

palkan avatar prog-supdex avatar

Stargazers

Sergey Kupreenkov avatar Yudai Takada avatar Ryunosuke Sato avatar Keita Urashima avatar Clément Joubert avatar Matteo Piotto avatar Kevin Berthier avatar Mezbah Alam avatar Hussein Morsy avatar Omar Luq  avatar Stephen Ierodiaconou avatar Jonathan Davies avatar Benito Serna avatar Dmitry Vorotilin avatar Sergey Kojin avatar Adrien Poly avatar Haseeb Annadamban avatar Serhii Ponomarov avatar Artur Petrov avatar Rustam Ibragimov avatar Matouš Borák avatar Yasha Krasnou avatar Joel Moss avatar Thomas Klemm avatar Julian Rubisch avatar Patrik Ragnarsson avatar Konnor Rogers avatar  avatar Matijs van Zuijlen avatar Svyatoslav Kryukov avatar

Watchers

Yaroslav Markin avatar Alexander Tishchenko avatar Kirill Kuznetsov avatar  avatar Rustam Ibragimov avatar

Forkers

prog-supdex

capybara-thruster's Issues

Add thruster as dependency or mention it in README

I wanted to give it a try in a project that does not use thruster (yet) and it did not work out of the box.

I have followed README and rspec started to throw errors with scary stack trace at me. When I added the debug option, I got a simple bundler error that no thrust is installed and resolved the issue. However, that was not obvious to me at first.

I know this is a skill issue, but I probably won't be the only one to do it 🤷

My suggestion is to either add thruster as a runtime dependency (which I expected) or add a line in the README.

PS. Thank you for the gem!

Here is a stack error

#<Thread:0x0000000128a35ce0 /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/server.rb:76 run> terminated with exception (report_on_exception is true):
/Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `initialize': Address already in use - bind(2) for "127.0.0.1" port 61005 (Errno::EADDRINUSE)
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `new'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `add_tcp_listener'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:163:in `block in parse'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:146:in `each'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:146:in `parse'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/registrations/servers.rb:63:in `block (2 levels) in <main>'
        from <internal:kernel>:90:in `tap'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/registrations/servers.rb:62:in `block in <main>'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-thruster-0.1.0/lib/capybara/thruster.rb:24:in `block in <main>'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/config.rb:64:in `block in server='
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/server.rb:77:in `block in boot'
#<Thread:0x0000000128adc108 /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/server.rb:76 run> terminated with exception (report_on_exception is true):
/Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `initialize': Address already in use - bind(2) for "127.0.0.1" port 61005 (Errno::EADDRINUSE)
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `new'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `add_tcp_listener'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:163:in `block in parse'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:146:in `each'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:146:in `parse'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/registrations/servers.rb:63:in `block (2 levels) in <main>'
        from <internal:kernel>:90:in `tap'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/registrations/servers.rb:62:in `block in <main>'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-thruster-0.1.0/lib/capybara/thruster.rb:24:in `block in <main>'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/config.rb:64:in `block in server='
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/server.rb:77:in `block in boot'
F#<Thread:0x0000000128a93bd8 /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/server.rb:76 run> terminated with exception (report_on_exception is true):
/Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `initialize': Address already in use - bind(2) for "127.0.0.1" port 61005 (Errno::EADDRINUSE)
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `new'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `add_tcp_listener'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:163:in `block in parse'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:146:in `each'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:146:in `parse'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/registrations/servers.rb:63:in `block (2 levels) in <main>'
        from <internal:kernel>:90:in `tap'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/registrations/servers.rb:62:in `block in <main>'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-thruster-0.1.0/lib/capybara/thruster.rb:24:in `block in <main>'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/config.rb:64:in `block in server='
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/server.rb:77:in `block in boot'
#<Thread:0x0000000128b175a0 /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/server.rb:76 run> terminated with exception (report_on_exception is true):
/Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `initialize': Address already in use - bind(2) for "127.0.0.1" port 61005 (Errno::EADDRINUSE)
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `new'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:334:in `add_tcp_listener'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:163:in `block in parse'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:146:in `each'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/binder.rb:146:in `parse'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/registrations/servers.rb:63:in `block (2 levels) in <main>'
        from <internal:kernel>:90:in `tap'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/registrations/servers.rb:62:in `block in <main>'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-thruster-0.1.0/lib/capybara/thruster.rb:24:in `block in <main>'
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/config.rb:64:in `block in server='
        from /Users/cezary/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/capybara-3.40.0/lib/capybara/server.rb:77:in `block in boot'

1st Try error in ./spec/features/multi_location_order_spec.rb:66:
Address already in use - bind(2) for "127.0.0.1" port 61005
undefined method `values_at' for nil:NilClass

No noticeable improvement, something I'm missing?

What did you do?

Installed the gem in my Gemfile, added Capybara.server = :thruster to my rails_helper.rb

What did you expect to happen?

Some improvement in performance.

What actually happened?

I have a long intensive smoke test that fully exercises onboarding customers, and our main product feature. It ran without this gem in 8m17s and with this gem in 8m19s (on my M1 Max MacBook Pro w/64GB RAM), so within the bounds of "the same" for an experiment.

Maybe there's some additional step to enable it?

Environment

Ruby Version: 3.3.0

Framework Version (Rails, whatever): Rails 7.1.3.2

Capybara Thruster Version: 0.1.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.