Name: purescript-lunapark
Owner: SlamData, Inc.
Description: null
Created: 2018-04-23 14:04:10.0
Updated: 2018-05-15 09:38:15.0
Pushed: 2018-05-15 09:52:18.0
Homepage: null
Size: 27308
Language: PureScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
vendor
folders: three drivers and selenium jar – are subjects of appropriate copyrights.The main purpose of this library is to provide purescript webdriver/json-wire protocol bindings, such that won't involve any JavaScript dependencies.
purescript-argonaut
's Json
type and purescript-affjax
s helper functions (get
, post
etc)Endpoint@Lunapark.Endpoint
type. This module also provides helper functions
returning Aff _ (Either Error Json)
Lunapark.Types
module.purescript-run
. There are several functors, but the main two are: LunaparkF
and ActionF
.
This functor embed in Run
encode almost all posible interactions with w3c/selenium server.ActionF
functor (that is a functor that encodes all posible actions like click, hover) is interpreted to
LunaparkF
, then LunaparkF
is interpreted into Run
with EXCEPT
and AFF|EFF
effects.Lunapark
is facade library on top of api, functors and error.Array Capability
. init
function takes a record
{ alwaysMatch: Array Capability, firstMatch: Array (Array Capability) }
. firstMatch
must have at least on array.init@Lunapark.API
. The result would be Aff _ (Either Error Interpreter)
,
where Interpreter
is function taking Lunapark
monad and unwrapping it into Run
with EXCEPT
and AFF|EFF
. E.g. = launchAff do
terpreterOrError ? init "http://localhost:4444/wd/hub" { alwaysMatch: [], firstMatch: [[BrowserName Chrome]] }
se intepreterOrError of
Left err ? throwError $ error "An error during selenium session initialization occured"
Right interpret ? Run.runBaseAff' $ Run.runExcept $ interpret do
go "http://my-site.com"
el ? findElement $ ByCss $ CSS.fromString ".my-class"
clickEl el
login ? findElement $ ByCss $ CSS.fromString "#login"
password ? findElement $ ByCss $ CSS.fromString "#password"
moveTo { origin: login, x: 0, y: 0, duration: Milliseconds 1000.0 }
click
sendKeys "login"
moveTo { origin: password, x: 0, y: 0, duration: Milliseconds 100.0 }
sendKeys "secret"
sendKeys "\\xE007"
GET@/session/:sessionId/timeouts
via W3C standard it will use it otherwise the interpreter makes it a chain call of
JsonWire commands. The same works for actions: they are interpreted into either POST@/session/:sessionId/action
or
chains of JsonWire commands.