Headless Clojure HTTP client for automated testing.
Cavy is a library for simulating an HTTP client without the overhead of browser automation tools. It wraps clj-http in a user-interaction-oriented interface with functions for following links, filling in fields and submitting forms.
If you want a library for testing Ring apps, I recommend Kerodon.
(require 'cavy)
(-> (cavy/session "https://example.com/login")
(cavy/fill-in "Username" "my-username")
(cavy/fill-in "Password" "my-password")
(cavy/press "Login"))
Cookies are maintained within a session, so you can login and then navigate secured pages.
session [url] [options]
visit {url} [params...]
visit
always makes a
GET request).click {target}
press {target}
fill-in {target} {text}
check {target}
, uncheck {target}
, toggle {target}
select {target} [values...]
choose {target} {value}