diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 09d9545..61edeb4 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -29,6 +29,7 @@ A release with an intentional breaking changes is marked with: ** {issue}644[#644]: Deprecate `when-predicate` and `when-not-predicate` macros. See docstrings for guidance on alternatives. These will may be removed from the API at the next release that contains breaking changes. ({person}dgr[@dgr]) ** {issue}647[#647]: Fix logic bug in `intersects?`. Added tests to test suite. ({person}dgr[@dgr]) ** {issue}649[#649]: When supplied a vector argument for `q-text`, `fill-multi` and `fill-human-multi` now fill fields in the order that fields appear in the vector. Previously, the order was not guaranteed. ({person}dgr[@dgr]) +** {issue}657[#657]: Make `set--timeout` functions resilient to reasonable non-integer timeouts (e.g., rationals, doubles, etc.). ({person}dgr[@dgr]) == v1.1.41 [minor breaking] - 2024-08-14 [[v1.1.41]] diff --git a/src/etaoin/impl/util.clj b/src/etaoin/impl/util.clj index 48c473a..6033825 100644 --- a/src/etaoin/impl/util.clj +++ b/src/etaoin/impl/util.clj @@ -26,7 +26,7 @@ (defmethod ~multifn dispatch-val# ~@fn-tail))) (defn sec->ms [sec] - (* sec 1000)) + (long (* sec 1000))) (defn ms->sec [ms] (/ ms 1000)) diff --git a/test/etaoin/api_test.clj b/test/etaoin/api_test.clj index 98b5fb7..c3fa5fc 100644 --- a/test/etaoin/api_test.clj +++ b/test/etaoin/api_test.clj @@ -1094,19 +1094,27 @@ {:class :inside} {:tag :span}]))))) (deftest test-timeouts - (let [timeouts {:implicit 32134 - :script 78921 - :pageLoad 98765}] - (e/set-timeouts *driver* timeouts) - (is (= timeouts (e/get-timeouts *driver*))) - (e/set-page-load-timeout *driver* 987) - (e/set-implicit-timeout *driver* 876) - (e/set-script-timeout *driver* 765) - (is (= 987 (e/get-page-load-timeout *driver*))) - (is (= 876 (e/get-implicit-timeout *driver*))) - (is (= 765 (e/get-script-timeout *driver*))) - (is (= {:pageLoad 987000 :implicit 876000 :script 765000} - (e/get-timeouts *driver*))))) + (testing "basic timeout tests" + (let [timeouts {:implicit 32134 + :script 78921 + :pageLoad 98765}] + (e/set-timeouts *driver* timeouts) + (is (= timeouts (e/get-timeouts *driver*))) + (e/set-page-load-timeout *driver* 987) + (e/set-implicit-timeout *driver* 876) + (e/set-script-timeout *driver* 765) + (is (= 987 (e/get-page-load-timeout *driver*))) + (is (= 876 (e/get-implicit-timeout *driver*))) + (is (= 765 (e/get-script-timeout *driver*))) + (is (= {:pageLoad 987000 :implicit 876000 :script 765000} + (e/get-timeouts *driver*))))) + (testing "non-integer timeout values" + ;; These should not throw. If they do, the test runner will record + ;; a test failure. + (is (do (e/set-page-load-timeout *driver* 1.33333) + true)) + (is (do (e/set-page-load-timeout *driver* 100/3) + true)))) (comment ;; start test server