1

I'm testing a clojure luminus/selmer application with kerodon. I'm getting a java.lang.IllegalArgumentException: field could not be found with selector "[:#name]" when trying to access an input field with id=name as follows:

(deftest home
  (-> (session app)
      (visit "/")
      (fill-in [:#name] "Peter")
      (fill-in [:#age] "25")
      (press "Sign up!")
      (within [:h1]
              (has (text? "Hello Peter 25")))))
birdspider
  • 3,034
  • 1
  • 16
  • 25
joeabala
  • 266
  • 3
  • 11

1 Answers1

1

Try using text value of label for input field, fill-in accepts text value of label as well as id of elem you need to fill. Refer to the kerodon source, there are tests for both label value and selector.

For example:-

<label for="name">Name</label>
<input type="text" id="name"\>

You can write

(deftest home 
   (-> (session app) 
       (visit "/") 
       (fill-in "Name" "Peter")
        ...))
Taha Husain
  • 292
  • 2
  • 11
  • It is still not working. Or is it that kerodon works only with hiccup?
    (deftest login (-> (session app) (visit "/log") (fill-in "Name" "Peter") (fill-in "Age" "25") (press "Submit") (within [:h1] (has (text? "Hello Peter 25")))))
    – joeabala Feb 25 '16 at 07:03
  • It doesn't really matter what template you're using. Tests are run on browser-like flow when there's pure HTML. Are other fields throwing the same exception? – Taha Husain Feb 25 '16 at 09:22