git.iko.soy/rowtype-yoga/purescript-lunapark
on main help sign in
Update for GH actions, PS 0.14
commit0de0edd8e96f1ce875d3a8aa21d69a12653f4fcc authorGary Burgess <gary.burgess@gmail.com> dateMon 14 Jun 2021, 14:28 (5 years ago) parent1c79bb5
14 files changed+144−158
.github/workflows/ci.yml+31 .gitignore+1−2 .travis.yml−15 README.md+1−1 bower.json+6−6 package.json+3−7 packages.dhall−4 spago.dhall−15 src/Lunapark.purs+3−3 src/Lunapark/API.purs+21−25 src/Lunapark/ActionF.purs+16−18 src/Lunapark/Endpoint.purs+1−1 src/Lunapark/LunaparkF.purs+55−56 src/Lunapark/Utils.purs+6−5
.github/workflows/ci.ymlnew file+31
@@ -0,0 +1,31 @@
1+name: CI
2+
3+on:
4+ - push
5+ - pull_request
6+
7+jobs:
8+ build:
9+ runs-on: ubuntu-latest
10+ steps:
11+ - uses: actions/checkout@v2
12+
13+ - uses: purescript-contrib/setup-purescript@main
14+
15+ - uses: actions/setup-node@v1
16+ with:
17+ node-version: "12"
18+
19+ - name: Install dependencies
20+ run: |
21+ npm install -g bower
22+ npm install
23+ bower install --production
24+
25+ - name: Build source
26+ run: npm run-script build
27+
28+ - name: Run tests
29+ run: |
30+ bower install
31+ npm run-script test --if-present
.gitignore+1−2
@@ -1,8 +1,7 @@
11/.*
22!/.gitignore
3−!/.travis.yml
3+!/.github
44/bower_components/
55/node_modules/
66/output/
7−/example/dist/test.js
87package-lock.json
.travis.ymldeleted−15
@@ -1,15 +0,0 @@
1−language: node_js
2−dist: trusty
3−sudo: required
4−node_js: stable
5−install:
6− - npm install
7− - npm install -g spago
8− - spago install
9−script:
10− - npm run -s build
11−after_success:
12−- >-
13− test $TRAVIS_TAG &&
14− echo $GITHUB_TOKEN | pulp login &&
15− echo y | pulp publish --no-push
README.md+1−1
@@ -1,7 +1,7 @@
11# purescript-lunapark
22
33[![Latest release](http://img.shields.io/github/release/slamdata/purescript-lunapark.svg)](https://github.com/slamdata/purescript-lunapark/releases)
4−[![Build status](https://travis-ci.org/slamdata/purescript-lunapark.svg?branch=master)](https://travis-ci.org/slamdata/purescript-lunapark)
4+![Build Status](https://github.com/slamdata/purescript-lunapark/actions/workflows/ci.yml/badge.svg)
55
66## Disclaimer
77
bower.json+6−6
@@ -25,11 +25,11 @@
2525 "vendor"
2626 ],
2727 "dependencies": {
28− "purescript-affjax": "^11.0.0",
29− "purescript-argonaut-codecs": "^7.0.0",
30− "purescript-argonaut-core": "^5.0.0",
31− "purescript-css": "^4.0.0",
32− "purescript-node-fs-aff": "^6.0.0",
33− "purescript-run": "^3.0.0"
28+ "purescript-affjax": "^12.0.0",
29+ "purescript-argonaut-codecs": "^8.1.0",
30+ "purescript-argonaut-core": "^6.0.0",
31+ "purescript-css": "^5.0.1",
32+ "purescript-node-fs-aff": "^7.0.0",
33+ "purescript-run": "^4.0.0"
3434 }
3535}
package.json+3−7
@@ -2,16 +2,12 @@
22 "name": "purescript-lunapark",
33 "private": true,
44 "scripts": {
5− "build": "spago build --purs-args '--censor-lib --strict'",
6− "build:non-strict": "spago build",
7− "ide": "purs ide server"
5+ "build": "pulp build -- --censor-lib --strict"
86 },
97 "license": "Apache-2.0",
108 "dependencies": {
11− "chromedriver": "^86.0.0",
129 "pulp": "^15.0.0",
13− "purescript": "^0.13.8",
14− "purescript-psa": "^0.8.0",
15− "xhr2": "^0.2.0"
10+ "purescript": "^0.14.2",
11+ "purescript-psa": "^0.8.2"
1612 }
1713}
packages.dhalldeleted−4
@@ -1,4 +0,0 @@
1−let upstream =
2− https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20201021/packages.dhall sha256:55ebdbda1bd6ede4d5307fbc1ef19988c80271b4225d833c8d6fb9b6fb1aa6d8
3−
4−in upstream
spago.dhalldeleted−15
@@ -1,15 +0,0 @@
1−{ name = "lunapark"
2−, dependencies =
3− [ "argonaut-core"
4− , "argonaut-codecs"
5− , "affjax"
6− , "console"
7− , "css"
8− , "effect"
9− , "node-fs-aff"
10− , "psci-support"
11− , "run"
12− ]
13−, packages = ./packages.dhall
14−, sources = [ "src/**/*.purs" ]
15−}
src/Lunapark.purs+3−3
@@ -8,9 +8,9 @@ module Lunapark
88 ) where
99
1010
11−import Lunapark.API (Lunapark, Interpreter(..), runInterpreter, BaseEffects, HandleLunaparkInput, handleLunapark, init, interpret, interpretW3CActions, jsonWireActions, runLunapark, runLunaparkActions, w3cActions)
11+import Lunapark.API (Lunapark, Interpreter(..), runInterpreter, BASE_EFFECTS, HandleLunaparkInput, handleLunapark, init, interpret, interpretW3CActions, jsonWireActions, runLunapark, runLunaparkActions, w3cActions)
1212import Lunapark.Error (Error(..), CachingError(..), printError)
13−import Lunapark.ActionF (ActionF(..), LUNAPARK_ACTIONS, TouchF(..), ActionsEffect, _lunaparkActions, buttonDown, buttonUp, click, doubleClick, doubleTap, flick, liftAction, longTap, moveTo, pause, scroll, sendKeys, tap, touchDown, touchUp)
14−import Lunapark.LunaparkF (ElementF(..), LUNAPARK, LunaparkF(..), LunaparkEffect, _lunapark, acceptAlert, addCookie, back, childElement, childElements, clearElement, clickElement, closeWindow, deleteAllCookies, deleteCookie, dismissAlert, elementScreenshot, executeScript, executeScriptAsync, findElement, findElements, forward, fullscreenWindow, getAlertText, getAllCookies, getAttribute, getCookie, getCss, getProperty, getRectangle, getTagName, getText, getTimeouts, getTitle, getUrl, getWindowHandle, getWindowHandles, getWindowRectangle, go, isDisplayed, isEnabled, isSelected, liftLunapark, maximizeWindow, minimizeWindow, performActions, quit, refresh, releaseActions, screenshot, sendAlertText, sendKeysElement, setTimeouts, setWindowRectangle, status, submitElement, switchToFrame, switchToParentFrame, switchToWindow)
13+import Lunapark.ActionF (ActionF(..), LUNAPARK_ACTIONS, TouchF(..), _lunaparkActions, buttonDown, buttonUp, click, doubleClick, doubleTap, flick, liftAction, longTap, moveTo, pause, scroll, sendKeys, tap, touchDown, touchUp)
14+import Lunapark.LunaparkF (ElementF(..), LUNAPARK, LunaparkF(..), _lunapark, acceptAlert, addCookie, back, childElement, childElements, clearElement, clickElement, closeWindow, deleteAllCookies, deleteCookie, dismissAlert, elementScreenshot, executeScript, executeScriptAsync, findElement, findElements, forward, fullscreenWindow, getAlertText, getAllCookies, getAttribute, getCookie, getCss, getProperty, getRectangle, getTagName, getText, getTimeouts, getTitle, getUrl, getWindowHandle, getWindowHandles, getWindowRectangle, go, isDisplayed, isEnabled, isSelected, liftLunapark, maximizeWindow, minimizeWindow, performActions, quit, refresh, releaseActions, screenshot, sendAlertText, sendKeysElement, setTimeouts, setWindowRectangle, status, submitElement, switchToFrame, switchToParentFrame, switchToWindow)
1515import Lunapark.WebDriverError (WebDriverError, WebDriverErrorType(..), fromJson, fromStringCode, toStringCode)
1616import Lunapark.Types (SessionId(..), WindowHandle(..), FrameId(..), Element(..), CreateSessionResponse, ServerStatus, Timeouts, Rectangle, RawLocator, Locator(..), Script, Cookie, Screenshot, Button(..), PointerMoveOrigin(..), PointerMove, Action, PointerType(..), ActionSequence(..), ActionRequest, BrowserType(..), DriverPaths, PageLoad(..), UnhandledPrompt(..), Platform(..), Capability(..), CapabilitiesRequest, MoveToRequest)
src/Lunapark/API.purs+21−25
@@ -22,10 +22,10 @@ import Effect.Aff.Class (class MonadAff, liftAff)
2222import Effect.Class (liftEffect)
2323import Effect.Ref as Ref
2424import Foreign.Object as FO
25−import Lunapark.ActionF (_lunaparkActions, ActionF(..), TouchF(..), ActionsEffect)
25+import Lunapark.ActionF (_lunaparkActions, ActionF(..), TouchF(..), LUNAPARK_ACTIONS)
2626import Lunapark.Endpoint as LP
2727import Lunapark.Error as LE
28−import Lunapark.LunaparkF (_lunapark, ElementF(..), LunaparkF(..), LunaparkEffect, performActions, findElement)
28+import Lunapark.LunaparkF (_lunapark, ElementF(..), LunaparkF(..), LUNAPARK, performActions, findElement)
2929import Lunapark.Types as LT
3030import Lunapark.Utils (liftAndRethrow, rethrowAsJsonDecodeError, catch)
3131import Node.Buffer as B
@@ -36,11 +36,11 @@ import Run.Except (EXCEPT)
3636import Type.Row (type (+))
3737import Run.Except as RE
3838
39−type Lunapark r a = Run (BaseEffects + LunaparkEffect + ActionsEffect + r) a
39+type Lunapark r a = Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r) a
4040
41−newtype Interpreter r = Interpreter (Run (BaseEffects + LunaparkEffect + ActionsEffect + r) ~> Run (BaseEffects r))
41+newtype Interpreter r = Interpreter (Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r) ~> Run (BASE_EFFECTS r))
4242
43−runInterpreter ∷ ∀ r. Interpreter r → Run (BaseEffects + LunaparkEffect + ActionsEffect + r) ~> Run (BaseEffects r)
43+runInterpreter ∷ ∀ r. Interpreter r → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r) ~> Run (BASE_EFFECTS r)
4444runInterpreter (Interpreter f) = f
4545
4646init
@@ -93,24 +93,20 @@ init uri caps = do
9393interpret
9494 ∷ ∀ r
9595 . HandleLunaparkInput
96− → Run (BaseEffects + LunaparkEffect + ActionsEffect + r )
97− ~> Run (BaseEffects r)
96+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r )
97+ ~> Run (BASE_EFFECTS r)
9898interpret input = runLunapark input <<< runLunaparkActions input
9999
100−type BaseEffects r =
101− ( except ∷ EXCEPT LE.Error
102− , aff ∷ R.AFF
103− , effect ∷ R.EFFECT
104− | r)
100+type BASE_EFFECTS r = EXCEPT LE.Error + R.AFF + R.EFFECT + r
105101
106−runLunapark ∷ ∀ r. HandleLunaparkInput → Run (BaseEffects + LunaparkEffect + r) ~> Run (BaseEffects r)
102+runLunapark ∷ ∀ r. HandleLunaparkInput → Run (BASE_EFFECTS + LUNAPARK + r) ~> Run (BASE_EFFECTS r)
107103runLunapark input = do
108104 R.interpretRec (R.on _lunapark (handleLunapark input) R.send)
109105
110106runLunaparkActions
111107 ∷ ∀ r. HandleLunaparkInput
112− → Run (BaseEffects + LunaparkEffect + ActionsEffect + r )
113− ~> Run (BaseEffects + LunaparkEffect + r)
108+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r )
109+ ~> Run (BASE_EFFECTS + LUNAPARK + r)
114110runLunaparkActions input
115111 | input.actionsEnabled = interpretW3CActions Nil
116112 | otherwise = R.interpretRec (R.on _lunaparkActions (jsonWireActions input) R.send)
@@ -118,8 +114,8 @@ runLunaparkActions input
118114interpretW3CActions
119115 ∷ ∀ r
120116 . List LT.ActionSequence
121− → Run (BaseEffects + LunaparkEffect + ActionsEffect + r )
122− ~> Run (BaseEffects + LunaparkEffect + r )
117+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r )
118+ ~> Run (BASE_EFFECTS + LUNAPARK + r )
123119interpretW3CActions acc as = case R.peel as of
124120 Left la → case tag la of
125121 Left a → w3cActions acc interpretW3CActions a
@@ -135,11 +131,11 @@ w3cActions
135131 ∷ ∀ r a
136132 . List LT.ActionSequence
137133 → ( List LT.ActionSequence
138− → Run (BaseEffects + LunaparkEffect + ActionsEffect + r )
139− ~> Run (BaseEffects + LunaparkEffect + r)
134+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r )
135+ ~> Run (BASE_EFFECTS + LUNAPARK + r)
140136 )
141− → ActionF (Run (BaseEffects + LunaparkEffect + ActionsEffect + r ) a)
142− → Run (BaseEffects + LunaparkEffect + r) a
137+ → ActionF (Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r ) a)
138+ → Run (BASE_EFFECTS + LUNAPARK + r) a
143139w3cActions acc loop = case _ of
144140 Click btn next →
145141 let seq = [ LT.pointerDown btn, LT.pointerUp btn ]
@@ -224,7 +220,7 @@ type HandleLunaparkInput =
224220 , actionsEnabled ∷ Boolean
225221 }
226222
227−jsonWireActions ∷ ∀ r. HandleLunaparkInput → ActionF ~> Run (BaseEffects + LunaparkEffect + r)
223+jsonWireActions ∷ ∀ r. HandleLunaparkInput → ActionF ~> Run (BASE_EFFECTS + LUNAPARK + r)
228224jsonWireActions inp = case _ of
229225 Click btn next → do
230226 _ ← post (LP.Click : Nil) (LT.encodeButton btn)
@@ -238,7 +234,7 @@ jsonWireActions inp = case _ of
238234 DoubleClick btn next → do
239235 _ ← case btn of
240236 LT.LeftBtn → post' (LP.DoubleClick : Nil)
241− other → do
237+ _ → do
242238 _ ← post (LP.Click : Nil) (LT.encodeButton btn)
243239 post (LP.Click : Nil) (LT.encodeButton btn)
244240 pure next
@@ -295,7 +291,7 @@ jsonWireActions inp = case _ of
295291 inSession ∷ LP.EndpointPart
296292 inSession = LP.InSession inp.session
297293
298−handleLunapark ∷ ∀ r. HandleLunaparkInput → LunaparkF ~> Run (BaseEffects r)
294+handleLunapark ∷ ∀ r. HandleLunaparkInput → LunaparkF ~> Run (BASE_EFFECTS r)
299295handleLunapark inp = case _ of
300296 Quit next → do
301297 _ ← delete $ inSession : Nil
@@ -542,7 +538,7 @@ handleLunapark inp = case _ of
542538
543539 -- | It caches an index of an action that is valid for current webdriver implementation.
544540 -- | So you don't need to search correct one by tring them each time
545− tryAndCache ∷ ∀ a. String → Array (Run (BaseEffects r) a) → Run (BaseEffects r) a
541+ tryAndCache ∷ ∀ a. String → Array (Run (BASE_EFFECTS r) a) → Run (BASE_EFFECTS r) a
546542 tryAndCache key actions = do
547543 mp ← R.liftEffect $ Ref.read inp.requestMapRef
548544 case Map.lookup key mp of
src/Lunapark/ActionF.purs+16−18
@@ -8,7 +8,6 @@ import Lunapark.Types as LT
88import Run (Run)
99import Run as R
1010
11−
1211data ActionF a
1312 = Click LT.Button a
1413 | ButtonDown LT.Button a
@@ -32,50 +31,49 @@ derive instance functorActionF ∷ Functor ActionF
3231derive instance functorTouchF ∷ Functor TouchF
3332
3433_lunaparkActions = SProxy ∷ SProxy "lunaparkActions"
35−type LUNAPARK_ACTIONS = R.FProxy ActionF
36−type ActionsEffect r = ( lunaparkActions ∷ LUNAPARK_ACTIONS | r )
34+type LUNAPARK_ACTIONS r = ( lunaparkActions ∷ ActionF | r )
3735
38−liftAction ∷ ∀ r. ActionF Unit → Run (ActionsEffect r) Unit
36+liftAction ∷ ∀ r. ActionF Unit → Run (LUNAPARK_ACTIONS r) Unit
3937liftAction = R.lift _lunaparkActions
4038
41−click ∷ ∀ r. LT.Button → Run (ActionsEffect r) Unit
39+click ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
4240click btn = liftAction $ Click btn unit
4341
44−buttonDown ∷ ∀ r. LT.Button → Run (ActionsEffect r) Unit
42+buttonDown ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
4543buttonDown btn = liftAction $ ButtonDown btn unit
4644
47−buttonUp ∷ ∀ r. LT.Button → Run (ActionsEffect r) Unit
45+buttonUp ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
4846buttonUp btn = liftAction $ ButtonUp btn unit
4947
50−doubleClick ∷ ∀ r. LT.Button → Run (ActionsEffect r) Unit
48+doubleClick ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
5149doubleClick btn = liftAction $ DoubleClick btn unit
5250
53−sendKeys ∷ ∀ r. String → Run (ActionsEffect r) Unit
51+sendKeys ∷ ∀ r. String → Run (LUNAPARK_ACTIONS r) Unit
5452sendKeys txt = liftAction $ SendKeys txt unit
5553
56−moveTo ∷ ∀ r. LT.PointerMove → Run (ActionsEffect r) Unit
54+moveTo ∷ ∀ r. LT.PointerMove → Run (LUNAPARK_ACTIONS r) Unit
5755moveTo move = liftAction $ MoveTo move unit
5856
59−pause ∷ ∀ r. Milliseconds → Run (ActionsEffect r) Unit
57+pause ∷ ∀ r. Milliseconds → Run (LUNAPARK_ACTIONS r) Unit
6058pause ms = liftAction $ Pause ms unit
6159
62−tap ∷ ∀ r. Run (ActionsEffect r) Unit
60+tap ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
6361tap = liftAction $ InTouch $ Tap unit
6462
65−touchDown ∷ ∀ r. Run (ActionsEffect r) Unit
63+touchDown ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
6664touchDown = liftAction $ InTouch $ TouchDown unit
6765
68−touchUp ∷ ∀ r. Run (ActionsEffect r) Unit
66+touchUp ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
6967touchUp = liftAction $ InTouch $ TouchUp unit
7068
71−longTap ∷ ∀ r. Run (ActionsEffect r) Unit
69+longTap ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
7270longTap = liftAction $ InTouch $ LongClick unit
7371
74−flick ∷ ∀ r. LT.PointerMove → Run (ActionsEffect r) Unit
72+flick ∷ ∀ r. LT.PointerMove → Run (LUNAPARK_ACTIONS r) Unit
7573flick move = liftAction $ InTouch $ Flick move unit
7674
77−scroll ∷ ∀ r. LT.PointerMove → Run (ActionsEffect r) Unit
75+scroll ∷ ∀ r. LT.PointerMove → Run (LUNAPARK_ACTIONS r) Unit
7876scroll move = liftAction $ InTouch $ Scroll move unit
7977
80−doubleTap ∷ ∀ r. Run (ActionsEffect r) Unit
78+doubleTap ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
8179doubleTap = liftAction $ InTouch $ DoubleTap unit
src/Lunapark/Endpoint.purs+1−1
@@ -184,7 +184,7 @@ handleAPIError (Right r) = case r.status of
184184 StatusCode 200 → lmap LE.JsonDecodeError do
185185 obj ← J.decodeJson r.body
186186 obj J..: "value"
187− code →
187+ _ →
188188 Left $ either LE.JsonDecodeError LE.WebDriverError $ LWE.fromJson r.body
189189
190190get ∷ String → Endpoint → Aff (Either LE.Error Json)
src/Lunapark/LunaparkF.purs+55−56
@@ -71,167 +71,166 @@ derive instance functorLunaparkF ∷ Functor LunaparkF
7171derive instance functorElementF ∷ Functor ElementF
7272
7373_lunapark = SProxy ∷ SProxy "lunapark"
74−type LUNAPARK = R.FProxy LunaparkF
75−type LunaparkEffect r = ( lunapark ∷ LUNAPARK | r )
74+type LUNAPARK r = ( lunapark ∷ LunaparkF | r )
7675
77−liftLunapark ∷ ∀ a r. LunaparkF a → Run (LunaparkEffect r) a
76+liftLunapark ∷ ∀ a r. LunaparkF a → Run (LUNAPARK r) a
7877liftLunapark = R.lift _lunapark
7978
80−quit ∷ ∀ r. Run (LunaparkEffect r) Unit
79+quit ∷ ∀ r. Run (LUNAPARK r) Unit
8180quit = liftLunapark $ Quit unit
8281
83−status ∷ ∀ r. Run (LunaparkEffect r) LT.ServerStatus
82+status ∷ ∀ r. Run (LUNAPARK r) LT.ServerStatus
8483status = liftLunapark $ Status identity
8584
86−setTimeouts ∷ ∀ r. LT.Timeouts → Run (LunaparkEffect r) Unit
85+setTimeouts ∷ ∀ r. LT.Timeouts → Run (LUNAPARK r) Unit
8786setTimeouts ts = liftLunapark $ SetTimeouts ts unit
8887
89−getTimeouts ∷ ∀ r. Run (LunaparkEffect r) LT.Timeouts
88+getTimeouts ∷ ∀ r. Run (LUNAPARK r) LT.Timeouts
9089getTimeouts = liftLunapark $ GetTimeouts identity
9190
92−go ∷ ∀ r. String → Run (LunaparkEffect r) Unit
91+go ∷ ∀ r. String → Run (LUNAPARK r) Unit
9392go uri = liftLunapark $ GoTo uri unit
9493
95−getUrl ∷ ∀ r. Run (LunaparkEffect r) String
94+getUrl ∷ ∀ r. Run (LUNAPARK r) String
9695getUrl = liftLunapark $ GetUrl identity
9796
98−forward ∷ ∀ r. Run (LunaparkEffect r) Unit
97+forward ∷ ∀ r. Run (LUNAPARK r) Unit
9998forward = liftLunapark $ Forward unit
10099
101−back ∷ ∀ r. Run (LunaparkEffect r) Unit
100+back ∷ ∀ r. Run (LUNAPARK r) Unit
102101back = liftLunapark $ Back unit
103102
104−refresh ∷ ∀ r. Run (LunaparkEffect r) Unit
103+refresh ∷ ∀ r. Run (LUNAPARK r) Unit
105104refresh = liftLunapark $ Refresh unit
106105
107−getTitle ∷ ∀ r. Run (LunaparkEffect r) String
106+getTitle ∷ ∀ r. Run (LUNAPARK r) String
108107getTitle = liftLunapark $ GetTitle identity
109108
110−getWindowHandle ∷ ∀ r. Run (LunaparkEffect r) LT.WindowHandle
109+getWindowHandle ∷ ∀ r. Run (LUNAPARK r) LT.WindowHandle
111110getWindowHandle = liftLunapark $ GetWindowHandle identity
112111
113−getWindowHandles ∷ ∀ r. Run (LunaparkEffect r) (Array LT.WindowHandle)
112+getWindowHandles ∷ ∀ r. Run (LUNAPARK r) (Array LT.WindowHandle)
114113getWindowHandles = liftLunapark $ GetWindowHandles identity
115114
116−closeWindow ∷ ∀ r. Run (LunaparkEffect r) Unit
115+closeWindow ∷ ∀ r. Run (LUNAPARK r) Unit
117116closeWindow = liftLunapark $ CloseWindow unit
118117
119−switchToWindow ∷ ∀ r. LT.WindowHandle → Run (LunaparkEffect r) Unit
118+switchToWindow ∷ ∀ r. LT.WindowHandle → Run (LUNAPARK r) Unit
120119switchToWindow w = liftLunapark $ SwitchToWindow w unit
121120
122−switchToFrame ∷ ∀ r. LT.FrameId → Run (LunaparkEffect r) Unit
121+switchToFrame ∷ ∀ r. LT.FrameId → Run (LUNAPARK r) Unit
123122switchToFrame f = liftLunapark $ SwitchToFrame f unit
124123
125−switchToParentFrame ∷ ∀ r. Run (LunaparkEffect r) Unit
124+switchToParentFrame ∷ ∀ r. Run (LUNAPARK r) Unit
126125switchToParentFrame = liftLunapark $ SwitchToParentFrame unit
127126
128−getWindowRectangle ∷ ∀ r. Run (LunaparkEffect r) LT.Rectangle
127+getWindowRectangle ∷ ∀ r. Run (LUNAPARK r) LT.Rectangle
129128getWindowRectangle = liftLunapark $ GetWindowRectangle identity
130129
131−setWindowRectangle ∷ ∀ r. LT.Rectangle → Run (LunaparkEffect r) Unit
130+setWindowRectangle ∷ ∀ r. LT.Rectangle → Run (LUNAPARK r) Unit
132131setWindowRectangle r = liftLunapark $ SetWindowRectangle r unit
133132
134−maximizeWindow ∷ ∀ r. Run (LunaparkEffect r) Unit
133+maximizeWindow ∷ ∀ r. Run (LUNAPARK r) Unit
135134maximizeWindow = liftLunapark $ MaximizeWindow unit
136135
137−minimizeWindow ∷ ∀ r. Run (LunaparkEffect r) Unit
136+minimizeWindow ∷ ∀ r. Run (LUNAPARK r) Unit
138137minimizeWindow = liftLunapark $ MinimizeWindow unit
139138
140−fullscreenWindow ∷ ∀ r. Run (LunaparkEffect r) Unit
139+fullscreenWindow ∷ ∀ r. Run (LUNAPARK r) Unit
141140fullscreenWindow = liftLunapark $ FullscreenWindow unit
142141
143−executeScript ∷ ∀ r. LT.Script → Run (LunaparkEffect r) J.Json
142+executeScript ∷ ∀ r. LT.Script → Run (LUNAPARK r) J.Json
144143executeScript script = liftLunapark $ ExecuteScript script identity
145144
146−executeScriptAsync ∷ ∀ r. LT.Script → Run (LunaparkEffect r) J.Json
145+executeScriptAsync ∷ ∀ r. LT.Script → Run (LUNAPARK r) J.Json
147146executeScriptAsync script = liftLunapark $ ExecuteScriptAsync script identity
148147
149−getAllCookies ∷ ∀ r. Run (LunaparkEffect r) (Array LT.Cookie)
148+getAllCookies ∷ ∀ r. Run (LUNAPARK r) (Array LT.Cookie)
150149getAllCookies = liftLunapark $ GetAllCookies identity
151150
152−getCookie ∷ ∀ r. String → Run (LunaparkEffect r) LT.Cookie
151+getCookie ∷ ∀ r. String → Run (LUNAPARK r) LT.Cookie
153152getCookie name = liftLunapark $ GetCookie name identity
154153
155−addCookie ∷ ∀ r. LT.Cookie → Run (LunaparkEffect r) Unit
154+addCookie ∷ ∀ r. LT.Cookie → Run (LUNAPARK r) Unit
156155addCookie cookie = liftLunapark $ AddCookie cookie unit
157156
158−deleteCookie ∷ ∀ r. String → Run (LunaparkEffect r) Unit
157+deleteCookie ∷ ∀ r. String → Run (LUNAPARK r) Unit
159158deleteCookie name = liftLunapark $ DeleteCookie name unit
160159
161−deleteAllCookies ∷ ∀ r. Run (LunaparkEffect r) Unit
160+deleteAllCookies ∷ ∀ r. Run (LUNAPARK r) Unit
162161deleteAllCookies = liftLunapark $ DeleteAllCookies unit
163162
164−dismissAlert ∷ ∀ r. Run (LunaparkEffect r) Unit
163+dismissAlert ∷ ∀ r. Run (LUNAPARK r) Unit
165164dismissAlert = liftLunapark $ DismissAlert unit
166165
167−acceptAlert ∷ ∀ r. Run (LunaparkEffect r) Unit
166+acceptAlert ∷ ∀ r. Run (LUNAPARK r) Unit
168167acceptAlert = liftLunapark $ AcceptAlert unit
169168
170−getAlertText ∷ ∀ r. Run (LunaparkEffect r) String
169+getAlertText ∷ ∀ r. Run (LUNAPARK r) String
171170getAlertText = liftLunapark $ GetAlertText identity
172171
173−sendAlertText ∷ ∀ r. String → Run (LunaparkEffect r) Unit
172+sendAlertText ∷ ∀ r. String → Run (LUNAPARK r) Unit
174173sendAlertText txt = liftLunapark $ SendAlertText txt unit
175174
176−screenshot ∷ ∀ r. String → Run (LunaparkEffect r) Unit
175+screenshot ∷ ∀ r. String → Run (LUNAPARK r) Unit
177176screenshot fp = liftLunapark $ Screenshot fp unit
178177
179−elementScreenshot ∷ ∀ r. LT.Element → String → Run (LunaparkEffect r) Unit
178+elementScreenshot ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) Unit
180179elementScreenshot el fp = liftLunapark $ OnElement el $ ScreenshotEl fp unit
181180
182−findElement ∷ ∀ r. LT.Locator → Run (LunaparkEffect r) LT.Element
181+findElement ∷ ∀ r. LT.Locator → Run (LUNAPARK r) LT.Element
183182findElement l = liftLunapark $ FindElement l identity
184183
185−findElements ∷ ∀ r. LT.Locator → Run (LunaparkEffect r) (Array LT.Element)
184+findElements ∷ ∀ r. LT.Locator → Run (LUNAPARK r) (Array LT.Element)
186185findElements l = liftLunapark $ FindElements l identity
187186
188−childElement ∷ ∀ r. LT.Element → LT.Locator → Run (LunaparkEffect r) LT.Element
187+childElement ∷ ∀ r. LT.Element → LT.Locator → Run (LUNAPARK r) LT.Element
189188childElement el l = liftLunapark $ OnElement el $ ChildElement l identity
190189
191−childElements ∷ ∀ r. LT.Element → LT.Locator → Run (LunaparkEffect r) (Array LT.Element)
190+childElements ∷ ∀ r. LT.Element → LT.Locator → Run (LUNAPARK r) (Array LT.Element)
192191childElements el l = liftLunapark $ OnElement el $ ChildElements l identity
193192
194−isSelected ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Boolean
193+isSelected ∷ ∀ r. LT.Element → Run (LUNAPARK r) Boolean
195194isSelected el = liftLunapark $ OnElement el $ IsSelected identity
196195
197−getAttribute ∷ ∀ r. LT.Element → String → Run (LunaparkEffect r) String
196+getAttribute ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) String
198197getAttribute el name = liftLunapark $ OnElement el $ GetAttribute name identity
199198
200−getProperty ∷ ∀ r. LT.Element → String → Run (LunaparkEffect r) J.Json
199+getProperty ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) J.Json
201200getProperty el name = liftLunapark $ OnElement el $ GetProperty name identity
202201
203−getCss ∷ ∀ r. LT.Element → String → Run (LunaparkEffect r) String
202+getCss ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) String
204203getCss el name = liftLunapark $ OnElement el $ GetCss name identity
205204
206−getText ∷ ∀ r. LT.Element → Run (LunaparkEffect r) String
205+getText ∷ ∀ r. LT.Element → Run (LUNAPARK r) String
207206getText el = liftLunapark $ OnElement el $ GetText identity
208207
209−getTagName ∷ ∀ r. LT.Element → Run (LunaparkEffect r) String
208+getTagName ∷ ∀ r. LT.Element → Run (LUNAPARK r) String
210209getTagName el = liftLunapark $ OnElement el $ GetTagName identity
211210
212−getRectangle ∷ ∀ r. LT.Element → Run (LunaparkEffect r) LT.Rectangle
211+getRectangle ∷ ∀ r. LT.Element → Run (LUNAPARK r) LT.Rectangle
213212getRectangle el = liftLunapark $ OnElement el $ GetRectangle identity
214213
215−isEnabled ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Boolean
214+isEnabled ∷ ∀ r. LT.Element → Run (LUNAPARK r) Boolean
216215isEnabled el = liftLunapark $ OnElement el $ IsEnabled identity
217216
218−clickElement ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Unit
217+clickElement ∷ ∀ r. LT.Element → Run (LUNAPARK r) Unit
219218clickElement el = liftLunapark $ OnElement el $ ClickEl unit
220219
221−clearElement ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Unit
220+clearElement ∷ ∀ r. LT.Element → Run (LUNAPARK r) Unit
222221clearElement el = liftLunapark $ OnElement el $ ClearEl unit
223222
224−sendKeysElement ∷ ∀ r. LT.Element → String → Run (LunaparkEffect r) Unit
223+sendKeysElement ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) Unit
225224sendKeysElement el txt = liftLunapark $ OnElement el $ SendKeysEl txt unit
226225
227−isDisplayed ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Boolean
226+isDisplayed ∷ ∀ r. LT.Element → Run (LUNAPARK r) Boolean
228227isDisplayed el = liftLunapark $ OnElement el $ IsDisplayed identity
229228
230−submitElement ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Unit
229+submitElement ∷ ∀ r. LT.Element → Run (LUNAPARK r) Unit
231230submitElement el = liftLunapark $ OnElement el $ Submit unit
232231
233−performActions ∷ ∀ r. LT.ActionRequest → Run (LunaparkEffect r) Unit
232+performActions ∷ ∀ r. LT.ActionRequest → Run (LUNAPARK r) Unit
234233performActions req = liftLunapark $ PerformActions req unit
235234
236−releaseActions ∷ ∀ r. Run (LunaparkEffect r) Unit
235+releaseActions ∷ ∀ r. Run (LUNAPARK r) Unit
237236releaseActions = liftLunapark $ ReleaseActions unit
src/Lunapark/Utils.purs+6−5
@@ -9,12 +9,13 @@ import Effect.Aff (Aff)
99import Lunapark.Error as LE
1010import Run as R
1111import Run.Except as RE
12+import Type.Row (type (+))
1213import Unsafe.Coerce (unsafeCoerce)
1314
1415liftAndRethrow
1516 ∷ ∀ r ε ω
1617 . Aff (Either ε ω)
17− → R.Run (aff ∷ R.AFF, except ∷ RE.EXCEPT ε|r) ω
18+ → R.Run (R.AFF + RE.EXCEPT ε + r) ω
1819liftAndRethrow a = do
1920 res ← R.liftAff a
2021 RE.rethrow res
@@ -22,14 +23,14 @@ liftAndRethrow a = do
2223rethrowAsJsonDecodeError
2324 ∷ ∀ r
2425 . Either J.JsonDecodeError
25− ~> R.Run (except ∷ RE.EXCEPT LE.Error|r)
26+ ~> R.Run (RE.EXCEPT LE.Error + r)
2627rethrowAsJsonDecodeError =
2728 RE.rethrow <<< lmap LE.JsonDecodeError
2829
2930-- Safe, since we actually want handler and result have same rows not, remove except
3031catch
3132 ∷ ∀ e r a
32− . R.Run (except ∷ RE.EXCEPT e|r) a
33− → (e → R.Run (except ∷ RE.EXCEPT e|r) a)
34− → R.Run (except ∷ RE.EXCEPT e|r) a
33+ . R.Run (RE.EXCEPT e + r) a
34+ → (e → R.Run (RE.EXCEPT e + r) a)
35+ → R.Run (RE.EXCEPT e + r) a
3536catch = unsafeCoerce $ flip RE.catch