polarblau / capycorder

Chrome extension, generating Capybara request spec steps based on user interaction.
https://chrome.google.com/webstore/detail/niijdolnjmjdjakbanogihdlhcbhfkho
83 stars 15 forks source link

CAPYCORDER

Capycorder helps to record user interactions, generates simple Capybara request specs (Rspec) and copies them into the clipboard for usage in specs. Read more over at polarblau.com.

A word about TDD & BDD

Some will likely feel that this helper and what it does goes against the "tests first" philosophy and may support bad habbits.

Test driven development is great and should definitely be prefered over adding tests after the fact. But we all know, that sometimes testing just doesn't happen at all or that projects come with a few unit tests only.

I'm hoping that in this case, a small tool like Capycorder could lower the barrier and aid in learning the Capybara API as well as to get some specs running a tad faster.

Usage

Navigate to and set-up the page you want to test as needed.

  1. Activate the extension via the icon next to the browser bar
  2. Enter a description for your test (optional) -- this input will be used for the it 'should do something…do … end` block.
  3. Click the Capycorder icon again to enable the actions recorder.
  4. Interact with your page, fill in forms, click links etc. the extension will create form scopes automatically where possible.
  5. Click the icon a third time to switch to the matchers recorder.
  6. Use the highlighter to select a DOM element or select a text range which should be existing within the page as a result.
  7. Click the icon a last time to stop the recorder, generate the specs and copy everything to your clipboard.

Done, now you can use the generated specs e.g. in your Rails project.

What's next?

As mentioned, I've build this tool for myself, so there's no roadmap. A few things I would like to do:

Want to help?

By all means, any help is highly appreciated.

Contributors

Build

The included build script will copy all files listed in the manifest (incl. dependencies) to /build by default or any other DESTINATION defined. It will also first compile all coffescript files and finally create a .zip package ready to use.

thor build [DESTINATION]

You can install the ruby dependencies using bundler.

Check the changelog for latest updates.

Specs

Since the specs are loading fixtures via AJAX, you should run them off a server to avoid cross-origin issues. I prefer to use serve.

The specs are written using Jasmine -- you can find the docs here.