                    (str "lein new chestnut sesame-seed --snapshot -- " flags))))
 
 (defn first-element-text [selector]
-  (browser/text (first (browser/css-finder selector))))
+  (if-let [element (first (browser/css-finder selector))]
+    (browser/text element)))
 
 (defn test-basic [& [flags]]
   (generate-new-app flags)

            [mistletoe.test :refer :all]
            [clj-webdriver.taxi :as browser]
            [clojure.string :as s]
            [leiningen.new.chestnut :as chestnut]))


(def browser-type :chrome)

      (with-browser "http://localhost:10555"
        (browser/wait-until #(= (first-element-text "h1") "Hello Chestnut!"))
        (write-str repl "(swap! app-state assoc :text \"Hello Test :)\")\n")
        (browser/wait-until #(= (first-element-text "h1") "Hello Test :)"))
        (sh "sed" "s/h1/h2/" "-i" "/tmp/sesame-seed/src/cljs/sesame_seed/core.cljs")
        (browser/wait-until #(= (first-element-text "h2") "Hello Test :)")))

      (write-str repl "(quit)\n")
      (expect repl #"Bye for now!"))))
