This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-25
Channels
- # aleph (18)
- # announcements (7)
- # asami (18)
- # babashka (15)
- # babashka-sci-dev (79)
- # beginners (61)
- # calva (4)
- # clj-kondo (23)
- # cljfx (16)
- # cljs-dev (6)
- # clojure (63)
- # clojure-bay-area (3)
- # clojure-europe (33)
- # clojure-nl (1)
- # clojure-survey (4)
- # clojure-uk (5)
- # clojurescript (136)
- # conjure (1)
- # cursive (8)
- # datahike (7)
- # datalevin (1)
- # datomic (30)
- # emacs (10)
- # events (2)
- # figwheel (2)
- # fulcro (20)
- # google-cloud (1)
- # lsp (6)
- # luminus (4)
- # malli (5)
- # music (3)
- # nextjournal (1)
- # off-topic (9)
- # other-languages (3)
- # pathom (16)
- # polylith (34)
- # re-frame (14)
- # reagent (19)
- # releases (6)
- # sci (2)
- # shadow-cljs (33)
Hello all, Is there anyone who experience Reader class not found error using carmine? I’m using 3.1.0 version
It might be... but problem is I don’t know which lib is causing conflict :thinking_face:
I’ve found someone who had same issue and he solved excluding clojurescript from his edn but I don’t have it
um…. I’ve just add encore which is version 3.21, and It solved 😅 thanks for your comment! @U06BE1L6T
it's Friday and if you're looking to slack off for a few minutes, why not answer the 2022 Clojure survey? takes 5-10 min. https://www.surveymonkey.com/r/clojure2022
Is there a way to call a static function on a java Interface? https://github.com/microsoft/playwright-java/blob/85b671328ed78937201a9667be726bcf6d6989d8/playwright/src/main/java/com/microsoft/playwright/assertions/PlaywrightAssertions.java
The guidance from java-land is to do import
_static_ com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
and then just use assertThat
as a top level thing.
The obvious (com.microsoft.playwright.assertions.PlaywrightAssertions/assertThat)
fails with ClassNotFound
and what does com.microsoft.playwright.assertions.PlaywrightAssertions in the repl do?
java.lang.Appendable
is an example of an interface. What happens when you type that into the REPL?
(answer: not CNFE)
so interfaces are looked up via class*loaders and result in *class not found exceptions
Sure. I'm asking because writing tests with #nbb + playwright is pretty smooth, I've already done it in two projecs ;)
In our case we have to spin up server, setup fixtures etc etc so since this is already in the JVM it probably makes sense to do the testing in-process
(ns nosco.test.browser-helpers
(:import [com.microsoft.playwright
Playwright Browser Page Locator
BrowserType$LaunchOptions]
[com.microsoft.playwright.assertions
PlaywrightAssertions]))
(defn launch-options [{:keys [headless slomo]}]
(let [options (BrowserType$LaunchOptions.)]
(.setHeadless options headless)
(when slomo
(.setSlowMo options slomo))
options))
(defn launch-browser [pw launch-options]
(let [b (.. pw chromium (launch launch-options))]
b))
(def PW (Playwright/create))
(def B (launch-browser PW (launch-options {:headless false
:slomo 50})))
(def P (.newPage B))
(.navigate P "")
(->
(.locator P "text=powered")
(PlaywrightAssertions/assertThat)
(.containsText "powered by"))
That's all there is to it so far. Jar is on maven, API docs seem decent. No async stuff.
It downloads and caches the browser runtimes on first attempt to create a PW instance.
Here is some public code in nbb + playwright: https://github.com/nextjournal/clerk/pull/97/files#diff-b23141a8b434170a1e2c9752602115a4f7baddafb34af8cc92cfa6dc7da3e0a4
For me the value is mostly on no async, plus the whole idea of setting up fixtures and tearing them down
The setting up and tearing down is supported in nbb (cljs.test) too. The async stuff is mitigated by promesa which has macros that make it almost seem like you're writing sync code.
Here's a more succinct version: https://github.com/babashka/nbb/blob/main/examples/playwright/example.cljs
I'll take this as a vote of confidence on the general project though. Seems very polished.
FWIW, I've used one Node.js Playwright in one project and JVM Playwright in another and I'd pick JVM Playwright all day, every day. :)
Fixtures as in inserting data in a database and then testing that the frontend comes up with the correct answer 🙂
Playwright is the spiritual successor of Puppeteer, same team, migrated to a different company
you'll need to look at how your repl was launched and see if that class/type/interface is available to it
is there a known implementation of a function that, given a spec and a map, walks the map and only keeps the keys mentioned in the spec recursively?
@hiredman thanks. I can't see why it shouldn't be available, everything else is. I guess I can open the jar and poke around.
1. restart your repl 2. make sure the version you are looking at on github is the same as the verion you are using
I just wrote a function that returns a "conversational string" for the type of a given input, so 1
returns "string"
and {:a "hello"}
returns "map"
. i feel like i'm reinventing the wheel but i don't see anything in the core library. am i missing something obvious?
type
or class
are in that ballpark, but don't know of anything that makes "simpler" names like that
I have something like that in clj-kondo... but probably not re-usable outside of that context.
whoops yes, i mean 1
returns "number"
cool, as long as i've not missed something obvious
what do you return for (deftype Foo [a])
? Or for com.microsoft.playwright.assertions.PlaywrightAssertions
? I guess you just have a map of common versions, check ancestors against it and then return the className otherwise?
Yes, I'm checking the basic data types (symbol, keyword, string, number, map, set, seq, and vector) and then defaulting to (type input)
.