• Stars
    star
    337
  • Rank 125,272 (Top 3 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 14 years ago
  • Updated almost 14 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Headless HTMLUnit powered browser for Capybara

Akephalos

Akephalos is a full-stack headless browser for integration testing with Capybara. It is built on top of HtmlUnit, a GUI-less browser for the Java platform, but can be run on both JRuby and MRI with no need for JRuby to be installed on the system.

Installation

gem install akephalos

Setup

Configuring akephalos is as simple as requiring it and setting Capybara's javascript driver:

require 'akephalos'
Capybara.javascript_driver = :akephalos

Basic Usage

Akephalos provides a driver for Capybara, so using Akephalos is no different than using Selenium or Rack::Test. For a full usage guide, check out Capybara's DSL documentation. It makes no assumptions about the testing framework being used, and works with RSpec, Cucumber, and Test::Unit.

Here's some sample RSpec code:

describe "Home Page" do
  before { visit "/" }
  context "searching" do
    before do
      fill_in "Search", :with => "akephalos"
      click_button "Go"
    end
    it "returns results" { page.should have_css("#results") }
    it "includes the search term" { page.should have_content("akephalos") }
  end
end

Configuration

There are now a few configuration options available through Capybara's new register_driver API.

Using a different browser

HtmlUnit supports a few browser implementations, and you can choose which browser you would like to use through Akephalos. By default, Akephalos uses Firefox 3.6.

Capybara.register_driver :akephalos do |app|
  # available options:
  #   :ie6, :ie7, :ie8, :firefox_3, :firefox_3_6
  Capybara::Driver::Akephalos.new(app, :browser => :ie8)
end

Ignoring javascript errors

By default HtmlUnit (and Akephalos) will raise an exception when an error is encountered in javascript files. This is generally desireable, except that certain libraries aren't supported by HtmlUnit. If possible, it's best to keep the default behavior, and use Filters (see below) to mock offending libraries. If needed, however, you can configure Akephalos to ignore javascript errors.

Capybara.register_driver :akephalos do |app|
  Capybara::Driver::Akephalos.new(app, :validate_scripts => false)
end

More

  • bin/akephalos allows you to start an interactive shell or DRb server, as well as perform other maintenance features.

  • Filters allows you to declare mock responses for external resources and services requested by the browser.

Resources

More Repositories

1

eventsource

client and server support for EventSource in go
Go
18
star
2

dotfiles

My development environment
Vim Script
15
star
3

haml-server

Simple server for HAML files
Ruby
14
star
4

postscript

A small PostScript interpreter in Ruby
Ruby
11
star
5

ssdeep_psql

Postgres bindings for ssdeep
C
11
star
6

ttf2eot

Convert TTF font files to EOT fonts
C++
7
star
7

heroku-buildpack-libcairo

Shell
6
star
8

uninhibited

Painless Cucumber-style syntax for RSpec integration tests
Ruby
5
star
9

websocket-drawing

Simple WebSocket+Canvas Application
Ruby
5
star
10

gtfs

DataMapper models for interacting with Google Transit Feed Spec data.
Ruby
5
star
11

mongoidslides

Slides for "Taking Mongoid into the Future" at LSRC 2010 and ChicagoRuby
JavaScript
4
star
12

heroku-buildpack-fontforge

Shell
3
star
13

dm-jdbc-adapter

JDBC Adapter for DM
Ruby
3
star
14

tiff

Ruby wrapper for libtiff with FFI
Ruby
3
star
15

safarium

Chrome extension for adding some of Safari's behaviors
JavaScript
3
star
16

svg

A ruby library for generating SVG built on libxml-ruby
Ruby
3
star
17

autoreasoning

automated reasoning in Go
Go
3
star
18

esmc

wrapper for elasticsearch and prometheus for multi-cluster deployments
Go
2
star
19

ssdeep_ruby

Ruby bindings for ssdeep
Ruby
2
star
20

mail_builder

MailBuilder is a simple library for building RFC compliant MIME emails.
Ruby
2
star
21

hound-go-test

2
star
22

rucene

Simple REST API for Lucene using jruby-jars
Ruby
2
star
23

binary-heap

Binary heap for node.js
CoffeeScript
2
star
24

grpc-stream-close-graceful-stop

Go
2
star
25

binheap

Binary heap for go
Go
1
star
26

minispec

Simple library providing interop with rspec on top of Test::Unit
Ruby
1
star
27

bernerdschaefer.com

blog and website source
CSS
1
star
28

remedial_vim_movements

Presentation at #vimchi
Ruby
1
star
29

talks

Ruby
1
star
30

vim-harbor

vim plugin for working with harbor projects
Vim Script
1
star
31

iflt

Haskell
1
star
32

statsd.go

An in-progress learning exercise, implementing a statsd server in go
Go
1
star
33

git-git

git extension to correct typing git twice
Shell
1
star
34

lazyarray-js

LazyArray.js - A JavaScript LazyArray implementation
JavaScript
1
star
35

oinopaponton

my simple haml blog generator and its entries
Ruby
1
star
36

applemediakeyd

linux daemon for apple media keys
Go
1
star