                       :value        value})
                    behaviours)))
 
-
-(defn dummy-behaviour [ticket-fields]
-  (let [master-field (rand-nth ticket-fields)
-        field-value (rand-nth (:possible-values master-field))
-        slave-field (rand-nth (fields-without-field ticket-fields
-                                                    master-field))]
-    [[:select-master-field master-field],
-     [:select-field-value field-value],
-     [:select-slave-field slave-field]]))
-
 (defn setup-app [ticket-fields]
   (.appendChild (.-body js/document)
                 (let [element (.createElement js/document "div")

            :shared {:pick-channel  (chan)
                     :ticket-fields ticket-fields}}))

(deftest ^:async declarative
  ; TODO: replace these dummy fields with generators
  (let [ticket-fields (first (gen/sample ticket-fields-gen))
        behaviour (dummy-behaviour ticket-fields)
        states (get-states-for-behaviors behaviour)
        behaviours-with-state-afterwards (map vector behaviour (rest states))]

            [iframe-app.condition-selector :refer [fields-without-field]]
            [iframe-app.core :refer [main app]]))

(enable-console-print!)
(set! (.-warn js/console) (fn [t] nil))
(def p println)

(defonce app-state (atom {:conditions #{}}))

; TODO: use test.check to generate behaviour
; TODO: make finders that wait til they find what they're looking for (like Capybara)


(defn get-field-by [field-type by field]
  (sel1 (str "a." field-type "[data-" by "='" ((keyword by) field) "']")))


(def get-master-field-element
  (partial get-field-by "master-field" "id"))

(def get-field-value-element
  (partial get-field-by "field-value" "value"))

(def get-slave-field-element
  (partial get-field-by "slave-field" "id"))




(defn element-click-fn [element-getter]
  (fn [arg]
