git.iko.soy/rowtype-yoga/purescript-lunapark
on main help sign in
Merge pull request #20 from slamdata/ps-0.14
48d85ffGary Burgess
.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 @@
1/.*
1/.*
2!/.gitignore
2!/.gitignore
3−!/.travis.yml
3+!/.github
4/bower_components/
4/bower_components/
5/node_modules/
5/node_modules/
6/output/
6/output/
7−/example/dist/test.js
8package-lock.json
7package-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 @@
1# purescript-lunapark
1# purescript-lunapark
2
2
3[![Latest release](http://img.shields.io/github/release/slamdata/purescript-lunapark.svg)](https://github.com/slamdata/purescript-lunapark/releases)
3[![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)
5
5
6## Disclaimer
6## Disclaimer
7
7
bower.json+6−6
@@ -25,11 +25,11 @@
25 "vendor"
25 "vendor"
26 ],
26 ],
27 "dependencies": {
27 "dependencies": {
28− "purescript-affjax": "^11.0.0",
28+ "purescript-affjax": "^12.0.0",
29− "purescript-argonaut-codecs": "^7.0.0",
29+ "purescript-argonaut-codecs": "^8.1.0",
30− "purescript-argonaut-core": "^5.0.0",
30+ "purescript-argonaut-core": "^6.0.0",
31− "purescript-css": "^4.0.0",
31+ "purescript-css": "^5.0.1",
32− "purescript-node-fs-aff": "^6.0.0",
32+ "purescript-node-fs-aff": "^7.0.0",
33− "purescript-run": "^3.0.0"
33+ "purescript-run": "^4.0.0"
34 }
34 }
35}
35}
package.json+3−7
@@ -2,16 +2,12 @@
2 "name": "purescript-lunapark",
2 "name": "purescript-lunapark",
3 "private": true,
3 "private": true,
4 "scripts": {
4 "scripts": {
5− "build": "spago build --purs-args '--censor-lib --strict'",
5+ "build": "pulp build -- --censor-lib --strict"
6− "build:non-strict": "spago build",
7− "ide": "purs ide server"
8 },
6 },
9 "license": "Apache-2.0",
7 "license": "Apache-2.0",
10 "dependencies": {
8 "dependencies": {
11− "chromedriver": "^86.0.0",
12 "pulp": "^15.0.0",
9 "pulp": "^15.0.0",
13− "purescript": "^0.13.8",
10+ "purescript": "^0.14.2",
14− "purescript-psa": "^0.8.0",
11+ "purescript-psa": "^0.8.2"
15− "xhr2": "^0.2.0"
16 }
12 }
17}
13}
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
8 ) where
8 ) where
9
9
10
10
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)
12import Lunapark.Error (Error(..), CachingError(..), printError)
12import 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)
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(..), 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)
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)
15import Lunapark.WebDriverError (WebDriverError, WebDriverErrorType(..), fromJson, fromStringCode, toStringCode)
15import Lunapark.WebDriverError (WebDriverError, WebDriverErrorType(..), fromJson, fromStringCode, toStringCode)
16import 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)
16import 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)
22import Effect.Class (liftEffect)
22import Effect.Class (liftEffect)
23import Effect.Ref as Ref
23import Effect.Ref as Ref
24import Foreign.Object as FO
24import Foreign.Object as FO
25−import Lunapark.ActionF (_lunaparkActions, ActionF(..), TouchF(..), ActionsEffect)
25+import Lunapark.ActionF (_lunaparkActions, ActionF(..), TouchF(..), LUNAPARK_ACTIONS)
26import Lunapark.Endpoint as LP
26import Lunapark.Endpoint as LP
27import Lunapark.Error as LE
27import Lunapark.Error as LE
28−import Lunapark.LunaparkF (_lunapark, ElementF(..), LunaparkF(..), LunaparkEffect, performActions, findElement)
28+import Lunapark.LunaparkF (_lunapark, ElementF(..), LunaparkF(..), LUNAPARK, performActions, findElement)
29import Lunapark.Types as LT
29import Lunapark.Types as LT
30import Lunapark.Utils (liftAndRethrow, rethrowAsJsonDecodeError, catch)
30import Lunapark.Utils (liftAndRethrow, rethrowAsJsonDecodeError, catch)
31import Node.Buffer as B
31import Node.Buffer as B
@@ -36,11 +36,11 @@ import Run.Except (EXCEPT)
36import Type.Row (type (+))
36import Type.Row (type (+))
37import Run.Except as RE
37import Run.Except as RE
38
38
39−type Lunapark r a = Run (BaseEffects + LunaparkEffect + ActionsEffect + r) a
39+type Lunapark r a = Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r) a
40
40
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))
42
42
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)
44runInterpreter (Interpreter f) = f
44runInterpreter (Interpreter f) = f
45
45
46init
46init
@@ -93,24 +93,20 @@ init uri caps = do
93interpret
93interpret
94 ∷ ∀ r
94 ∷ ∀ r
95 . HandleLunaparkInput
95 . HandleLunaparkInput
96− → Run (BaseEffects + LunaparkEffect + ActionsEffect + r )
96+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r )
97− ~> Run (BaseEffects r)
97+ ~> Run (BASE_EFFECTS r)
98interpret input = runLunapark input <<< runLunaparkActions input
98interpret input = runLunapark input <<< runLunaparkActions input
99
99
100−type BaseEffects r =
101− ( except ∷ EXCEPT LE.Error
100+type BASE_EFFECTS r = EXCEPT LE.Error + R.AFF + R.EFFECT + r
102− , aff ∷ R.AFF
103− , effect ∷ R.EFFECT
104− | r)
105
101
106−runLunapark ∷ ∀ r. HandleLunaparkInput → Run (BaseEffects + LunaparkEffect + r) ~> Run (BaseEffects r)
102+runLunapark ∷ ∀ r. HandleLunaparkInput → Run (BASE_EFFECTS + LUNAPARK + r) ~> Run (BASE_EFFECTS r)
107runLunapark input = do
103runLunapark input = do
108 R.interpretRec (R.on _lunapark (handleLunapark input) R.send)
104 R.interpretRec (R.on _lunapark (handleLunapark input) R.send)
109
105
110runLunaparkActions
106runLunaparkActions
111 ∷ ∀ r. HandleLunaparkInput
107 ∷ ∀ r. HandleLunaparkInput
112− → Run (BaseEffects + LunaparkEffect + ActionsEffect + r )
108+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r )
113− ~> Run (BaseEffects + LunaparkEffect + r)
109+ ~> Run (BASE_EFFECTS + LUNAPARK + r)
114runLunaparkActions input
110runLunaparkActions input
115 | input.actionsEnabled = interpretW3CActions Nil
111 | input.actionsEnabled = interpretW3CActions Nil
116 | otherwise = R.interpretRec (R.on _lunaparkActions (jsonWireActions input) R.send)
112 | otherwise = R.interpretRec (R.on _lunaparkActions (jsonWireActions input) R.send)
@@ -118,8 +114,8 @@ runLunaparkActions input
118interpretW3CActions
114interpretW3CActions
119 ∷ ∀ r
115 ∷ ∀ r
120 . List LT.ActionSequence
116 . List LT.ActionSequence
121− → Run (BaseEffects + LunaparkEffect + ActionsEffect + r )
117+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r )
122− ~> Run (BaseEffects + LunaparkEffect + r )
118+ ~> Run (BASE_EFFECTS + LUNAPARK + r )
123interpretW3CActions acc as = case R.peel as of
119interpretW3CActions acc as = case R.peel as of
124 Left la → case tag la of
120 Left la → case tag la of
125 Left a → w3cActions acc interpretW3CActions a
121 Left a → w3cActions acc interpretW3CActions a
@@ -135,11 +131,11 @@ w3cActions
135 ∷ ∀ r a
131 ∷ ∀ r a
136 . List LT.ActionSequence
132 . List LT.ActionSequence
137 → ( List LT.ActionSequence
133 → ( List LT.ActionSequence
138− → Run (BaseEffects + LunaparkEffect + ActionsEffect + r )
134+ → Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r )
139− ~> Run (BaseEffects + LunaparkEffect + r)
135+ ~> Run (BASE_EFFECTS + LUNAPARK + r)
140 )
136 )
141− → ActionF (Run (BaseEffects + LunaparkEffect + ActionsEffect + r ) a)
137+ → ActionF (Run (BASE_EFFECTS + LUNAPARK + LUNAPARK_ACTIONS + r ) a)
142− → Run (BaseEffects + LunaparkEffect + r) a
138+ → Run (BASE_EFFECTS + LUNAPARK + r) a
143w3cActions acc loop = case _ of
139w3cActions acc loop = case _ of
144 Click btn next →
140 Click btn next →
145 let seq = [ LT.pointerDown btn, LT.pointerUp btn ]
141 let seq = [ LT.pointerDown btn, LT.pointerUp btn ]
@@ -224,7 +220,7 @@ type HandleLunaparkInput =
224 , actionsEnabled ∷ Boolean
220 , actionsEnabled ∷ Boolean
225 }
221 }
226
222
227−jsonWireActions ∷ ∀ r. HandleLunaparkInput → ActionF ~> Run (BaseEffects + LunaparkEffect + r)
223+jsonWireActions ∷ ∀ r. HandleLunaparkInput → ActionF ~> Run (BASE_EFFECTS + LUNAPARK + r)
228jsonWireActions inp = case _ of
224jsonWireActions inp = case _ of
229 Click btn next → do
225 Click btn next → do
230 _ ← post (LP.Click : Nil) (LT.encodeButton btn)
226 _ ← post (LP.Click : Nil) (LT.encodeButton btn)
@@ -238,7 +234,7 @@ jsonWireActions inp = case _ of
238 DoubleClick btn next → do
234 DoubleClick btn next → do
239 _ ← case btn of
235 _ ← case btn of
240 LT.LeftBtn → post' (LP.DoubleClick : Nil)
236 LT.LeftBtn → post' (LP.DoubleClick : Nil)
241− other → do
237+ _ → do
242 _ ← post (LP.Click : Nil) (LT.encodeButton btn)
238 _ ← post (LP.Click : Nil) (LT.encodeButton btn)
243 post (LP.Click : Nil) (LT.encodeButton btn)
239 post (LP.Click : Nil) (LT.encodeButton btn)
244 pure next
240 pure next
@@ -295,7 +291,7 @@ jsonWireActions inp = case _ of
295 inSession ∷ LP.EndpointPart
291 inSession ∷ LP.EndpointPart
296 inSession = LP.InSession inp.session
292 inSession = LP.InSession inp.session
297
293
298−handleLunapark ∷ ∀ r. HandleLunaparkInput → LunaparkF ~> Run (BaseEffects r)
294+handleLunapark ∷ ∀ r. HandleLunaparkInput → LunaparkF ~> Run (BASE_EFFECTS r)
299handleLunapark inp = case _ of
295handleLunapark inp = case _ of
300 Quit next → do
296 Quit next → do
301 _ ← delete $ inSession : Nil
297 _ ← delete $ inSession : Nil
@@ -542,7 +538,7 @@ handleLunapark inp = case _ of
542
538
543 -- | It caches an index of an action that is valid for current webdriver implementation.
539 -- | It caches an index of an action that is valid for current webdriver implementation.
544 -- | So you don't need to search correct one by tring them each time
540 -- | 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
546 tryAndCache key actions = do
542 tryAndCache key actions = do
547 mp ← R.liftEffect $ Ref.read inp.requestMapRef
543 mp ← R.liftEffect $ Ref.read inp.requestMapRef
548 case Map.lookup key mp of
544 case Map.lookup key mp of
src/Lunapark/ActionF.purs+16−18
@@ -8,7 +8,6 @@ import Lunapark.Types as LT
8import Run (Run)
8import Run (Run)
9import Run as R
9import Run as R
10
10
11−
12data ActionF a
11data ActionF a
13 = Click LT.Button a
12 = Click LT.Button a
14 | ButtonDown LT.Button a
13 | ButtonDown LT.Button a
@@ -32,50 +31,49 @@ derive instance functorActionF ∷ Functor ActionF
32derive instance functorTouchF ∷ Functor TouchF
31derive instance functorTouchF ∷ Functor TouchF
33
32
34_lunaparkActions = SProxy ∷ SProxy "lunaparkActions"
33_lunaparkActions = SProxy ∷ SProxy "lunaparkActions"
35−type LUNAPARK_ACTIONS = R.FProxy ActionF
34+type LUNAPARK_ACTIONS r = ( lunaparkActions ∷ ActionF | r )
36−type ActionsEffect r = ( lunaparkActions ∷ LUNAPARK_ACTIONS | r )
37
35
38−liftAction ∷ ∀ r. ActionF Unit → Run (ActionsEffect r) Unit
36+liftAction ∷ ∀ r. ActionF Unit → Run (LUNAPARK_ACTIONS r) Unit
39liftAction = R.lift _lunaparkActions
37liftAction = R.lift _lunaparkActions
40
38
41−click ∷ ∀ r. LT.Button → Run (ActionsEffect r) Unit
39+click ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
42click btn = liftAction $ Click btn unit
40click btn = liftAction $ Click btn unit
43
41
44−buttonDown ∷ ∀ r. LT.Button → Run (ActionsEffect r) Unit
42+buttonDown ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
45buttonDown btn = liftAction $ ButtonDown btn unit
43buttonDown btn = liftAction $ ButtonDown btn unit
46
44
47−buttonUp ∷ ∀ r. LT.Button → Run (ActionsEffect r) Unit
45+buttonUp ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
48buttonUp btn = liftAction $ ButtonUp btn unit
46buttonUp btn = liftAction $ ButtonUp btn unit
49
47
50−doubleClick ∷ ∀ r. LT.Button → Run (ActionsEffect r) Unit
48+doubleClick ∷ ∀ r. LT.Button → Run (LUNAPARK_ACTIONS r) Unit
51doubleClick btn = liftAction $ DoubleClick btn unit
49doubleClick btn = liftAction $ DoubleClick btn unit
52
50
53−sendKeys ∷ ∀ r. String → Run (ActionsEffect r) Unit
51+sendKeys ∷ ∀ r. String → Run (LUNAPARK_ACTIONS r) Unit
54sendKeys txt = liftAction $ SendKeys txt unit
52sendKeys txt = liftAction $ SendKeys txt unit
55
53
56−moveTo ∷ ∀ r. LT.PointerMove → Run (ActionsEffect r) Unit
54+moveTo ∷ ∀ r. LT.PointerMove → Run (LUNAPARK_ACTIONS r) Unit
57moveTo move = liftAction $ MoveTo move unit
55moveTo move = liftAction $ MoveTo move unit
58
56
59−pause ∷ ∀ r. Milliseconds → Run (ActionsEffect r) Unit
57+pause ∷ ∀ r. Milliseconds → Run (LUNAPARK_ACTIONS r) Unit
60pause ms = liftAction $ Pause ms unit
58pause ms = liftAction $ Pause ms unit
61
59
62−tap ∷ ∀ r. Run (ActionsEffect r) Unit
60+tap ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
63tap = liftAction $ InTouch $ Tap unit
61tap = liftAction $ InTouch $ Tap unit
64
62
65−touchDown ∷ ∀ r. Run (ActionsEffect r) Unit
63+touchDown ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
66touchDown = liftAction $ InTouch $ TouchDown unit
64touchDown = liftAction $ InTouch $ TouchDown unit
67
65
68−touchUp ∷ ∀ r. Run (ActionsEffect r) Unit
66+touchUp ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
69touchUp = liftAction $ InTouch $ TouchUp unit
67touchUp = liftAction $ InTouch $ TouchUp unit
70
68
71−longTap ∷ ∀ r. Run (ActionsEffect r) Unit
69+longTap ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
72longTap = liftAction $ InTouch $ LongClick unit
70longTap = liftAction $ InTouch $ LongClick unit
73
71
74−flick ∷ ∀ r. LT.PointerMove → Run (ActionsEffect r) Unit
72+flick ∷ ∀ r. LT.PointerMove → Run (LUNAPARK_ACTIONS r) Unit
75flick move = liftAction $ InTouch $ Flick move unit
73flick move = liftAction $ InTouch $ Flick move unit
76
74
77−scroll ∷ ∀ r. LT.PointerMove → Run (ActionsEffect r) Unit
75+scroll ∷ ∀ r. LT.PointerMove → Run (LUNAPARK_ACTIONS r) Unit
78scroll move = liftAction $ InTouch $ Scroll move unit
76scroll move = liftAction $ InTouch $ Scroll move unit
79
77
80−doubleTap ∷ ∀ r. Run (ActionsEffect r) Unit
78+doubleTap ∷ ∀ r. Run (LUNAPARK_ACTIONS r) Unit
81doubleTap = liftAction $ InTouch $ DoubleTap unit
79doubleTap = liftAction $ InTouch $ DoubleTap unit
src/Lunapark/Endpoint.purs+1−1
@@ -184,7 +184,7 @@ handleAPIError (Right r) = case r.status of
184 StatusCode 200 → lmap LE.JsonDecodeError do
184 StatusCode 200 → lmap LE.JsonDecodeError do
185 obj ← J.decodeJson r.body
185 obj ← J.decodeJson r.body
186 obj J..: "value"
186 obj J..: "value"
187− code →
187+ _ →
188 Left $ either LE.JsonDecodeError LE.WebDriverError $ LWE.fromJson r.body
188 Left $ either LE.JsonDecodeError LE.WebDriverError $ LWE.fromJson r.body
189
189
190get ∷ String → Endpoint → Aff (Either LE.Error Json)
190get ∷ String → Endpoint → Aff (Either LE.Error Json)
src/Lunapark/LunaparkF.purs+55−56
@@ -71,167 +71,166 @@ derive instance functorLunaparkF ∷ Functor LunaparkF
71derive instance functorElementF ∷ Functor ElementF
71derive instance functorElementF ∷ Functor ElementF
72
72
73_lunapark = SProxy ∷ SProxy "lunapark"
73_lunapark = SProxy ∷ SProxy "lunapark"
74−type LUNAPARK = R.FProxy LunaparkF
74+type LUNAPARK r = ( lunapark ∷ LunaparkF | r )
75−type LunaparkEffect r = ( lunapark ∷ LUNAPARK | r )
76
75
77−liftLunapark ∷ ∀ a r. LunaparkF a → Run (LunaparkEffect r) a
76+liftLunapark ∷ ∀ a r. LunaparkF a → Run (LUNAPARK r) a
78liftLunapark = R.lift _lunapark
77liftLunapark = R.lift _lunapark
79
78
80−quit ∷ ∀ r. Run (LunaparkEffect r) Unit
79+quit ∷ ∀ r. Run (LUNAPARK r) Unit
81quit = liftLunapark $ Quit unit
80quit = liftLunapark $ Quit unit
82
81
83−status ∷ ∀ r. Run (LunaparkEffect r) LT.ServerStatus
82+status ∷ ∀ r. Run (LUNAPARK r) LT.ServerStatus
84status = liftLunapark $ Status identity
83status = liftLunapark $ Status identity
85
84
86−setTimeouts ∷ ∀ r. LT.Timeouts → Run (LunaparkEffect r) Unit
85+setTimeouts ∷ ∀ r. LT.Timeouts → Run (LUNAPARK r) Unit
87setTimeouts ts = liftLunapark $ SetTimeouts ts unit
86setTimeouts ts = liftLunapark $ SetTimeouts ts unit
88
87
89−getTimeouts ∷ ∀ r. Run (LunaparkEffect r) LT.Timeouts
88+getTimeouts ∷ ∀ r. Run (LUNAPARK r) LT.Timeouts
90getTimeouts = liftLunapark $ GetTimeouts identity
89getTimeouts = liftLunapark $ GetTimeouts identity
91
90
92−go ∷ ∀ r. String → Run (LunaparkEffect r) Unit
91+go ∷ ∀ r. String → Run (LUNAPARK r) Unit
93go uri = liftLunapark $ GoTo uri unit
92go uri = liftLunapark $ GoTo uri unit
94
93
95−getUrl ∷ ∀ r. Run (LunaparkEffect r) String
94+getUrl ∷ ∀ r. Run (LUNAPARK r) String
96getUrl = liftLunapark $ GetUrl identity
95getUrl = liftLunapark $ GetUrl identity
97
96
98−forward ∷ ∀ r. Run (LunaparkEffect r) Unit
97+forward ∷ ∀ r. Run (LUNAPARK r) Unit
99forward = liftLunapark $ Forward unit
98forward = liftLunapark $ Forward unit
100
99
101−back ∷ ∀ r. Run (LunaparkEffect r) Unit
100+back ∷ ∀ r. Run (LUNAPARK r) Unit
102back = liftLunapark $ Back unit
101back = liftLunapark $ Back unit
103
102
104−refresh ∷ ∀ r. Run (LunaparkEffect r) Unit
103+refresh ∷ ∀ r. Run (LUNAPARK r) Unit
105refresh = liftLunapark $ Refresh unit
104refresh = liftLunapark $ Refresh unit
106
105
107−getTitle ∷ ∀ r. Run (LunaparkEffect r) String
106+getTitle ∷ ∀ r. Run (LUNAPARK r) String
108getTitle = liftLunapark $ GetTitle identity
107getTitle = liftLunapark $ GetTitle identity
109
108
110−getWindowHandle ∷ ∀ r. Run (LunaparkEffect r) LT.WindowHandle
109+getWindowHandle ∷ ∀ r. Run (LUNAPARK r) LT.WindowHandle
111getWindowHandle = liftLunapark $ GetWindowHandle identity
110getWindowHandle = liftLunapark $ GetWindowHandle identity
112
111
113−getWindowHandles ∷ ∀ r. Run (LunaparkEffect r) (Array LT.WindowHandle)
112+getWindowHandles ∷ ∀ r. Run (LUNAPARK r) (Array LT.WindowHandle)
114getWindowHandles = liftLunapark $ GetWindowHandles identity
113getWindowHandles = liftLunapark $ GetWindowHandles identity
115
114
116−closeWindow ∷ ∀ r. Run (LunaparkEffect r) Unit
115+closeWindow ∷ ∀ r. Run (LUNAPARK r) Unit
117closeWindow = liftLunapark $ CloseWindow unit
116closeWindow = liftLunapark $ CloseWindow unit
118
117
119−switchToWindow ∷ ∀ r. LT.WindowHandle → Run (LunaparkEffect r) Unit
118+switchToWindow ∷ ∀ r. LT.WindowHandle → Run (LUNAPARK r) Unit
120switchToWindow w = liftLunapark $ SwitchToWindow w unit
119switchToWindow w = liftLunapark $ SwitchToWindow w unit
121
120
122−switchToFrame ∷ ∀ r. LT.FrameId → Run (LunaparkEffect r) Unit
121+switchToFrame ∷ ∀ r. LT.FrameId → Run (LUNAPARK r) Unit
123switchToFrame f = liftLunapark $ SwitchToFrame f unit
122switchToFrame f = liftLunapark $ SwitchToFrame f unit
124
123
125−switchToParentFrame ∷ ∀ r. Run (LunaparkEffect r) Unit
124+switchToParentFrame ∷ ∀ r. Run (LUNAPARK r) Unit
126switchToParentFrame = liftLunapark $ SwitchToParentFrame unit
125switchToParentFrame = liftLunapark $ SwitchToParentFrame unit
127
126
128−getWindowRectangle ∷ ∀ r. Run (LunaparkEffect r) LT.Rectangle
127+getWindowRectangle ∷ ∀ r. Run (LUNAPARK r) LT.Rectangle
129getWindowRectangle = liftLunapark $ GetWindowRectangle identity
128getWindowRectangle = liftLunapark $ GetWindowRectangle identity
130
129
131−setWindowRectangle ∷ ∀ r. LT.Rectangle → Run (LunaparkEffect r) Unit
130+setWindowRectangle ∷ ∀ r. LT.Rectangle → Run (LUNAPARK r) Unit
132setWindowRectangle r = liftLunapark $ SetWindowRectangle r unit
131setWindowRectangle r = liftLunapark $ SetWindowRectangle r unit
133
132
134−maximizeWindow ∷ ∀ r. Run (LunaparkEffect r) Unit
133+maximizeWindow ∷ ∀ r. Run (LUNAPARK r) Unit
135maximizeWindow = liftLunapark $ MaximizeWindow unit
134maximizeWindow = liftLunapark $ MaximizeWindow unit
136
135
137−minimizeWindow ∷ ∀ r. Run (LunaparkEffect r) Unit
136+minimizeWindow ∷ ∀ r. Run (LUNAPARK r) Unit
138minimizeWindow = liftLunapark $ MinimizeWindow unit
137minimizeWindow = liftLunapark $ MinimizeWindow unit
139
138
140−fullscreenWindow ∷ ∀ r. Run (LunaparkEffect r) Unit
139+fullscreenWindow ∷ ∀ r. Run (LUNAPARK r) Unit
141fullscreenWindow = liftLunapark $ FullscreenWindow unit
140fullscreenWindow = liftLunapark $ FullscreenWindow unit
142
141
143−executeScript ∷ ∀ r. LT.Script → Run (LunaparkEffect r) J.Json
142+executeScript ∷ ∀ r. LT.Script → Run (LUNAPARK r) J.Json
144executeScript script = liftLunapark $ ExecuteScript script identity
143executeScript script = liftLunapark $ ExecuteScript script identity
145
144
146−executeScriptAsync ∷ ∀ r. LT.Script → Run (LunaparkEffect r) J.Json
145+executeScriptAsync ∷ ∀ r. LT.Script → Run (LUNAPARK r) J.Json
147executeScriptAsync script = liftLunapark $ ExecuteScriptAsync script identity
146executeScriptAsync script = liftLunapark $ ExecuteScriptAsync script identity
148
147
149−getAllCookies ∷ ∀ r. Run (LunaparkEffect r) (Array LT.Cookie)
148+getAllCookies ∷ ∀ r. Run (LUNAPARK r) (Array LT.Cookie)
150getAllCookies = liftLunapark $ GetAllCookies identity
149getAllCookies = liftLunapark $ GetAllCookies identity
151
150
152−getCookie ∷ ∀ r. String → Run (LunaparkEffect r) LT.Cookie
151+getCookie ∷ ∀ r. String → Run (LUNAPARK r) LT.Cookie
153getCookie name = liftLunapark $ GetCookie name identity
152getCookie name = liftLunapark $ GetCookie name identity
154
153
155−addCookie ∷ ∀ r. LT.Cookie → Run (LunaparkEffect r) Unit
154+addCookie ∷ ∀ r. LT.Cookie → Run (LUNAPARK r) Unit
156addCookie cookie = liftLunapark $ AddCookie cookie unit
155addCookie cookie = liftLunapark $ AddCookie cookie unit
157
156
158−deleteCookie ∷ ∀ r. String → Run (LunaparkEffect r) Unit
157+deleteCookie ∷ ∀ r. String → Run (LUNAPARK r) Unit
159deleteCookie name = liftLunapark $ DeleteCookie name unit
158deleteCookie name = liftLunapark $ DeleteCookie name unit
160
159
161−deleteAllCookies ∷ ∀ r. Run (LunaparkEffect r) Unit
160+deleteAllCookies ∷ ∀ r. Run (LUNAPARK r) Unit
162deleteAllCookies = liftLunapark $ DeleteAllCookies unit
161deleteAllCookies = liftLunapark $ DeleteAllCookies unit
163
162
164−dismissAlert ∷ ∀ r. Run (LunaparkEffect r) Unit
163+dismissAlert ∷ ∀ r. Run (LUNAPARK r) Unit
165dismissAlert = liftLunapark $ DismissAlert unit
164dismissAlert = liftLunapark $ DismissAlert unit
166
165
167−acceptAlert ∷ ∀ r. Run (LunaparkEffect r) Unit
166+acceptAlert ∷ ∀ r. Run (LUNAPARK r) Unit
168acceptAlert = liftLunapark $ AcceptAlert unit
167acceptAlert = liftLunapark $ AcceptAlert unit
169
168
170−getAlertText ∷ ∀ r. Run (LunaparkEffect r) String
169+getAlertText ∷ ∀ r. Run (LUNAPARK r) String
171getAlertText = liftLunapark $ GetAlertText identity
170getAlertText = liftLunapark $ GetAlertText identity
172
171
173−sendAlertText ∷ ∀ r. String → Run (LunaparkEffect r) Unit
172+sendAlertText ∷ ∀ r. String → Run (LUNAPARK r) Unit
174sendAlertText txt = liftLunapark $ SendAlertText txt unit
173sendAlertText txt = liftLunapark $ SendAlertText txt unit
175
174
176−screenshot ∷ ∀ r. String → Run (LunaparkEffect r) Unit
175+screenshot ∷ ∀ r. String → Run (LUNAPARK r) Unit
177screenshot fp = liftLunapark $ Screenshot fp unit
176screenshot fp = liftLunapark $ Screenshot fp unit
178
177
179−elementScreenshot ∷ ∀ r. LT.Element → String → Run (LunaparkEffect r) Unit
178+elementScreenshot ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) Unit
180elementScreenshot el fp = liftLunapark $ OnElement el $ ScreenshotEl fp unit
179elementScreenshot el fp = liftLunapark $ OnElement el $ ScreenshotEl fp unit
181
180
182−findElement ∷ ∀ r. LT.Locator → Run (LunaparkEffect r) LT.Element
181+findElement ∷ ∀ r. LT.Locator → Run (LUNAPARK r) LT.Element
183findElement l = liftLunapark $ FindElement l identity
182findElement l = liftLunapark $ FindElement l identity
184
183
185−findElements ∷ ∀ r. LT.Locator → Run (LunaparkEffect r) (Array LT.Element)
184+findElements ∷ ∀ r. LT.Locator → Run (LUNAPARK r) (Array LT.Element)
186findElements l = liftLunapark $ FindElements l identity
185findElements l = liftLunapark $ FindElements l identity
187
186
188−childElement ∷ ∀ r. LT.Element → LT.Locator → Run (LunaparkEffect r) LT.Element
187+childElement ∷ ∀ r. LT.Element → LT.Locator → Run (LUNAPARK r) LT.Element
189childElement el l = liftLunapark $ OnElement el $ ChildElement l identity
188childElement el l = liftLunapark $ OnElement el $ ChildElement l identity
190
189
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)
192childElements el l = liftLunapark $ OnElement el $ ChildElements l identity
191childElements el l = liftLunapark $ OnElement el $ ChildElements l identity
193
192
194−isSelected ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Boolean
193+isSelected ∷ ∀ r. LT.Element → Run (LUNAPARK r) Boolean
195isSelected el = liftLunapark $ OnElement el $ IsSelected identity
194isSelected el = liftLunapark $ OnElement el $ IsSelected identity
196
195
197−getAttribute ∷ ∀ r. LT.Element → String → Run (LunaparkEffect r) String
196+getAttribute ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) String
198getAttribute el name = liftLunapark $ OnElement el $ GetAttribute name identity
197getAttribute el name = liftLunapark $ OnElement el $ GetAttribute name identity
199
198
200−getProperty ∷ ∀ r. LT.Element → String → Run (LunaparkEffect r) J.Json
199+getProperty ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) J.Json
201getProperty el name = liftLunapark $ OnElement el $ GetProperty name identity
200getProperty el name = liftLunapark $ OnElement el $ GetProperty name identity
202
201
203−getCss ∷ ∀ r. LT.Element → String → Run (LunaparkEffect r) String
202+getCss ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) String
204getCss el name = liftLunapark $ OnElement el $ GetCss name identity
203getCss el name = liftLunapark $ OnElement el $ GetCss name identity
205
204
206−getText ∷ ∀ r. LT.Element → Run (LunaparkEffect r) String
205+getText ∷ ∀ r. LT.Element → Run (LUNAPARK r) String
207getText el = liftLunapark $ OnElement el $ GetText identity
206getText el = liftLunapark $ OnElement el $ GetText identity
208
207
209−getTagName ∷ ∀ r. LT.Element → Run (LunaparkEffect r) String
208+getTagName ∷ ∀ r. LT.Element → Run (LUNAPARK r) String
210getTagName el = liftLunapark $ OnElement el $ GetTagName identity
209getTagName el = liftLunapark $ OnElement el $ GetTagName identity
211
210
212−getRectangle ∷ ∀ r. LT.Element → Run (LunaparkEffect r) LT.Rectangle
211+getRectangle ∷ ∀ r. LT.Element → Run (LUNAPARK r) LT.Rectangle
213getRectangle el = liftLunapark $ OnElement el $ GetRectangle identity
212getRectangle el = liftLunapark $ OnElement el $ GetRectangle identity
214
213
215−isEnabled ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Boolean
214+isEnabled ∷ ∀ r. LT.Element → Run (LUNAPARK r) Boolean
216isEnabled el = liftLunapark $ OnElement el $ IsEnabled identity
215isEnabled el = liftLunapark $ OnElement el $ IsEnabled identity
217
216
218−clickElement ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Unit
217+clickElement ∷ ∀ r. LT.Element → Run (LUNAPARK r) Unit
219clickElement el = liftLunapark $ OnElement el $ ClickEl unit
218clickElement el = liftLunapark $ OnElement el $ ClickEl unit
220
219
221−clearElement ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Unit
220+clearElement ∷ ∀ r. LT.Element → Run (LUNAPARK r) Unit
222clearElement el = liftLunapark $ OnElement el $ ClearEl unit
221clearElement el = liftLunapark $ OnElement el $ ClearEl unit
223
222
224−sendKeysElement ∷ ∀ r. LT.Element → String → Run (LunaparkEffect r) Unit
223+sendKeysElement ∷ ∀ r. LT.Element → String → Run (LUNAPARK r) Unit
225sendKeysElement el txt = liftLunapark $ OnElement el $ SendKeysEl txt unit
224sendKeysElement el txt = liftLunapark $ OnElement el $ SendKeysEl txt unit
226
225
227−isDisplayed ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Boolean
226+isDisplayed ∷ ∀ r. LT.Element → Run (LUNAPARK r) Boolean
228isDisplayed el = liftLunapark $ OnElement el $ IsDisplayed identity
227isDisplayed el = liftLunapark $ OnElement el $ IsDisplayed identity
229
228
230−submitElement ∷ ∀ r. LT.Element → Run (LunaparkEffect r) Unit
229+submitElement ∷ ∀ r. LT.Element → Run (LUNAPARK r) Unit
231submitElement el = liftLunapark $ OnElement el $ Submit unit
230submitElement el = liftLunapark $ OnElement el $ Submit unit
232
231
233−performActions ∷ ∀ r. LT.ActionRequest → Run (LunaparkEffect r) Unit
232+performActions ∷ ∀ r. LT.ActionRequest → Run (LUNAPARK r) Unit
234performActions req = liftLunapark $ PerformActions req unit
233performActions req = liftLunapark $ PerformActions req unit
235
234
236−releaseActions ∷ ∀ r. Run (LunaparkEffect r) Unit
235+releaseActions ∷ ∀ r. Run (LUNAPARK r) Unit
237releaseActions = liftLunapark $ ReleaseActions unit
236releaseActions = liftLunapark $ ReleaseActions unit
src/Lunapark/Utils.purs+6−5
@@ -9,12 +9,13 @@ import Effect.Aff (Aff)
9import Lunapark.Error as LE
9import Lunapark.Error as LE
10import Run as R
10import Run as R
11import Run.Except as RE
11import Run.Except as RE
12+import Type.Row (type (+))
12import Unsafe.Coerce (unsafeCoerce)
13import Unsafe.Coerce (unsafeCoerce)
13
14
14liftAndRethrow
15liftAndRethrow
15 ∷ ∀ r ε ω
16 ∷ ∀ r ε ω
16 . Aff (Either ε ω)
17 . Aff (Either ε ω)
17− → R.Run (aff ∷ R.AFF, except ∷ RE.EXCEPT ε|r) ω
18+ → R.Run (R.AFF + RE.EXCEPT ε + r) ω
18liftAndRethrow a = do
19liftAndRethrow a = do
19 res ← R.liftAff a
20 res ← R.liftAff a
20 RE.rethrow res
21 RE.rethrow res
@@ -22,14 +23,14 @@ liftAndRethrow a = do
22rethrowAsJsonDecodeError
23rethrowAsJsonDecodeError
23 ∷ ∀ r
24 ∷ ∀ r
24 . Either J.JsonDecodeError
25 . Either J.JsonDecodeError
25− ~> R.Run (except ∷ RE.EXCEPT LE.Error|r)
26+ ~> R.Run (RE.EXCEPT LE.Error + r)
26rethrowAsJsonDecodeError =
27rethrowAsJsonDecodeError =
27 RE.rethrow <<< lmap LE.JsonDecodeError
28 RE.rethrow <<< lmap LE.JsonDecodeError
28
29
29-- Safe, since we actually want handler and result have same rows not, remove except
30-- Safe, since we actually want handler and result have same rows not, remove except
30catch
31catch
31 ∷ ∀ e r a
32 ∷ ∀ e r a
32− . R.Run (except ∷ RE.EXCEPT e|r) a
33+ . R.Run (RE.EXCEPT e + r) a
33− → (e → R.Run (except ∷ RE.EXCEPT e|r) a)
34+ → (e → R.Run (RE.EXCEPT e + r) a)
34− → R.Run (except ∷ RE.EXCEPT e|r) a
35+ → R.Run (RE.EXCEPT e + r) a
35catch = unsafeCoerce $ flip RE.catch
36catch = unsafeCoerce $ flip RE.catch