TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Capybara: Acceptance test framework for web applications

59 pointsby sachalepalmost 10 years ago

7 comments

mtsmith85almost 10 years ago
Capybara has been a part of my&#x2F;our workflow for a while; I&#x27;m curious why this is on the frontpage -- is there a specific update I&#x27;m missing?<p>Either way, I really enjoy Capybara -- especially being able to jump between different drivers for various reasons.
评论 #9680958 未加载
评论 #9682893 未加载
thibaut_barrerealmost 10 years ago
If you use Capybara, a couple of useful notes, based on what I learned implementing js-enabled &amp;headless specs for my SaaS [3]:<p>First, using the poltergeist driver [1] which is PhantomJS based will tend to be faster AND raise errors when a javascript error occurs (unlike capybara-webkit), which is really handy if your app has a bit of javascript.<p>Also, you can inject puffing-billy [2] into the mix: this is a proxy that will allow you to mock XHR queries without touching the javascript libraries. This allows to write full integration specs for scenarios involving libraries like Stripe&#x2F;Recurly.js etc, but using mocked calls.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;teampoltergeist&#x2F;poltergeist" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;teampoltergeist&#x2F;poltergeist</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;oesmith&#x2F;puffing-billy" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;oesmith&#x2F;puffing-billy</a><p>[3] <a href="https:&#x2F;&#x2F;www.wisecashhq.com" rel="nofollow">https:&#x2F;&#x2F;www.wisecashhq.com</a>
评论 #9681214 未加载
tonyhbalmost 10 years ago
Capybara&#x27;s a great too that we use heavily at <a href="https:&#x2F;&#x2F;www.incoin.io" rel="nofollow">https:&#x2F;&#x2F;www.incoin.io</a>. One of the hangups we had is with multiple API endpoints being hit for a particular page. In some instances the first API request would finish and Capybara would assume that loading is done, when really there&#x27;s another API request pending meaning our promises haven&#x27;t yet finished and tests would fail randomly.<p>In order to prevent this you need to delay Capybara&#x27;s processing so that all requests have finished using a request counter. Information is here: <a href="http:&#x2F;&#x2F;tonyhb.com&#x2F;stop-treading-water-with-marionette-and-capybara" rel="nofollow">http:&#x2F;&#x2F;tonyhb.com&#x2F;stop-treading-water-with-marionette-and-ca...</a><p>Other than that, Capybara is absolutely amazing. It doesn&#x27;t replace manual UI testing by any means, though it provides a lot of confidence knowing we haven&#x27;t broken critical components of our app.
CSDudealmost 10 years ago
If you liked this, you might also like the following: <a href="https:&#x2F;&#x2F;github.com&#x2F;webdriverio&#x2F;cucumber-boilerplate" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;webdriverio&#x2F;cucumber-boilerplate</a> , not as detailed as Capybara but similar
lectrickalmost 10 years ago
I think that your ultimate goal is to rely on Capybara for your testing as little as cleverly possible. Push all your logic into separately-unit-testable JS, perhaps use a DOM emulator, anything to get away from slow, barely-deterministic full browser Capybara testing.
gcb0almost 10 years ago
so, yet another later on top of seleniun or I&#x27;m missing something?
评论 #9680659 未加载
评论 #9680496 未加载
ascotanalmost 10 years ago
I was disappointed that the subtitle wasn&#x27;t &quot;tighter and tighter testing&quot;. <a href="http:&#x2F;&#x2F;i.imgur.com&#x2F;1aD54YR.jpg" rel="nofollow">http:&#x2F;&#x2F;i.imgur.com&#x2F;1aD54YR.jpg</a>