Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix API tests for geckodriver 0.23 & ChromeDriver 2.41 #176

Merged
merged 8 commits into from
Oct 31, 2019
7 changes: 5 additions & 2 deletions src/etaoin/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@
[driver]
(-> (execute {:driver driver
:method :get
:path [:session (:session @driver) :window :size]})
:path [:session (:session @driver) :window :rect]})
:value
(select-keys [:width :height])))

(defmethod get-window-size :default
Expand All @@ -289,7 +290,8 @@
[driver]
(-> (execute {:driver driver
:method :get
:path [:session (:session @driver) :window :position]})
:path [:session (:session @driver) :window :rect]})
:value
(select-keys [:x :y])))

(defmethod get-window-position :default
Expand Down Expand Up @@ -813,6 +815,7 @@
(-> (execute {:driver driver
:method :get
:path [:session (:session @driver) :element el :rect]})
:value
(select-keys [:x :y])))

(defn get-element-location
Expand Down
26 changes: 3 additions & 23 deletions test/etaoin/api_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -398,14 +398,12 @@
:value "test1",
:path "/",
:domain "",
:expiry nil,
:secure false,
:httpOnly false}
{:name "cookie2",
:value "test2",
:path "/",
:domain "",
:expiry nil,
:secure false,
:httpOnly false}])))
(when-phantom *driver*
Expand Down Expand Up @@ -440,7 +438,6 @@
:value "test2"
:path "/"
:domain ""
:expiry nil
:secure false
:httpOnly false})))
(when-phantom *driver*
Expand All @@ -451,24 +448,6 @@
:path "/"
:secure false
:value "test2"})))))
(testing "setting a cookie"
(when-not (or (phantom? *driver*)
(safari? *driver*))
(set-cookie *driver* {:httponly false
:name "cookie3"
:domain ""
:secure false
:value "test3"})
(when-firefox *driver*
(let [cookie (get-cookie *driver* :cookie3)]
(is (= cookie)
{:name "cookie3"
:value "test3"
:path ""
:domain ""
:expiry nil
:secure false
:httpOnly false})))))
(testing "deleting a cookie"
(when-not-phantom
*driver*
Expand Down Expand Up @@ -601,9 +580,10 @@
(is false "should be caught")
(catch Exception e
(is true "caught")
(let [files (file-seq (io/file dir-tmp))]
(let [files (file-seq (io/file dir-tmp))
expected-file-count (if (supports-logs? *driver*) 3 2)]
(is (= (-> files rest count)
2))))))))
expected-file-count))))))))

(deftest test-find-quotes-in-text
(doto *driver*
Expand Down