Skip to content

Commit

Permalink
Fix API tests for geckodriver 0.23 & ChromeDriver 2.41 (#176)
Browse files Browse the repository at this point in the history
* Allow delete-session call when session already deleted

* Revise driver 'get' functions to match geckodriver API changes

* Firefox no longer allows setting a cookie on file:/// protocol window; remove test

* Fix waiting tests to match altered default intervals

* Revise drag and drop test URL to match new location

* Cookie test: match changed geckodriver expiry field behaviour

* Drag and drop test now allows for log support in chromedriver
  • Loading branch information
scottlowe authored and igrishaev committed Oct 31, 2019
1 parent 44d3d41 commit 96e18c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
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

0 comments on commit 96e18c6

Please sign in to comment.