Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 48d85ff

Browse files
authored
Merge pull request #20 from slamdata/ps-0.14
Update for GH actions, PS 0.14
2 parents 1c79bb5 + 0de0edd commit 48d85ff

File tree

14 files changed

+144
-158
lines changed

14 files changed

+144
-158
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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
87
package-lock.json

.travis.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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.dhall

Lines changed: 0 additions & 4 deletions
This file was deleted.

spago.dhall

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/Lunapark.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
1212
import 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)
1515
import Lunapark.WebDriverError (WebDriverError, WebDriverErrorType(..), fromJson, fromStringCode, toStringCode)
1616
import 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

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import Effect.Aff.Class (class MonadAff, liftAff)
2222
import Effect.Class (liftEffect)
2323
import Effect.Ref as Ref
2424
import Foreign.Object as FO
25-
import Lunapark.ActionF (_lunaparkActions, ActionF(..), TouchF(..), ActionsEffect)
25+
import Lunapark.ActionF (_lunaparkActions, ActionF(..), TouchF(..), LUNAPARK_ACTIONS)
2626
import Lunapark.Endpoint as LP
2727
import Lunapark.Error as LE
28-
import Lunapark.LunaparkF (_lunapark, ElementF(..), LunaparkF(..), LunaparkEffect, performActions, findElement)
28+
import Lunapark.LunaparkF (_lunapark, ElementF(..), LunaparkF(..), LUNAPARK, performActions, findElement)
2929
import Lunapark.Types as LT
3030
import Lunapark.Utils (liftAndRethrow, rethrowAsJsonDecodeError, catch)
3131
import Node.Buffer as B
@@ -36,11 +36,11 @@ import Run.Except (EXCEPT)
3636
import Type.Row (type (+))
3737
import 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)
4444
runInterpreter (Interpreter f) = f
4545

4646
init
@@ -93,33 +93,29 @@ init uri caps = do
9393
interpret
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)
9898
interpret 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)
107103
runLunapark input = do
108104
R.interpretRec (R.on _lunapark (handleLunapark input) R.send)
109105

110106
runLunaparkActions
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)
114110
runLunaparkActions input
115111
| input.actionsEnabled = interpretW3CActions Nil
116112
| otherwise = R.interpretRec (R.on _lunaparkActions (jsonWireActions input) R.send)
117113

118114
interpretW3CActions
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 )
123119
interpretW3CActions 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
143139
w3cActions 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)
228224
jsonWireActions 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-
otherdo
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)
299295
handleLunapark 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

0 commit comments

Comments
 (0)