Skip to content

Commit 2f1a4ba

Browse files
authored
Merge pull request #708 from clj-commons/lread/maint-2025-08-08
maint: bump deps & misc tweaks
2 parents 2d0a4fe + 97c8b3f commit 2f1a4ba

File tree

8 files changed

+139
-43
lines changed

8 files changed

+139
-43
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{:hooks
22
{:analyze-call
3-
{taoensso.encore/defalias taoensso.encore/defalias
4-
taoensso.encore/defn-cached taoensso.encore/defn-cached
5-
taoensso.encore/defonce taoensso.encore/defonce}}}
3+
{taoensso.encore/defalias taoensso.encore-hooks/defalias
4+
taoensso.encore/defaliases taoensso.encore-hooks/defaliases
5+
taoensso.encore/defn-cached taoensso.encore-hooks/defn-cached
6+
taoensso.encore/defonce taoensso.encore-hooks/defonce}}}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
(ns taoensso.encore-hooks
2+
"I don't personally use clj-kondo, so these hooks are
3+
kindly authored and maintained by contributors.
4+
PRs very welcome! - Peter Taoussanis"
5+
(:refer-clojure :exclude [defonce])
6+
(:require
7+
[clj-kondo.hooks-api :as hooks]))
8+
9+
(defn defalias
10+
[{:keys [node]}]
11+
(let [[alias src-raw _attrs body] (rest (:children node))
12+
src (or src-raw alias)
13+
sym (if src-raw (hooks/sexpr alias) (symbol (name (hooks/sexpr src))))]
14+
{:node
15+
(with-meta
16+
(hooks/list-node
17+
[(hooks/token-node 'def)
18+
(hooks/token-node sym)
19+
(if body
20+
(hooks/list-node
21+
;; use :body in the def to avoid unused import/private var warnings
22+
[(hooks/token-node 'or) body src])
23+
src)])
24+
(meta src))}))
25+
26+
(defn defaliases
27+
[{:keys [node]}]
28+
(let [alias-nodes (rest (:children node))]
29+
{:node
30+
(hooks/list-node
31+
(into
32+
[(hooks/token-node 'do)]
33+
(map
34+
(fn alias->defalias [alias-node]
35+
(cond
36+
(hooks/token-node? alias-node)
37+
(hooks/list-node
38+
[(hooks/token-node 'taoensso.encore/defalias)
39+
alias-node])
40+
41+
(hooks/map-node? alias-node)
42+
(let [{:keys [src alias attrs body]} (hooks/sexpr alias-node)
43+
;; workaround as can't seem to (get) using a token-node
44+
;; and there's no update-keys (yet) in sci apparently
45+
[& {:as node-as-map}] (:children alias-node)
46+
{:keys [attrs body]} (zipmap (map hooks/sexpr (keys node-as-map))
47+
(vals node-as-map))]
48+
(hooks/list-node
49+
[(hooks/token-node 'taoensso.encore/defalias)
50+
(or alias src) (hooks/token-node src) attrs body])))))
51+
alias-nodes))}))
52+
53+
(defn defn-cached
54+
[{:keys [node]}]
55+
(let [[sym _opts binding-vec & body] (rest (:children node))]
56+
{:node
57+
(hooks/list-node
58+
(list
59+
(hooks/token-node 'def)
60+
sym
61+
(hooks/list-node
62+
(list*
63+
(hooks/token-node 'fn)
64+
binding-vec
65+
body))))}))
66+
67+
(defn defonce
68+
[{:keys [node]}]
69+
;; args = [sym doc-string? attr-map? init-expr]
70+
(let [[sym & args] (rest (:children node))
71+
[doc-string args] (if (and (hooks/string-node? (first args)) (next args)) [(hooks/sexpr (first args)) (next args)] [nil args])
72+
[attr-map init-expr] (if (and (hooks/map-node? (first args)) (next args)) [(hooks/sexpr (first args)) (fnext args)] [nil (first args)])
73+
74+
attr-map (if doc-string (assoc attr-map :doc doc-string) attr-map)
75+
sym+meta (if attr-map (with-meta sym attr-map) sym)
76+
rewritten
77+
(hooks/list-node
78+
[(hooks/token-node 'clojure.core/defonce)
79+
sym+meta
80+
init-expr])]
81+
82+
{:node rewritten}))

.github/workflows/test.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,14 @@ jobs:
107107
brew install --cask microsoft-edge
108108
EDGE_VERSION=$(defaults read /Applications/Microsoft\ Edge.app/Contents/Info CFBundleShortVersionString)
109109
MAJOR_VERSION=$(echo $EDGE_VERSION | cut -d'.' -f1)
110-
DRIVER_VERSION=$(curl -s "https://msedgedriver.azureedge.net/LATEST_RELEASE_${MAJOR_VERSION}_MACOS" | iconv -f UTF-16LE -t UTF-8 | sed 's/^\xEF\xBB\xBF//' | tr -d '\r\n')
110+
DRIVER_VERSION=$(curl -s "https://msedgedriver.microsoft.com/LATEST_RELEASE_${MAJOR_VERSION}_MACOS" | iconv -f UTF-16LE -t UTF-8 | sed 's/^\xEF\xBB\xBF//' | tr -d '\r\n')
111111
echo "Installing msedgedriver version ${DRIVER_VERSION} for Edge version ${EDGE_VERSION}"
112-
DRIVER_URL="https://msedgedriver.azureedge.net/${DRIVER_VERSION}/edgedriver_mac64_m1.zip"
112+
DRIVER_URL="https://msedgedriver.microsoft.com/${DRIVER_VERSION}/edgedriver_mac64_m1.zip"
113113
wget $DRIVER_URL
114114
mkdir $RUNNER_TEMP/edgedriver
115115
unzip edgedriver_mac64_m1.zip -d $RUNNER_TEMP/edgedriver
116116
echo "$RUNNER_TEMP/edgedriver" >> $GITHUB_PATH
117117
118-
# No longer pre-installed on macOS github action runners
119-
- name: Install Firefox on macOS
120-
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'firefox') }}
121-
run: |
122-
brew install --cask firefox
123-
brew install geckodriver
124-
125118
- uses: actions/checkout@v4
126119

127120
- name: Restore Clojure deps from cache
@@ -160,6 +153,9 @@ jobs:
160153
run: bb tools-versions
161154

162155
- name: Run Tests
156+
env:
157+
# default is 1min, try 4min to see if that helps with Windows http timeouts
158+
ETAOIN_TIMEOUT: ${{ (matrix.os == 'windows' && '240') || '60' }}
163159
run: ${{ matrix.cmd }}
164160

165161
- name: Upload test debug output

bb.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{:min-bb-version "0.8.2"
22
:paths ["script" "build"]
33
:deps {doric/doric {:mvn/version "0.9.0"}
4-
org.clj-commons/pretty {:mvn/version "3.3.2"}
4+
org.clj-commons/pretty {:mvn/version "3.6.2"}
55
lread/status-line {:git/url "https://github.com/lread/status-line.git"
66
:sha "cf44c15f30ea3867227fa61ceb823e5e942c707f"}
77
dev.nubank/docopt {:mvn/version "0.6.1-fix7"}

deps.edn

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{:paths ["src" "resources"]
22
:deps {org.clojure/clojure {:mvn/version "1.10.3"} ;; min clojure version
3-
babashka/fs {:mvn/version "0.5.25"}
3+
babashka/fs {:mvn/version "0.5.26"}
44
babashka/process {:mvn/version "0.6.23"}
55
org.babashka/http-client {:mvn/version "0.4.23"}
66
slingshot/slingshot {:mvn/version "0.12.2"}
@@ -21,7 +21,7 @@
2121
:debug {:extra-paths ["env/dev/resources"]}
2222
:test {:extra-paths ["test" "env/test/resources" "build"]
2323
:extra-deps {io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"}
24-
org.babashka/cli {:mvn/version "0.8.65"}
24+
org.babashka/cli {:mvn/version "0.8.66"}
2525
ch.qos.logback/logback-classic {:mvn/version "1.5.18"}
2626
;; for http-client which uses apache http client 4.x which uses commons logging
2727
org.slf4j/jcl-over-slf4j {:mvn/version "2.0.17"}
@@ -54,7 +54,7 @@
5454

5555
:clofidence {:classpath-overrides {org.clojure/clojure nil}
5656
:extra-deps {com.github.flow-storm/clojure {:mvn/version "1.12.1"}
57-
com.github.flow-storm/clofidence {:mvn/version "0.4.1"}}
57+
com.github.flow-storm/clofidence {:mvn/version "0.4.2"}}
5858
:exec-fn clofidence.main/run
5959
:exec-args {:report-name "Etaoin Test Coverage"
6060
:output-folder "target/clofidence"
@@ -63,7 +63,7 @@
6363
:jvm-opts ["-Dclojure.storm.instrumentOnlyPrefixes=etaoin"]}
6464

6565
;; for consistent linting we use a specific version of clj-kondo through the jvm
66-
:clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2025.06.05"}}
66+
:clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2025.07.28"}}
6767
:main-opts ["-m" "clj-kondo.main"]}
6868

6969
:eastwood {:extra-deps {jonase/eastwood {:mvn/version "1.4.3"}}
@@ -74,7 +74,7 @@
7474
:exclude-linters [:local-shadows-var]
7575
:ignored-faults {:deprecations {etaoin.api-test true}}}]}
7676

77-
:build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.9"}}
77+
:build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.10"}}
7878
:extra-paths ["build"]
7979
:ns-default build}
8080

@@ -91,7 +91,7 @@
9191
:repl/cider
9292
{:extra-deps {org.clojure/clojure {:mvn/version "1.12.1"}
9393
nrepl/nrepl {:mvn/version "1.3.1"}
94-
cider/cider-nrepl {:mvn/version "0.56.0"}
94+
cider/cider-nrepl {:mvn/version "0.57.0"}
9595
refactor-nrepl/refactor-nrepl {:mvn/version "3.11.0"}}
9696
:jvm-opts ["-XX:-OmitStackTraceInFastThrow"]
9797
:main-opts ["-m" "nrepl.cmdline"

doc/01-user-guide.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,11 @@ endif::[]
258258
;; search for something interesting
259259
(e/fill driver {:tag :input :name :search} "Clojure programming language")
260260
(e/wait driver 1)
261+
262+
;; select first match presented in drop down
263+
(e/fill driver {:tag :input :name :search} k/arrow-down)
261264
(e/fill driver {:tag :input :name :search} k/enter)
262-
(e/wait-visible driver {:class :mw-search-results})
263265
264-
;; click on first match
265-
(e/click driver [{:class :mw-search-results} {:class :mw-search-result-heading} {:tag :a}])
266266
(e/wait-visible driver {:id :firstHeading})
267267
268268
;; check our new url location
@@ -286,8 +286,8 @@ endif::[]
286286
;; => "Clojure - Wikipedia"
287287
288288
;; let's explore the info box
289-
;; What's its caption? Let's select it with a css query:
290-
(e/get-element-text driver {:css "table.infobox caption"})
289+
;; What's header? Let's select it with a css query:
290+
(e/get-element-text driver {:css "table.infobox tr th"})
291291
;; => "Clojure"
292292
293293
;; Ok, now let's try something trickier

script/test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,4 @@
123123

124124
(defn test-jvm [& args]
125125
(when-let [{:keys [shell-opts test-runner-args]} (prep args)]
126-
(apply shell/clojure shell-opts "-M:test" test-runner-args)))
126+
(apply shell/clojure shell-opts "-J-Dclojure.main.report=stderr" "-M:test" test-runner-args)))

test/etaoin/api_test.clj

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[clojure.edn :as edn]
88
[clojure.java.io :as io]
99
[clojure.java.shell :as shell]
10+
[clojure.set :as cset]
1011
[clojure.string :as str]
1112
[clojure.test :refer [deftest is testing use-fixtures]]
1213
[etaoin.api :as e]
@@ -686,24 +687,40 @@
686687
(deftest test-switch-window-next
687688
(let [init-handle (e/get-window-handle *driver*)]
688689
(dotimes [n 3]
689-
;; press enter on link instead of clicking (safaridriver is not great with click)
690-
(e/fill *driver* :switch-window k/return)
691-
;; Wait for new window to show up
692-
(e/wait-predicate
693-
(fn [] (= (+ 1 (inc n)) (count (e/get-window-handles *driver*))))
694-
{:timeout 30
695-
:interval 0.1
696-
:message (format "Timeout waiting for window #%d to be created"
697-
(+ n 2))})
698-
;; compensate: safari navigates to target window, others stay at source
699-
(e/when-safari *driver*
700-
(e/switch-window *driver* init-handle)
701-
;; Wait for window switch to "settle" before clicking again
702-
(e/wait-predicate
703-
(fn [] (= init-handle (e/get-window-handle *driver*)))
704-
{:timeout 30
705-
:interval 0.1
706-
:message (format "Timeout waiting for window switch")})))
690+
(let [old-handles (e/get-window-handles *driver*)]
691+
;; press enter on link instead of clicking (safaridriver is not great with click)
692+
(println "clicking switch-window link on h" (e/get-window-handle *driver*))
693+
(e/fill *driver* :switch-window k/return)
694+
;; Wait for new window to show up
695+
(println "waiting for new handle to be created")
696+
(e/wait-predicate
697+
(fn [] (= (+ 1 (inc n)) (count (e/get-window-handles *driver*))))
698+
{:timeout 30
699+
:interval 0.1
700+
:message (format "Timeout waiting for window #%d to be created"
701+
(+ n 2))})
702+
(e/when-safari *driver*
703+
;; anomaly last checked: 2025-08-09
704+
;; other drivers stay on source window and return handle for source window
705+
;; safari, navigates to target window but returns handle for source window, which confuses it
706+
(let [new-handles (e/get-window-handles *driver*)
707+
new-handle (first (cset/difference (set new-handles) (set old-handles)))]
708+
;; tell safari to switch to the window it is displaying
709+
(e/switch-window *driver* new-handle)
710+
;; give it some time
711+
(e/wait-predicate
712+
(fn [] (= new-handle (e/get-window-handle *driver*)))
713+
{:timeout 30
714+
:interval 0.1
715+
:message (format "Timeout waiting for window switch to new-handle")})
716+
;; tell safari to switch to the inital window
717+
(e/switch-window *driver* init-handle)
718+
;; give it some time
719+
(e/wait-predicate
720+
(fn [] (= init-handle (e/get-window-handle *driver*)))
721+
{:timeout 30
722+
:interval 0.1
723+
:message (format "Timeout waiting for window switch to init-handle")})))))
707724
(is (= 4 (count (e/get-window-handles *driver*))) "4 windows now exist")
708725
(is (= init-handle (e/get-window-handle *driver*)) "on first window")
709726
(dotimes [_ 3]

0 commit comments

Comments
 (0)