The project is in a healthy, maintained state
Turn your integration specs into always up-to-date documentation for your team
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

capybara-autodoc

Turn your integration specs into always up-to-date documentation for your team

Autodoc plugs into the Capybara specs of your Rails application, and allows you to create documentation featuring screenshots of your application. Each time your tests run, Autodoc generates a static site showing the various scenarios defined by your tests. You can then configure your CI build to upload the latest version of this site wherever you like, for example on Github pages.

As an example, the Autodoc for RDV Service Public, the French team developing the gem can be found here.

Getting started

Add this to your Gemfile :

gem 'capybara-autodoc'

And then run

$ bundle install
$ bundle exec capybara-autodoc init

Let's assume you have a spec in spec/features/homepage_spec.rb with the following content:

describe "Homepage", :js do
  it "works" do
    visit "/"
    expect(page).to have_content "Hello world!"
  end
end

You can turn it into an Autodoc like this :

describe "Homepage", :js do
  it "works" do
    scenario = Capybara::Autodoc.start_scenario("Homepage", self)
    scenario.start_section("Home page")

    visit "/"

    scenario.add_screenshot(page, text: "The home page looks like this", wait_for: "Hello world!")
  end
end

You can then run your spec, and a static website will be generated automatically! You can then upload it wherever you like (for instance on Github pages).

Do this each time your Continuous Integration build runs, and you've got up-to-date living documentation! 🎉