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

:no-doc to :private #651

Merged
merged 4 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/etaoin/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@
;;
;; WebDriver defaults
;;
(def ^:no-doc default-locator "xpath")
(def ^:no-doc locator-xpath "xpath")
(def ^:no-doc locator-css "css selector")
(def ^:private default-locator query/locator-xpath)

(def ^{:doc "WebDriver global option defaults"} defaults-global
{:locator default-locator
Expand Down Expand Up @@ -208,7 +206,7 @@
;; utils
;;

(defn ^:no-doc dispatch-driver
(defn- dispatch-driver
"Returns the current driver's type. Used as dispatcher in
multimethods."
[driver & _]
Expand Down Expand Up @@ -2099,12 +2097,12 @@
(defn use-xpath
"Return new `driver` with default locator set to XPath."
[driver]
(use-locator driver locator-xpath))
(use-locator driver query/locator-xpath))

(defn use-css
"Return new `driver` with default locator set to CSS."
[driver]
(use-locator driver locator-css))
(use-locator driver query/locator-css))

(defmacro ^:no-doc with-locator [driver locator & body]
`(binding [~driver (assoc ~driver :locator ~locator)]
Expand All @@ -2113,13 +2111,13 @@
(defmacro with-xpath
"Execute `body` with default locator set to XPath."
[driver & body]
`(with-locator ~driver locator-xpath
`(with-locator ~driver query/locator-xpath
~@body))

(defmacro with-css
"Execute `body` with default locator set to CSS."
[driver & body]
`(with-locator ~driver locator-css
`(with-locator ~driver query/locator-css
~@body))

;;
Expand Down
3 changes: 2 additions & 1 deletion src/etaoin/ide/impl/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[clojure.test :refer [is]]
[clojure.tools.logging :as log]
[etaoin.api :as e]
[etaoin.query :as query]
[etaoin.impl.util :refer [defmethods]]
[etaoin.keys :as k]))

Expand Down Expand Up @@ -433,7 +434,7 @@
(defmethod run-command
:storeXpathCount
[driver {:keys [target value]} & [{vars :vars}]]
(let [cnt (count (e/find-elements* driver e/locator-xpath target))]
(let [cnt (count (e/find-elements* driver query/locator-xpath target))]
(swap! vars assoc (str->var value) cnt)))

(defmethod run-command
Expand Down
1 change: 0 additions & 1 deletion src/etaoin/query.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

(set! *warn-on-reflection* true)

;; todo duplicates with api.clj
(def locator-xpath "xpath")
(def locator-css "css selector")

Expand Down
30 changes: 15 additions & 15 deletions test/etaoin/api_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -227,21 +227,21 @@
(is (= (f data) (e/get-element-value *driver* f)))))))

(deftest test-unicode-above-bmp-input
;; as of 2023-04-29 not supported on chrome and edge
;; https://bugs.chromium.org/p/chromedriver/issues/detail?id=2269
(when-not (#{:chrome :edge} (e/dispatch-driver *driver*))
(let [data {:simple-input "😊🍂input🍃"
:simple-password "🔆password☠️ "
:simple-textarea "🎉🚀textarea👀☀️"}]
(testing "fill-multi"
(e/fill-multi *driver* data)
(doseq [f [:simple-input :simple-password :simple-textarea]]
(is (= (f data) (e/get-element-value *driver* f)))))
(testing "fill-human-multi"
(e/refresh *driver*)
(e/fill-human-multi *driver* data)
(doseq [f [:simple-input :simple-password :simple-textarea]]
(is (= (f data) (e/get-element-value *driver* f))))))))
;; as of 2023-04-29 not supported on chrome and edge
;; https://bugs.chromium.org/p/chromedriver/issues/detail?id=2269
(e/when-not-drivers #{:chrome :edge} *driver*
(let [data {:simple-input "😊🍂input🍃"
:simple-password "🔆password☠️ "
:simple-textarea "🎉🚀textarea👀☀️"}]
(testing "fill-multi"
(e/fill-multi *driver* data)
(doseq [f [:simple-input :simple-password :simple-textarea]]
(is (= (f data) (e/get-element-value *driver* f)))))
(testing "fill-human-multi"
(e/refresh *driver*)
(e/fill-human-multi *driver* data)
(doseq [f [:simple-input :simple-password :simple-textarea]]
(is (= (f data) (e/get-element-value *driver* f))))))))

(deftest test-clear
(testing "simple clear"
Expand Down
Loading