Happy to announce GenieTest.jl for testing, debugging and development of GenieFramework Apps
GenieTest
A Julia package for testing Stipple/Genie applications with integrated frontend support.
Overview
GenieTest provides utilities for creating and testing Genie web applications with both backend (Genie/Stipple reactive models) and frontend (browser or Electron) components. It simplifies the process of launching test applications and verifying their behavior.
GenieTest supports both local debugging as well as remote testing with a unified syntax.
For this purpose we introduce GenieTest.App that behaves very much like a ReactiveModel with some subtle differences.
-
An
Appis a wrapper of optionally both a ReactiveModel instance and an Electron browser window that can be controlled via JS. For most interactions the user just needs to use an instance of this App type -
Values are retrieved fand set via the model, if available, or via the Electron window as a fallback.
-
The app’s fields are available via dot syntax.
-
CAVEAT: The dot syntax always returns values and not Reactive variables. Assignments are nevertheless reactive, e.g.
x = app.myfieldorapp.myfield = "newvalue"will trigger reactive updates. -
Silent updates are only possible if a model is available and can be written as
app[:myfield] = "silent update. Alternatively you can definemodel = app.__model__and continue with standard syntax formodel
Usage
Basic Example
using Stipple, Stipple.ReactiveTools, StippleUI
using GenieTest
@app begin
@in x = "World"
@onchange x @info "new x: $x"
@onchange isready @info "Ready!"
end
@page "/" [htmldiv("Hello"), textfield("", :x)]
# Create an app with browser frontend, wait for the model to be ready
app = GenieTest.App("/")
# alternatively, if the app is already hosted somewhere:
# app = GenieTest.App("https://myapp.myprovider.com", frontend = :electron)
# Access reactive model properties
@show app.x
# Set reactive model properties
app.x = "John"
sleep(3)
# Close the app
close(app)