Stream: show and tell

Topic: r2e (End2End testing)


view this post on Zulip Artur Domurad (Jul 02 2024 at 13:41):

I am working on a small e2e framework for roc that can also be used outside of testing to controll the browser.

It is basically just a simple webdriver http client wrapped in some roc types.
(you need a running webdriver server - at least for now)

There is still a lot to implement (like rendering pdfs, and making screenshots from the browser, but first I need to find / write a base64 decoder)
Although, for me it is already fun to use :)

Keep in mind that this package is importing the basic-cli platform - which should not be possible and will be blocked by the compiler in the future.
Why? - I need to make Http calls to the webdriver...
So this package works right now, but will problably stop at some point.
The goal is to wait for the module params feature - then I will release a stable version of r2e.

Here is the repo: https://github.com/adomurad/r2e
And here is the documentation and tutorials: https://adomurad.github.io/r2e-docs/
this are just temporary docs - due to using the basic-cli platform I was not able to use roc docs

Here is an example on how to use the repl on roc-lang.org :

test2 = test "use roc repl" \browser ->
   # go to roc-lang.org
   browser |> Browser.navigateTo! "http://roc-lang.org"
   # find repl input
   replInput = browser |> Browser.findElement! (Css "#source-input")
   # send keys to repl
   replInput |> Element.sendKeys! "0.1+0.2{enter}"
   # find repl output element
   outputEl = browser |> Browser.findElement! (Css ".output")
   # get output text
   outputText = outputEl |> Element.getText!
   # assert text - fail - it is actually 0.3 !!!
   outputText |> Assert.shouldBe "0.3000000001 : Frac *"

r2e-demo.gif

view this post on Zulip Agus Zubiaga (Jul 02 2024 at 14:00):

This is awesome! Roc seems like a great fit for this use case and the API looks great :star_struck:

view this post on Zulip Agus Zubiaga (Jul 02 2024 at 14:06):

I love the REPL example, finally we have eval() in Roc lol


Last updated: Jul 06 2025 at 12:14 UTC