O'Reilly logo

Take My Money by Noel Rappin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing the JavaScript via Capybara

If you run the tests without making further changes to them, the end-to-end test in spec/features/purchase_cart_spec.rb will fail. By default, our Capybara-driven feature specs don’t use JavaScript, which means the client side of the form can’t request a token. And if we don’t have a token, the form fails.

In order to make the test pass, we need to run the test inside a container that executes JavaScript. We can do that by setting a JavaScript driver for Capybara, which means Capybara runs the test in a headless web browser engine that includes JavaScript. The Capybara driver we’re using is called Poltergeist.[21] Poltergeist connects Capybara to the PhantomJS headless browser, which you also need to install; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required