Created
April 21, 2013 09:20
-
-
Save firesofmay/5429050 to your computer and use it in GitHub Desktop.
Saucelabs remote clj-webdriver test sample code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testclj.core> (start) | |
---------------------------- | |
{platform WIN8, browserName firefox, version 21} | |
Browser firefox | |
Version 21.0 | |
Platform #< XP> | |
---------------------------- | |
{platform VISTA, browserName firefox, version 21} | |
Browser firefox | |
Version 21.0 | |
Platform #< XP> | |
---------------------------- | |
{platform MAC, browserName firefox, version 20} | |
Browser firefox | |
Version 20.0 | |
Platform #< MAC> | |
---------------------------- | |
{platform LINUX, browserName firefox, version 20} | |
Browser firefox | |
Version 20.0 | |
Platform #< LINUX> | |
---------------------------- | |
{platform WIN8, browserName internet explorer, version 10} | |
Browser internet explorer | |
Version 10 | |
Platform #< WINDOWS> | |
---------------------------- | |
{platform VISTA, browserName internet explorer, version 9} | |
Browser internet explorer | |
Version 9 | |
Platform #< WINDOWS> | |
---------------------------- | |
{platform VISTA, browserName chrome, version 24} | |
Browser chrome | |
Version 24.0.1312.57 | |
Platform #< XP> | |
---------------------------- | |
{platform LINUX, browserName chrome, version 25} | |
Browser chrome | |
Version 25.0.1364.97 | |
Platform #< LINUX> | |
---------------------------- | |
{platform MAC, browserName chrome} | |
Browser chrome | |
Version 24.0.1312.57 | |
Platform #< MAC> | |
---------------------------- | |
{platform MAC, browserName safari, version 5} | |
Browser safari | |
Version 5.1.7 | |
Platform #< MAC> | |
nil | |
testclj.core> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns testclj.core | |
(:require | |
[clj-webdriver.remote.server :as rs] | |
[clj-webdriver.taxi :as taxi] | |
[clj-webdriver.firefox :as ff])) | |
(defn init-grid | |
"Initializes the grid code" | |
[port cred spec] | |
(let [[this-server this-driver] | |
(rs/new-remote-session {:port port | |
:host cred | |
:existing true} | |
{:capabilities spec})] | |
(taxi/set-driver! this-driver))) | |
;;; WIN8/Vista Shows up correctly on Sauce but shows XP as actual cap. | |
;;; Safari 6 On mac fails even though site says its supported. | |
;;; Apparently, Win 2012 == Win 8 | |
;;; & Win 2008 == Win 7. | |
(def specs [ ;; Firefox | |
{"browserName" "firefox" | |
"platform" "WIN8" | |
"version" "21"} | |
{"browserName" "firefox" | |
"platform" "VISTA" | |
"version" "21"} | |
{"browserName" "firefox" | |
"platform" "MAC" | |
"version" "20"} | |
{"browserName" "firefox" | |
"platform" "LINUX" | |
"version" "20"} | |
;; IE | |
{"browserName" "internet explorer" | |
"platform" "WIN8" | |
"version" "10"} | |
{"browserName" "internet explorer" | |
"platform" "VISTA" | |
"version" "9"} | |
;; Chrome | |
{"browserName" "chrome" | |
"platform" "VISTA" | |
"version" "24"} | |
{"browserName" "chrome" | |
"platform" "LINUX" | |
"version" "25"} | |
{"browserName" "chrome" | |
"platform" "MAC"} | |
;; Safari | |
{"browserName" "safari" | |
"platform" "MAC" | |
"version" "5"} | |
;; {"browserName" "safari" ;FAILS | |
;; "platform" "MAC" | |
;; "version" "6"} | |
]) | |
(defn sample-test | |
[spec] | |
(init-grid 80 | |
"USER_NAME:API_KEY@ondemand.saucelabs.com" | |
spec) | |
(println "----------------------------") | |
;(clojure.pprint/pprint taxi/*driver*) | |
(println spec) | |
(println "Browser" (get-in taxi/*driver* [:capabilities :actual :browser-name])) | |
(println "Version" (get-in taxi/*driver* [:capabilities :actual :version])) | |
(println "Platform" (get-in taxi/*driver* [:capabilities :actual :platform])) | |
(taxi/to "https://www.google.co.in/") | |
(taxi/input-text "#gbqfq" "clojure") | |
(taxi/submit "#gbqfq") | |
(taxi/quit) | |
(Thread/sleep 5000)) | |
(defn start | |
"If no args, runs on all the given specs | |
otherwise runs on given vector of specs." | |
([] | |
(start specs)) | |
([s] | |
(doseq [s specs] | |
(sample-test s)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment