 (defn not-contains? [x coll]
   (not (some #{x} coll)))
 
+(defn search-for-and-navigate-to-conference [search-string]
+  (click "conference-voices-brand")
+  (wait-for "page-conference-list")
+  (taxi/click ".tt-input")
+  (taxi/send-keys ".tt-input" search-string)
+  (wait-for "conference-suggestion-template")
+  (click "conference-suggestion-template")
+  (wait-for "page-conference-detail"))
+
 (deftest ^:functional basic-journey-test
-  (let [conference-name (str "some unique conference name" (UUID/randomUUID))
-        conference-series (str "some unique series" (UUID/randomUUID))
-        conference-link "www.some-link.org"
-        conference-description "some really fancy description with a new line.\nAnd here is the new line. Wohooo!"
+  (let [conference-series (str "some unique series" (UUID/randomUUID))
+        past-conference-name (str "some unique conference name" (UUID/randomUUID))
+        past-conference-link "www.some-link.org"
+        past-conference-description "some really fancy description with a new line.\nAnd here is the new line. Wohooo!"
         future-conference-name (str "some other unique conference name" (UUID/randomUUID))]
 
     ; open conference voices home page

      (wait-for "page-conference-detail")
      (taxi/wait-until #(= "1" (text "text-icon-panel-number")))

      ;go back to conferecne list page
      (click "conference-voices-brand")
      (wait-for "page-conference-list")

      ; searches for and navigates to the future conference of the series
      (taxi/click ".tt-input")
      (taxi/send-keys ".tt-input" future-conference-name)
      (wait-for "conference-suggestion-template")
      (click "conference-suggestion-template")

      ; checks that the rating is also visible to the future conference of the same series
      (wait-for "page-conference-detail")
      (is (= conference-series (s/lower-case (text "text-conference-series")))) ; different chromedrivers treat css transform differently
      (is (= future-conference-name (s/lower-case (text "text-conference-name"))))
      (is (= (str "Note: This ratings are aggregated from ratings of previous " conference-series " conferences.") (text "aggregated-ratings-info")))

      ;go back to conferecne list page
      (click "conference-voices-brand")
      (wait-for "page-conference-list")

      ;search for newly created past conference
      (taxi/click ".tt-input")
      (taxi/send-keys ".tt-input" conference-name)
      (wait-for "conference-suggestion-template")
      (click "conference-suggestion-template")

      ; edits past conference
      (wait-for "page-conference-detail")


      ; back to the conference list page and checks that conference is gone
      (wait-for "page-conference-list")
      (is (not-contains? past-conference-name (texts "text-conference-name")))

      ; searches for and navigates to the future conference of the series
      (search-for-and-navigate-to-conference future-conference-name)

      ; checks that future conference does not have aggregated ratings anymore
      (wait-for "page-conference-detail")
