Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Fix strange Selenium-WebDriver behavior by combining two deftests
Browse files Browse the repository at this point in the history
  • Loading branch information
semperos committed Sep 18, 2012
1 parent 83a538c commit e0b9a1b
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions test/clj_webdriver/test/taxi.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns clj-webdriver.test.taxi
(:use clojure.test
clj-webdriver.taxi
clj-webdriver.taxi :reload
[clj-webdriver.test.config :only [test-base-url]]
[clj-webdriver.test.util :only [start-server]]
[clj-webdriver.test.util :only [thrown?]]
Expand Down Expand Up @@ -40,7 +40,7 @@
(click (find-element {:tag :a, :text "example form"}))
(is (= (current-url) (str test-base-url "example-form")))
(back)
(is (= (current-url) (str test-base-url)))
(is (= (current-url) test-base-url))
(forward)
(is (= (current-url) (str test-base-url "example-form")))
(click (find-element {:tag :a, :text "clojure"}))
Expand Down Expand Up @@ -140,17 +140,16 @@
(deftest test-html-output
(is (re-find #"href=\"https://github\.com/cgrand/moustache\"" (html "a.external"))))

(deftest test-table-cell-finding
(deftest test-table-finding
(is (= (current-url) test-base-url))
(is (exists? "#pages-table"))
(is (= (lower-case (tag (find-table-cell "#pages-table" [0 0]))) "th"))
(is (= (lower-case (tag (find-table-cell "#pages-table" [0 1]))) "th"))
(is (= (lower-case (tag (find-table-cell "#pages-table" [1 0]))) "td"))
(is (= (lower-case (tag (find-table-cell "#pages-table" [1 1]))) "td")))

;; Currently throwing exception
;; (deftest test-table-row-finding
;; (is (= (count (find-table-row "#pages-table" 0)) 2))
;; (is (= (lower-case (tag (first (find-table-row "#pages-table" 0)))) "th"))
;; (is (= (lower-case (tag (first (find-table-row "#pages-table" 1)))) "td")))
(is (= (lower-case (tag (find-table-cell "#pages-table" [1 1]))) "td"))
(is (= (count (find-table-row "#pages-table" 0)) 2))
(is (= (lower-case (tag (first (find-table-row (element "#pages-table") 0)))) "th"))
(is (= (lower-case (tag (first (find-table-row (element"#pages-table") 1)))) "td")))

(deftest form-elements
(click (find-element {:tag :a :text, "example form"}))
Expand Down Expand Up @@ -235,13 +234,13 @@
(deftest test-quickfill
(click (find-element {:tag :a :text, "example form"}))
(is (= (count (quick-fill {"#first_name" clear}
{"#first_name" "Richard"}
{"#last_name" clear}
{"#last_name" "Hickey"}
{"*[name='bio']" clear}
{"*[name='bio']" #(input-text % "Creator of Clojure")}
{"input[type='radio'][value='female']" click}
{"select#countries" #(select-by-value % "france")})) 8))
{"#first_name" "Richard"}
{"#last_name" clear}
{"#last_name" "Hickey"}
{"*[name='bio']" clear}
{"*[name='bio']" #(input-text % "Creator of Clojure")}
{"input[type='radio'][value='female']" click}
{"select#countries" #(select-by-value % "france")})) 8))
(is (= (count (distinct
(quick-fill {"#first_name" clear}
{"#first_name" "Richard"}
Expand Down

0 comments on commit e0b9a1b

Please sign in to comment.