diff --git a/bower.json b/bower.json index 0770e0d..ac0e14a 100644 --- a/bower.json +++ b/bower.json @@ -21,7 +21,8 @@ "node_modules", "bower_components", "output", - "test" + "test", + "vendor" ], "dependencies": { "purescript-xpath": "cryogenian/purescript-xpath#compiler/0.12", diff --git a/src/Lunapark.purs b/src/Lunapark.purs index 2e2ba47..a4a5089 100644 --- a/src/Lunapark.purs +++ b/src/Lunapark.purs @@ -6,7 +6,7 @@ module Lunapark ) where -import Lunapark.API (BaseRun, HandleLunaparkInput, Lunapark, handleLunapark, init, interpret, interpretW3CActions, jsonWireActions, runLunapark, runLunaparkActions, w3cActions) +import Lunapark.API (Interpreter(..), runInterpreter, BaseRun, HandleLunaparkInput, Lunapark, handleLunapark, init, interpret, interpretW3CActions, jsonWireActions, runLunapark, runLunaparkActions, w3cActions) import Lunapark.Error (Error, ErrorType(..), fromJson, fromStringCode, toStringCode, unknownError) import Lunapark.ActionF (ActionF(..), LUNAPARK_ACTIONS, TouchF(..), WithAction, _lunaparkActions, buttonDown, buttonUp, click, doubleClick, doubleTap, flick, liftAction, longTap, moveTo, pause, scroll, sendKeys, tap, touchDown, touchUp) import Lunapark.LunaparkF (ElementF(..), LUNAPARK, LunaparkF(..), WithLunapark, _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) diff --git a/src/Lunapark/API.purs b/src/Lunapark/API.purs index f5016b2..6c93549 100644 --- a/src/Lunapark/API.purs +++ b/src/Lunapark/API.purs @@ -33,13 +33,18 @@ import Node.FS.Aff as FS import Run as R import Run.Except (EXCEPT) +newtype Interpreter r = Interpreter (Lunapark r ~> BaseRun r) + +runInterpreter ∷ ∀ r. Interpreter r → Lunapark r ~> BaseRun r +runInterpreter (Interpreter f) = f + init - ∷ ∀ m r a + ∷ ∀ m r . MonadAff m ⇒ MonadRec m ⇒ String → LT.CapabilitiesRequest - → m (Either LE.Error (Lunapark r a → BaseRun r a)) + → m (Either LE.Error (Interpreter r)) init uri caps = do res ← liftAff @@ -78,7 +83,7 @@ init uri caps = do , actionsEnabled } - pure $ interpret input + pure $ Interpreter (interpret input) interpret ∷ ∀ r