Skip to content
Browse files

Add tests for screenshot functionality

  • Loading branch information...
1 parent 4508918 commit 622d61418784d644742f2bc24835323d77aa2cd2 @semperos semperos committed Nov 11, 2011
Showing with 9 additions and 2 deletions.
  1. +9 −2 test/clj_webdriver/test/core.clj
View
11 test/clj_webdriver/test/core.clj
@@ -4,7 +4,8 @@
clojure.test)
(:require [clj-webdriver.test.example-app.core :as web-app]
[clj-webdriver.cache :as cache]
- [clojure.tools.logging :as log])
+ [clojure.tools.logging :as log]
+ [clojure.java.io :as jio])
(:import [clj_webdriver.driver.Driver]
[org.openqa.selenium TimeoutException]))
@@ -374,7 +375,13 @@
;; TODO: write tests for screenshot functionality, ensure diff outputs
-;;(deftest test-screenshot-should-return-different-outputs)
+(deftest test-screenshot-should-return-different-outputs
+ (is (string? (get-screenshot dr :base64)))
+ (is (> (count (get-screenshot dr :bytes)) 0))
+ (is (= (class (get-screenshot dr :file)) java.io.File))
+ (is (= (class (get-screenshot dr :file "/tmp/screenshot_test.png")) java.io.File))
+ ;; the following will throw an exception if deletion fails, hence our test
+ (jio/delete-file "/tmp/screenshot_test.png"))
;; ## Tests (sans cache) ##

0 comments on commit 622d614

Please sign in to comment.
Something went wrong with that request. Please try again.