This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-04
Channels
- # announcements (30)
- # aws (7)
- # babashka (7)
- # beginners (64)
- # calva (39)
- # cherry (17)
- # cider (1)
- # clj-on-windows (6)
- # clojure (30)
- # clojure-austin (12)
- # clojure-europe (25)
- # clojure-nl (2)
- # clojure-norway (23)
- # clojure-spec (23)
- # clojure-uk (6)
- # clojurescript (20)
- # cursive (18)
- # datahike (3)
- # datalevin (12)
- # datomic (9)
- # etaoin (5)
- # graalvm (45)
- # instaparse (2)
- # interceptors (11)
- # kaocha (1)
- # lsp (102)
- # meander (6)
- # nbb (16)
- # off-topic (30)
- # pathom (83)
- # pedestal (6)
- # portal (5)
- # re-frame (12)
- # reitit (5)
- # rewrite-clj (10)
- # scittle (35)
- # shadow-cljs (49)
- # spacemacs (10)
- # vim (14)
👋 What's the story for REPL usage w/ Cherry? Can I spin up an nREPL? Thinking about how I'd go about developing Playwright tests via REPL in Cherry :)
@rahx1t This isn't yet there. It's the first thing I'm going to work on after further extracting the common code into compiler-common. Squint does have a console REPL at the moment
Is there a p/do
or p/let
-like macro floating around for use with Cherry? Seeing what's out there before writing my own 🙂
@rahx1t there isn't currently and there probably won't be one since async/await works in cherry :)
I do love await
but feel like there's still value in abstracting that away with a macro. Lazy and trying to type as little as possible 🙂 My code atm is await
everywhere lol
(pw-test "auth via sign-in"
(w/allPagesWrapper
^:async
(fn [^:js {:keys [page context]}]
(js/await (.goto page index))
(js/await (wait-for-client-side-rendered page))
(js/await (.click (.locator page "data-testid=sign-in >> visible=true")))
(js/await
(js/Promise.all [(.waitForNavigation page #js {:url "**/groups/new"})
(let [[new-page] (js/await
(js/Promise.all [(.waitForEvent context "page")
(.click (.locator page "data-testid=sign-in-with-google-button"))]))]
(js/await (.waitForLoadState new-page))
(js/await (.click (.locator new-page "'Add new account'")))
(js/await (.click (.locator new-page "'Auto-generate user information'")))
(js/await (.click (.locator new-page "#sign-in"))))]))
(js/await (wait-for-user-loaded page)))))
I haven't audited this to ensure there aren't any unnecessary await
s, but you catch my drift
you can currently write macros if you have them in file under .
or src
, e.g. src/my_macros.cljc
and then require it with (:require-macros [my-macros :refer [foo]])
Nothing fancy but I'm appreciating the quality of life improvement 🙂 The js/await
makes async macros soooo much easier to write
(defmacro do! [& exprs]
(let [[first-expr & rest-exprs] exprs]
(reduce
(fn [acc# next#]
`(.then ~acc# (fn [_#] ~next#)))
`(js/Promise. (fn [resolve#] (resolve# ~first-expr)))
rest-exprs)))
(defmacro do! [& exprs]
`(do
~@(map (fn [expr#] `(js/await ~expr#)) exprs)))
await->
coming? 🙂