This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-16
Channels
- # announcements (18)
- # architecture (12)
- # babashka (20)
- # beginners (32)
- # biff (21)
- # calva (81)
- # clerk (6)
- # clj-kondo (16)
- # clj-otel (5)
- # cljsrn (8)
- # clojure (94)
- # clojure-austin (1)
- # clojure-australia (1)
- # clojure-europe (68)
- # clojure-nl (2)
- # clojure-norway (6)
- # clojure-uk (2)
- # clojurescript (13)
- # conjure (1)
- # core-logic (1)
- # cursive (7)
- # data-science (2)
- # datahike (3)
- # datomic (12)
- # emacs (33)
- # etaoin (1)
- # fulcro (8)
- # graalvm (2)
- # graphql (1)
- # honeysql (1)
- # hyperfiddle (97)
- # improve-getting-started (40)
- # jobs (2)
- # jobs-discuss (12)
- # lsp (9)
- # membrane (6)
- # nbb (2)
- # off-topic (16)
- # portal (6)
- # re-frame (2)
- # reagent (3)
- # releases (2)
- # remote-jobs (1)
- # tools-deps (7)
- # xtdb (38)
I don't know what the consensus is, but my conclusions so far about testing UI in general are: • Test the data transformation logic separately. • Testing interactions is of limited use outside of end-to-end testing, simulate the user, not the surrounding code. • It's difficult and time consuming to write automated UI tests that don't break. • You have to actually look at the thing and use it manually regardless of what you automated. Maybe there are smarter people who figured this out and came to more nuanced conclusions though.
+1 on @U01EFUL1A8M’s list. Been doing front-ends for forty years, and do not see how automated testing could ever work. For separate QA teams, a manual script of "things to test" is great. tbh, the quality effort should be invested in a quality UI framework. It does not have to be reactive, but it helps. So Reagent gets a +1, but the reactivity of Reagent is not unified, so maybe +1/2. Second, either use experienced UI devs who know instinctively what to test while they are coding, or provide noobs with a "things to test" list.
In my experience, automated UI testing never works. It requires either the HTML structure staying the same or the visual identity staying the same, which causes so many false positives that you're better off just not doing it.
It's interesting that others have come to the same kind of conclusions. I wonder if the mentioned hindrances are inherent to UI testing or if they are inherent in how UI is coded in the first place. Generating the UI is typically the last step of a pipeline that gets increasingly concrete and in many ways also imperative. I saw a recent [talk](https://www.youtube.com/watch?v=Mjn92fODdaA) about #CVB8K7V50 and there might be a hint towards making UI programming easier to reason about and ultimately also easier to test? It's an open question.
Well, we start with an impedance mismatch: we want to run automatically a test requiring user input, checked by what the user would see. Second, we especially need the test to work, not during original development, rather after the UI component has changed, or has been involved in a larger refactoring. So, as usual with regression testing, we will more often have to alter the test than fix the code, which is actually OK. I think #CVB8K7V50 solves the first problem by saying, no, a UI is now just a data transformation. So there is a nice divide-and-conquer win there. Not sure any test survives a change in functionality,
I'm trying to 'https://cljdoc.org/d/reagent/reagent/1.0.0/doc/tutorials/interop-with-react#creating-reagent-components-from-react-components'
My code:
(ns frontend.music-video
(:require
[reagent.core :as r]
[react-youtube :as YouTube]))
(defn show [youtube-id]
[:> YouTube
{:videoId "u-pP_dCenJA"}])
Errors:
1. Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot <webpack://culturevein/./node_modules/react-dom/cjs/react-dom.development.js?|react-dom.development.js:86:30>
2. Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.
Maybe I need to update React?
1. You have installed React 18. Currently, by default Reagent supports only 17. There was some work to support 18 but IIRC there are still some hiccups
2. How do you use show
? If you log YouTube
, does it appear as a component or as an export object?
The export statement says export default YouTube
. So maybe try ["react-youtube$default" :as YouTube]
.
yep that was it 😄 Many thanks @U2FRKM4TW you are lifesaver. Finally youtube embed works
> there are still some hiccups Pun intended? :rolling_on_the_floor_laughing: