Skip to content

Commit

Permalink
ci: show webdriver output for flaky os/browsers (#593)
Browse files Browse the repository at this point in the history
* ci: show webdriver output for flaky os/browsers

We can turf this change if we solve the flakiness.

* ci: firefox driver logs: try info instead of trace

Trace generates lotsa output, maybe we don't need to go to that level,
we'll see.

* test-switch-window: add wait for safari

* tests: turf some old diagnostic printlns

We don't seem to need these proc-test printlns at this time,
we can re-introduce if tests start to flake out in the future.
  • Loading branch information
lread committed May 20, 2024
1 parent a7e88df commit fa11b57
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
17 changes: 15 additions & 2 deletions test/etaoin/api_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,21 @@
(defn get-default-drivers []
[:firefox :chrome :safari])

(defn ci? [] (System/getenv "CI"))

(def default-opts
{:chrome {}
:firefox {}
:safari {}
:firefox (cond-> {}
;; add logging for typically flaky CI scenario
(and (ci?) (fs/windows?)) (merge {:log-stdout :inherit
:log-stderr :inherit
:driver-log-level "info"}))
:safari (cond-> {}
;; add logging for kind flaky CI scenario (maybe we'll answer why we need
;; to retry launching safaridriver automatically)
;; safaridriver only logs details to a somewhat obscure file, will follow up
;; with some technique to discover/dump this file
(ci?) (merge {:log-stdout :inherit :log-stderr :inherit}))
:edge {:args ["--headless"]}})

(def drivers
Expand Down Expand Up @@ -488,6 +499,8 @@
init-url (e/get-url *driver*)]
;; press enter on link instead of clicking (safaridriver is not great with the click)
(e/fill *driver* :switch-window k/return)
(e/when-safari *driver*
(e/wait 3)) ;;safari seems to need a breather
(is (= 2 (count (e/get-window-handles *driver*))) "2 windows now exist")
(let [new-handles (e/get-window-handles *driver*)
new-handle (first (filter #(not= % init-handle) new-handles))
Expand Down
8 changes: 0 additions & 8 deletions test/etaoin/unit/proc_test.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns etaoin.unit.proc-test
(:require
[clojure.java.shell :as shell]
[clojure.pprint :as pprint]
[clojure.string :as str]
[clojure.test :refer [deftest is]]
[etaoin.api :as e]
Expand All @@ -15,13 +14,6 @@
(let [instance-report (-> (shell/sh "powershell" "-command" (format "(Get-Process %s -ErrorAction SilentlyContinue).Path" drivername))
:out
str/split-lines)]
;; more flakiness diagnosis
(println "windows" drivername "instance report:" instance-report)
(println "windows full list of running processes:")
;; use Get-CimInstance, because Get-Process, does not have commandline available
(pprint/pprint (-> (shell/sh "powershell" "-command" "Get-CimInstance Win32_Process | select name, commandline")
:out
str/split-lines))
(->> instance-report
(remove #(str/includes? % "\\scoop\\shims\\")) ;; for the scoop users, exclude the shim process
(filter #(str/includes? % drivername))
Expand Down

0 comments on commit fa11b57

Please sign in to comment.