From 46a564200763155439a2f4f94b2821275809aaa0 Mon Sep 17 00:00:00 2001 From: Lee Read Date: Wed, 7 Aug 2024 14:44:58 -0400 Subject: [PATCH] minor breaking: Remove support for PhantomJS (#614) PhantomJS is long obsolete, and we dropped testing for it long ago. Supporting API, code and docs are clutter at this point. Closes #612 --- .cljfmt.edn | 2 - CHANGELOG.adoc | 33 +++-- doc/01-user-guide.adoc | 18 +-- doc/02-developer-guide.adoc | 1 - .../etaoin/etaoin/config.edn | 2 - script/drivers.clj | 3 +- src/etaoin/api.clj | 129 ++++-------------- src/etaoin/api2.clj | 17 --- src/etaoin/ide/main.clj | 2 +- src/etaoin/impl/driver.clj | 15 -- test/etaoin/api_test.clj | 88 ++++++------ 11 files changed, 88 insertions(+), 222 deletions(-) diff --git a/.cljfmt.edn b/.cljfmt.edn index fe5edd4c..34d819b5 100644 --- a/.cljfmt.edn +++ b/.cljfmt.edn @@ -7,10 +7,8 @@ when-not-edge [[:inner 0]] when-not-firefox [[:inner 0]] when-not-headless [[:inner 0]] - when-not-phantom [[:inner 0]] when-not-predicate [[:inner 0]] when-not-safari [[:inner 0]] - when-phantom [[:inner 0]] when-predicate [[:inner 0]] when-safari [[:inner 0]] try+ [[:block 0]]}} diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 1e9797d8..538419e7 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -17,31 +17,36 @@ A release with an intentional breaking changes is marked with: // - unreleased section empty // - optional attribute is not [breaking] or [minor breaking] // (adjust these in publish.clj as you see fit) -== Unreleased +== Unreleased [minor breaking] -* {pr}552[#552]: Add support for wide characters to input fill functions +* Technically breaking +** {issue}613[#612]: Remove all support for long obsolete and long untested PhantomJS +({lread}) + +* Other changes +** {pr}552[#552]: Add support for wide characters to input fill functions ({person}tupini07[@tupini07]) -* {issue}566[#566]: Recognize `:driver-log-level` for Edge +** {issue}566[#566]: Recognize `:driver-log-level` for Edge ({lread}) -* {issue}563[#563]: Support `"debug"` `:driver-log-level` for Safari +** {issue}563[#563]: Support `"debug"` `:driver-log-level` for Safari ({lread}) -* {issue}517[#517]: Properly cleanup after failed webdriver launch +** {issue}517[#517]: Properly cleanup after failed webdriver launch ({lread}) -* {issue}604[#604]: Add support for shadow DOM +** {issue}604[#604]: Add support for shadow DOM ({person}dgr[@dgr]) -* {issue}603[#603]: Add :fn/index as alias for :index in map syntax +** {issue}603[#603]: Add :fn/index as alias for :index in map syntax ({person}dgr[@dgr]) -* bump all deps to current versions +** bump all deps to current versions ({lread}) -* tests -** {issue}572[#572]: stop using chrome `--no-sandbox` option, it has become problematic on Windows (and we did not need it anyway) +** tests +*** {issue}572[#572]: stop using chrome `--no-sandbox` option, it has become problematic on Windows (and we did not need it anyway) ({lread}) -* docs -** {issue}534[#534]: better describe `etaoin.api/select` and its alternatives +** docs +*** {issue}534[#534]: better describe `etaoin.api/select` and its alternatives ({lread}) -** {issue}536[#536]: user guide examples are now all os agnostic and CI tested via test-doc-blocks on all supported OSes +*** {issue}536[#536]: user guide examples are now all os agnostic and CI tested via test-doc-blocks on all supported OSes ({lread}) -** {issue}602[#602]: Document all `:fn/*` query pseudo-functions in a definitive list +*** {issue}602[#602]: Document all `:fn/*` query pseudo-functions in a definitive list ({person}dgr[@dgr]) == v1.0.40 - 2023-03-08 [[v1.0.40]] diff --git a/doc/01-user-guide.adoc b/doc/01-user-guide.adoc index fc854279..ace2371a 100644 --- a/doc/01-user-guide.adoc +++ b/doc/01-user-guide.adoc @@ -70,7 +70,6 @@ Etaoin's test suite covers the following OSes and browsers for both Clojure and |=== 1. Our GitHub Actions macOS tests run on silicon (aka arm64, aarch64 or M*) hardware -2. We did once test against PhantomJS, but since work has long ago stopped on this project, we have dropped testing == Installation @@ -130,7 +129,6 @@ For a quieter Etaoin experience when using babashka, set the timbre default log :url-chromedriver: https://sites.google.com/chromium.org/driver/ :url-chromedriver-dl: https://sites.google.com/chromium.org/driver/downloads :url-geckodriver-dl: https://github.com/mozilla/geckodriver/releases -:url-phantom-dl: http://phantomjs.org/download.html :url-webkit: https://webkit.org/blog/6900/webdriver-support-in-safari-10/ :url-edge-dl: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ @@ -175,12 +173,6 @@ Edge and `msedgedriver` must match so you might need to specify the version: `scoop install edgedriver@101.0.1210.0` ** Download: link:{url-edge-dl}[Official Microsoft download site] -* Phantom.js browser + -(obsolete, no longer tested) -** macOS: `brew install phantomjs` -** Windows: `scoop install phantomjs` -** Download: link:{url-phantom-dl}[Official PhantomJS download site] - Check your WebDriver installations launching by launching these commands. Each should start a process that includes its own local HTTP server. Use Ctrl-C to terminate. @@ -191,7 +183,6 @@ chromedriver geckodriver safaridriver -p 0 msedgedriver -phantomjs --wd ---- You can optionally run the Etaoin test suite to verify your installation. @@ -1070,7 +1061,7 @@ It acts the same but raises an exception when querying the page returns multiple Although double-clicking is rarely purposefully employed on web sites, some naive users might think it is the correct way to click on a button or link. -A double-click can be simulated with `double-click` function (Chrome, Phantom.js). +A double-click can be simulated with `double-click` function (Chrome). It can be used, for example, to check your handling of disallowing multiple form submissions. [source,clojure] @@ -1812,10 +1803,9 @@ Each map has the following structure: ;; => [] ---- -Currently, logs are available in Chrome and Phantom.js only. +Currently, logs are available in Chrome only. The message text and the source type will vary by browser vendor. Chrome wipes the logs once they have been read. -Phantom.js wipes the logs when the page location changes. === DevTools: Tracking HTTP Requests, XHR (Ajax) [[devtools]] @@ -2343,7 +2333,6 @@ values vary by browser driver vendor: ** has only one detailed log level which we enable via its `--diagnose` option and abstract via `"debug"` ** only logs to a log file which Etaion automatically discovers and populates as <> in the `driver` map ** see <> for one way to dump this log file -* phantomjs "ERROR"` `"WARN"` `"INFO"` `"DEBUG"` [id=opt-log-stdout,reftext=`:log-stdout`] [id=opt-log-stderr,reftext=`:log-sterr`] @@ -2498,7 +2487,6 @@ Running without a UI is helpful when: * running local tests without having them take over your local UI Ensure your browser supports headless mode by checking if it accepts `--headless` command-line argument when running it from the terminal. -The Phantom.js driver is headless by its nature (it was never been developed for rendering UI). When starting a driver, pass the `:headless` boolean flag to switch into headless mode. This flag is ignored for Safari which, as of June 2022, still does not support headless mode. @@ -2526,8 +2514,6 @@ or (e/quit driver) ---- -NOTE: PhantomJS will always be in headless mode. - There are several shortcuts to run Chrome or Firefox in headless mode: //{:test-doc-blocks/test-ns user-guide-headless-test} diff --git a/doc/02-developer-guide.adoc b/doc/02-developer-guide.adoc index 356f6cf1..fcbeba2e 100644 --- a/doc/02-developer-guide.adoc +++ b/doc/02-developer-guide.adoc @@ -269,4 +269,3 @@ So, when adding any new macros, think also about our Etaoin users and our clj-ko * https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/[chromedriver] * https://github.com/mozilla/geckodriver[firefox geckodriver], https://searchfox.org/mozilla-central/source/testing/webdriver[sources] -* https://github.com/detro/ghostdriver/blob/[Phantom.js (obsolete, no longer tested)] diff --git a/resources/clj-kondo.exports/etaoin/etaoin/config.edn b/resources/clj-kondo.exports/etaoin/etaoin/config.edn index d888f260..f4d49326 100644 --- a/resources/clj-kondo.exports/etaoin/etaoin/config.edn +++ b/resources/clj-kondo.exports/etaoin/etaoin/config.edn @@ -12,7 +12,6 @@ etaoin.api/with-firefox-headless etaoin.api/with-browser etaoin.api/with-edge etaoin.api/with-browser etaoin.api/with-edge-headless etaoin.api/with-browser - etaoin.api/with-phantom etaoin.api/with-browser etaoin.api/with-safari etaoin.api/with-browser etaoin.api/with-driver etaoin.api/with-driver @@ -26,7 +25,6 @@ etaoin.api2/with-edge-headless etaoin.api2/with-browser etaoin.api2/with-firefox etaoin.api2/with-browser etaoin.api2/with-firefox-headless etaoin.api2/with-browser - etaoin.api2/with-phantom etaoin.api2/with-browser etaoin.api2/with-safari etaoin.api2/with-browser}} :lint-as {etaoin.api/with-pointer-left-btn-down clojure.core/->}} diff --git a/script/drivers.clj b/script/drivers.clj index 6193e72f..5e0d86e3 100644 --- a/script/drivers.clj +++ b/script/drivers.clj @@ -10,8 +10,7 @@ [{:name "Chrome" :bin "chromedriver"} {:name "Firefox":bin "geckodriver"} {:name "Microsoft Edge" :bin "msedgedriver"} - {:name "Safari" :bin "safaridriver"} - {:name "PhantomJS" :bin "phantomjs"}]) + {:name "Safari" :bin "safaridriver"}]) (defn driver-processes [] (->> (ps/all-processes) diff --git a/src/etaoin/api.clj b/src/etaoin/api.clj index 205e8912..c5037d42 100644 --- a/src/etaoin/api.clj +++ b/src/etaoin/api.clj @@ -12,7 +12,6 @@ - [[with-chrome]] [[with-chrome-headless]] [[chrome]] [[chrome-headless]] [[chrome?]] [[when-chrome]] [[when-not-chrome]] - [[with-edge]] [[with-edge-headless]] [[edge]] [[edge-headless]] [[when-edge]] [[when-not-edge]] - [[with-firefox]] [[with-firefox-headless]] [[firefox]] [[firefox-headless]] [[firefox?]] [[when-firefox]] [[when-not-firefox]] - - [[with-phantom]] [[phantom]] [[phantom?]] [[when-phantom]] [[when-not-phantom]] - [[with-safari]] [[safari]] [[safari?]] [[when-safari]] [[when-not-safari]] - [[driver?]] [[running?]] [[headless?]] [[when-headless]] [[when-not-headless]] - [[disconnect-driver]] [[stop-driver]] [[quit]] @@ -185,8 +184,6 @@ :path-driver "geckodriver"} :chrome {:port 9515 :path-driver "chromedriver"} - :phantom {:port 8910 - :path-driver "phantomjs"} :safari {:port 4445 :path-driver "safaridriver" :webdriver-failed-launch-retries 4} @@ -302,7 +299,7 @@ :value first second)) (defmethods get-active-element* - [:chrome :edge :phantom] + [:chrome :edge] [driver] (-> (execute {:driver driver :method :post @@ -345,7 +342,7 @@ :path [:session (:session driver) :window :handles]}))) (defmethods get-window-handles - [:chrome :edge :phantom] + [:chrome :edge] [driver] (:value (execute {:driver driver :method :get @@ -365,7 +362,7 @@ :data {:handle handle}})) (defmethods switch-window - [:chrome :edge :phantom] + [:chrome :edge] [driver handle] (execute {:driver driver :method :post @@ -979,11 +976,6 @@ :path [:session (:session driver) :actions] :data {:actions (cons input inputs)}})) -(defmethod perform-actions - :phantom - [_driver _input & _inputs] - (util/error "Phantom doesn't support w3c actions.")) - (defmulti release-actions "Have `driver` clear any active action state. This includes any key presses and/or a pointer button being held down." @@ -997,11 +989,6 @@ :method :delete :path [:session (:session driver) :actions]})) -(defmethod release-actions - :phantom - [_driver _input & _inputs] - (util/error "Phantom doesn't support w3c actions.")) - ;; ;; mouse ;; @@ -1012,7 +999,7 @@ dispatch-driver) (defmethods mouse-btn-down - [:chrome :edge :phantom] + [:chrome :edge] [driver] (execute {:driver driver :method :post @@ -1024,7 +1011,7 @@ dispatch-driver) (defmethods mouse-btn-up - [:chrome :edge :phantom] + [:chrome :edge] [driver] (execute {:driver driver :method :post @@ -1037,7 +1024,7 @@ dispatch-driver) (defmethods mouse-move-to - [:chrome :edge :phantom :firefox] + [:chrome :edge :firefox] ([driver q] (execute {:driver driver :method :post @@ -1070,18 +1057,10 @@ See [[query]] for details on `q-from`, `q-to`. Notes: - - does not work in Phantom.js since it does not have a virtual mouse API; - does not work in Safari." {:arglists '([driver q-from q-to])} dispatch-driver) -(defmethod drag-and-drop - :phantom - [driver q-from q-to] - (mouse-move-to driver q-from) - (with-mouse-btn driver - (mouse-move-to driver q-to))) - (defmethod drag-and-drop :default [driver q-from q-to] @@ -1144,8 +1123,8 @@ "Have `driver` double-click on element `el`. Note: - - the supported browsers are Chrome, and Phantom.js. - - for Firefox and Safari, your may try to simulate it as a `click, wait, click` sequence." + - supported by Chrome + - for Firefox and Safari, your may try to simulate via a `click, wait, click` sequence." {:arglists '([driver el])} dispatch-driver) @@ -1166,8 +1145,8 @@ See [[query]] for details on `q`. Note: - - the supported browsers are Chrome, and Phantom.js. - - for Firefox and Safari, your may try to simulate via `click, wait, click` sequence." + - supported by Chrome + - for Firefox and Safari, your may try to simulate via a `click, wait, click` sequence." [driver q] (double-click-el driver (query driver q))) @@ -1255,7 +1234,7 @@ dispatch-driver) (defmethods get-element-size-el - [:chrome :edge :phantom] + [:chrome :edge] [driver el] {:pre [(some? el)]} (-> (execute {:driver driver @@ -1291,7 +1270,7 @@ dispatch-driver) (defmethods get-element-location-el - [:chrome :edge :phantom] + [:chrome :edge] [driver el] {:pre [(some? el)]} (-> (execute {:driver driver @@ -1521,14 +1500,6 @@ :method :get :path [:session (:session driver) :element el :property :innerHTML]}))) -(defmethod get-element-inner-html-el - :phantom - [driver el] - {:pre [(some? el)]} - (:value (execute {:driver driver - :method :get - :path [:session (:session driver) :element el :attribute :innerHTML]}))) - (defn get-element-inner-html "Have `driver` return inner text of element found by query `q`. @@ -1605,11 +1576,6 @@ [driver q] (get-element-value-el driver (query driver q))) -(defmethods get-element-value - [:phantom] - [driver q] - (get-element-attr driver q :value)) - (defmethods get-element-value [:firefox :safari] [driver q] @@ -2100,7 +2066,7 @@ dispatch-driver) (defmethods get-log-types - [:chrome :phantom] + [:chrome] [driver] (:value (execute {:driver driver :method :get @@ -2119,7 +2085,7 @@ dispatch-driver) (defmethods get-logs* - [:chrome :phantom] + [:chrome] [driver logtype] (->> (execute {:driver driver :method :post @@ -2140,19 +2106,12 @@ :datetime #inst \"2017-11-23T15:03:08.366-00:00\"} ``` - Empirical knowledge about browser differences: + Supported by Chrome only: - - Chrome: - - Returns all recorded logs. - - Clears the logs once they have been read. - - JS console logs have `:console-api` for `:source` field. - - Entries about errors will have SEVERE level. - - - PhantomJS (obsolete and no longer tested): - - Return all recorded logs since the last URL change. - - Does not clear recorded logs on subsequent invocations. - - JS console logs have nil for `:source` field. - - Entries about errors will have WARNING level, as coded [here](https://github.com/detro/ghostdriver/blob/be7ffd9d47c1e76c7bfa1d47cdcde9164fd40db8/src/session.js#L494)." + - Returns all recorded logs. + - Clears the logs once they have been read. + - JS console logs have `:console-api` for `:source` field. + - Entries about errors will have SEVERE level." ([driver] (get-logs driver "browser")) ([driver logtype] @@ -2350,7 +2309,7 @@ ;; (defn driver? - "Return true if `driver` is of `type` (e.g. on of: `:chrome`, `:edge`, `:firefox`, `:safari`, `:phantom`)" + "Return true if `driver` is of `type` (e.g. on of: `:chrome`, `:edge`, `:firefox`, `:safari`)" [driver type] (= (dispatch-driver driver) type)) @@ -2369,11 +2328,6 @@ [driver] (driver? driver :firefox)) -(defn phantom? - "Returns true if a `driver` is Phantom.js." - [driver] - (driver? driver :phantom)) - (defn safari? "Returns true if a `driver` is Safari." [driver] @@ -2872,11 +2826,6 @@ [driver & body] `(when-not-predicate #(edge? ~driver) ~@body)) -(defmacro when-not-phantom - "Executes `body` when browser `driver` is NOT Phantom.js." - [driver & body] - `(when-not-predicate #(phantom? ~driver) ~@body)) - (defmacro when-not-firefox "Executes `body` when browser `driver` is NOT Firefox." [driver & body] @@ -2903,11 +2852,6 @@ [driver & body] `(when-predicate #(chrome? ~driver) ~@body)) -(defmacro when-phantom - "Executes `body` when browser `driver` is Phantom.js." - [driver & body] - `(when-predicate #(phantom? ~driver) ~@body)) - (defmacro when-firefox "Executes `body` when browser `driver` is Firefox." [driver & body] @@ -3523,7 +3467,7 @@ Arguments: - `type` is a keyword determines what driver to use. The supported - browsers are `:firefox`, `:chrome`, `:phantom` and `:safari`. + browsers are `:firefox`, `:chrome`, `:edge` and `:safari`. - `opts` is a map with additional options for a driver. The supported options are: @@ -3679,8 +3623,7 @@ -- `:driver-log-level` a keyword to set driver's log level. The value is a string. Possible values are: - chrome: [ALL, DEBUG, INFO, WARNING, SEVERE, OFF] - phantomjs: [ERROR, WARN, INFO, DEBUG] (default INFO) + chrome & edge: [ALL, DEBUG, INFO, WARNING, SEVERE, OFF] firefox [fatal, error, warn, info, config, debug, trace] -- `:log-stdout` and `:log-stderr`. Paths to the driver's log files as strings. @@ -3734,7 +3677,6 @@ -- `headless` is a boolean flag to run the browser in headless mode (i.e. without GUI window). Useful when running tests on CI servers rather than local machine. Currently, only FF and Chrome support headless mode. - Phantom.js is headless by its nature. -- `:size` is a vector of two integers specifying initial window size. @@ -3831,7 +3773,7 @@ (stop-driver driver)))))) (defn boot-driver - "Launch and return a driver of `type` (e.g. `:chrome`, `:firefox` `:safari` `:edge` `:phantom`) + "Launch and return a driver of `type` (e.g. `:chrome`, `:firefox` `:safari` `:edge`) with `opts` options. - creates a driver @@ -3882,12 +3824,6 @@ `opts` map is optionally, see [Driver Options](/doc/01-user-guide.adoc#driver-options)." (partial boot-driver :chrome)) -(def ^{:arglists '([] [opts])} phantom - "Launch and return a Phantom.js driver. - - `opts` map is optionally, see [Driver Options](/doc/01-user-guide.adoc#driver-options)." - (partial boot-driver :phantom)) - (def ^{:arglists '([] [opts])} safari "Launch and return a Safari driver. @@ -3922,7 +3858,7 @@ (boot-driver :edge (assoc opts :headless true)))) (defmacro with-driver - "Executes `body` with a driver session of `type` (e.g. `:chrome`, `:firefox` `:safari` `:edge` `:phantom`) + "Executes `body` with a driver session of `type` (e.g. `:chrome`, `:firefox` `:safari` `:edge`) with `opts` options, binding driver instance to `bind`. Driver is automatically launched and terminated (even if an exception occurs). @@ -4007,23 +3943,6 @@ [& args] `(with-driver :edge ~@args)) -(defmacro with-phantom - "Executes `body` with an Phantom.JS driver session bound to `bind`. - - Driver is automatically launched and terminated (even if an exception occurs). - - `opts` map can be omitted, see [Driver Options](/doc/01-user-guide.adoc#driver-options). - - Example: - - ```Clojure - (with-phantom driver - (go driver \"https://clojure.org\")) - ```" - {:arglists '([opts? bind & body])} - [& args] - `(with-driver :phantom ~@args)) - (defmacro with-safari "Executes `body` with a Safari driver session bound to `bind`. diff --git a/src/etaoin/api2.clj b/src/etaoin/api2.clj index b1e7b924..a36ea00f 100644 --- a/src/etaoin/api2.clj +++ b/src/etaoin/api2.clj @@ -56,23 +56,6 @@ `(e/with-driver :edge ~opts ~bind ~@body)) -(defmacro with-phantom - "Executes `body` with a Phantom.JS driver session bound to `bind`. - - Driver is automatically launched and terminated (even if an exception occurs). - - `opts` - optional, see [Driver Options](/doc/01-user-guide.adoc#driver-options). - - Example: - - ```Clojure - (with-phantom [driver] - (go driver \"https://clojure.org\")) - ```" - [[bind & [opts]] & body] - `(e/with-driver :phantom ~opts ~bind - ~@body)) - (defmacro with-safari "Executes `body` with a Safari driver session bound to `bind`. diff --git a/src/etaoin/ide/main.clj b/src/etaoin/ide/main.clj index 603991c7..fbd96b21 100644 --- a/src/etaoin/ide/main.clj +++ b/src/etaoin/ide/main.clj @@ -21,7 +21,7 @@ (set! *warn-on-reflection* true) (def ^:private browsers-set - #{:chrome :safari :firefox :edge :phantom}) + #{:chrome :safari :firefox :edge}) (defn- str->vec [string] diff --git a/src/etaoin/impl/driver.clj b/src/etaoin/impl/driver.clj index 14edb2c1..2886167d 100644 --- a/src/etaoin/impl/driver.clj +++ b/src/etaoin/impl/driver.clj @@ -86,11 +86,6 @@ [driver port] (set-args driver [(str "--port=" port)])) -(defmethod set-port - :phantom - [driver port] - (set-args driver ["--webdriver" port])) - ;; ;; capabilities ;; @@ -264,11 +259,6 @@ (contains? (set args) "--headless") (:headless driver))) -(defmethod is-headless? - :phantom - [_driver] - true) - ;; ;; HTTP proxy ;; @@ -493,11 +483,6 @@ (-> (set-args driver ["--diagnose"]) (update :post-run-actions (fnil conj []) :discover-safari-webdriver-log))) -(defmethod set-driver-log-level - :phantom - [driver log-level] - (set-args driver [(format "--webdriver-loglevel=%s" log-level)])) - ;; ;; User-Agent ;; https://stackoverflow.com/questions/29916054/ diff --git a/test/etaoin/api_test.clj b/test/etaoin/api_test.clj index a5299df2..78f88cbd 100644 --- a/test/etaoin/api_test.clj +++ b/test/etaoin/api_test.clj @@ -251,21 +251,20 @@ ;; In Safari, alerts work quite slow, so we add some delays. (deftest test-alert - (e/when-not-phantom *driver* - (doto *driver* - (e/click {:id :button-alert}) - (e/when-safari (e/wait 1)) - (-> e/get-alert-text (= "Hello!") is) - (-> e/has-alert? is) - (e/accept-alert) - (e/when-safari (e/wait 1)) - (-> e/has-alert? not is) - (e/click {:id :button-alert}) - (e/when-safari (e/wait 1)) - (-> e/has-alert? is) - (e/dismiss-alert) - (e/when-safari (e/wait 1)) - (-> e/has-alert? not is)))) + (doto *driver* + (e/click {:id :button-alert}) + (e/when-safari (e/wait 1)) + (-> e/get-alert-text (= "Hello!") is) + (-> e/has-alert? is) + (e/accept-alert) + (e/when-safari (e/wait 1)) + (-> e/has-alert? not is) + (e/click {:id :button-alert}) + (e/when-safari (e/wait 1)) + (-> e/has-alert? is) + (e/dismiss-alert) + (e/when-safari (e/wait 1)) + (-> e/has-alert? not is))) (deftest test-properties (e/when-firefox *driver* @@ -483,7 +482,7 @@ (deftest test-window-position (e/when-not-drivers - [:phantom :edge] *driver* + [:edge] *driver* (let [{:keys [x y]} (e/get-window-position *driver*)] (is (numeric? x)) (is (numeric? y)) @@ -597,11 +596,9 @@ :secure false :value "test2"})))) (testing "deleting a cookie" - (e/when-not-phantom - *driver* - (e/delete-cookie *driver* :cookie3) - (let [cookie (e/get-cookie *driver* :cookie3)] - (is (nil? cookie))))) + (e/delete-cookie *driver* :cookie3) + (let [cookie (e/get-cookie *driver* :cookie3)] + (is (nil? cookie)))) (testing "deleting all cookies" (doto *driver* e/delete-cookies @@ -611,9 +608,7 @@ (deftest test-page-source (let [src (e/get-source *driver*)] - (if (e/phantom? *driver*) - (is (str/starts-with? src "")) - (is (str/starts-with? src ""))))) + (is (str/starts-with? src "")))) (defn- valid-image? [file] (if-let [image-magick (some-> (fs/which (if (= "Linux" (os-name)) @@ -790,29 +785,28 @@ (deftest test-actions (testing "input key and mouse click" - (e/when-not-phantom *driver* - (let [input (e/query *driver* :simple-input) - password (e/query *driver* :simple-password) - textarea (e/query *driver* :simple-textarea) - submit (e/query *driver* :simple-submit) - keyboard (-> (e/make-key-input) - e/add-double-pause - (e/with-key-down "\uE01B") - e/add-double-pause - (e/with-key-down "\uE01C") - e/add-double-pause - (e/with-key-down "\uE01D")) - mouse (-> (e/make-mouse-input) - (e/add-pointer-click-el input) - e/add-pause - (e/add-pointer-click-el password) - e/add-pause - (e/add-pointer-click-el textarea) - e/add-pause - (e/add-pointer-click-el submit))] - (e/perform-actions *driver* keyboard mouse) - (e/wait 1) - (is (str/ends-with? (e/get-url *driver*) "?login=1&password=2&message=3")))))) + (let [input (e/query *driver* :simple-input) + password (e/query *driver* :simple-password) + textarea (e/query *driver* :simple-textarea) + submit (e/query *driver* :simple-submit) + keyboard (-> (e/make-key-input) + e/add-double-pause + (e/with-key-down "\uE01B") + e/add-double-pause + (e/with-key-down "\uE01C") + e/add-double-pause + (e/with-key-down "\uE01D")) + mouse (-> (e/make-mouse-input) + (e/add-pointer-click-el input) + e/add-pause + (e/add-pointer-click-el password) + e/add-pause + (e/add-pointer-click-el textarea) + e/add-pause + (e/add-pointer-click-el submit))] + (e/perform-actions *driver* keyboard mouse) + (e/wait 1) + (is (str/ends-with? (e/get-url *driver*) "?login=1&password=2&message=3"))))) (deftest test-shadow-dom (testing "basic functional sanity"