-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
Please don't remove bower for now. Having both spago and bower seems redundant but not a big deal I think 🙂 |
@cryogenian done |
BaseEffects or LunaparkBaseEffects (as is) ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems almost done! 👍
Just a couple of smallish comments
src/Lunapark/ActionF.purs
Outdated
@@ -32,49 +33,49 @@ derive instance functorTouchF ∷ Functor TouchF | |||
|
|||
_lunaparkActions = SProxy ∷ SProxy "lunaparkActions" | |||
type LUNAPARK_ACTIONS = R.FProxy ActionF | |||
type WithAction r = R.Run (lunaparkActions ∷ LUNAPARK_ACTIONS|r) Unit | |||
type LunaparkActionsEffect r = ( lunaparkActions ∷ LUNAPARK_ACTIONS | r ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind, but could you please share your motivation here? Is it because BaseEffect
andWithAction
is unclear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BaseEffect
? You prob mean BaseRun
the reason is that it's easier to understand when Run is not in type
- do one thing and do it well
- it's better to not use type aliases when possible (I have learned this from decoder implementation that is not dependent on class -> move implementation to Implementation module purescript-contrib/purescript-argonaut-codecs#74 (comment)
I think F in Foreign is a similar case, and a mistake also, as again the underlying types are pretty simple without the synonym
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change means that instead of this
myAwesomeTest :: forall r. Lunapark r
myAwesomeTest = do
go "http://whatever.com"
clickEl selector
End-users will need to write this
myAwesomeTest:: forall r. Run (LunaparkBaseEffects + LunaparkEffect + LunaparkActionsEffect + r)
myAwesomeTest = do
go "http://whatever.com"
clickEl selector
Removing Lunapark r
complicates basic use-case and propagates implementation details to the call site, I think it should be preserved. I'm fine with removing WithAction
, BaseRun
and using Run (Whatever r)
inside the library, but don't agree with removing main library monad synonim from public API. I'd say that making Lunapark r
a newtype might be good idea, but not in this pr 🙂
Personally, I think that this Lunapark r
(not WithAction r
and definitely not BaseRun r
) are somewhat like CodecJson
, not F
(ugh... F
from foreign is terrible)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
returned
type Lunapark
-
re newtyping - not sure if I like this idea
I'm fine with doing
Run (LunaparkBaseEffects + LunaparkEffect + LunaparkActionsEffect + r)
actually I removed BaseRun so I could easiter to this to see what is going on
I like when I see ok, I'm using the Run lib, not something else
src/Lunapark/Error.purs
Outdated
= JsonDecodeError J.JsonDecodeError | ||
| WebdriverError LWE.WebdriverError | ||
| AffjaxError N.Error | ||
| UserError String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is actually LunaparkError
not UserError
as it's internal thing for lunapark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about rename UserError
to InternalError
(since it is only in lib)
and rename LunaparkF
to BaseActionF
?
I think there is too much Lunapark
in lunapark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or maybe LunaparkF to ActionF and ActionF to CompoundActionF?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it's not internal, right? More like it's compound or domain level, what about CompoundError
?
LunaparkF -> ActionF
and ActionF -> CompoundActionF
break webdriver naming scheme, because ActionF
is actually about actions in webdriver (they are encoded as action
field and discussed in action
section of docs. I'd agree that LunaparkActionEffect -> ActionEffect
is OK, but, yeah, ActionEffect
sounds a bit too generic to me, although it's definitely acceptable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- re errors
I think I have found the best variant e7428d9
- re renaming
I have finally understood the ActionF
it transforms
my = do
ActionF.sendKeys "a"
ActionF.pause
LunaparkF.foo
ActionF.sendKeys "a"
ActionF.pause
to
my = do
LunaparkF.performActions $ Object.fromHomogenous
{ "id1": Key [keyDown "a", keyUp "a", pause]
}
LunaparkF.foo
LunaparkF.performActions $ Object.fromHomogenous
{ "id1": Key [keyDown "a", keyUp "a", pause]
}
spec https://github.com/jlipps/simple-wd-spec#perform-actions
but also supports deprecated json wire
wow this complicated
- renaming is done in e60fd79
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's how it works. We had problems where ff driver and chromedriver were supporting only subsets of actual webdriver API.
ok, I think that's all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thing we agreed on all changes here 🎉
There is a couple of leftover comments and other tiny stuff.
packages.dhall
Outdated
@@ -0,0 +1,111 @@ | |||
{- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this comment I think
spago.dhall
Outdated
@@ -0,0 +1,19 @@ | |||
{- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
src/Lunapark/Endpoint.purs
Outdated
post' ∷ String → Endpoint → Aff (Either LE.Error Json) | ||
post' uri ep = map handleAPIError $ N.post NR.json (uri <> print ep) Nothing | ||
|
||
-- | post_ ∷ String → Endpoint → Aff (Either LE.Error Unit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover comment
src/Lunapark/Error.purs
Outdated
| CachingError CachingError | ||
|
||
printError :: Error -> String | ||
printError = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please use unicode,
→
and∷
- The indetntation is kinda strange anyways Something like this should be aligned with other code
printError ∷ Error → String
printError = case _ of
JsonDecodeError jsonDecodeErrro →
J.printJsonDecodeError jsonDecodeError
WebDriverError webdriverError →
"Response with error message:\n"
<> " error type: " <> LWE.toStringCode webdriverError.error <> "\n"
<> " message: " <> webdriverError.message <> "\n"
<> " stacktrace: " <> webdriverError.stacktrace
AffjaxError affjaxError →
N.printError affjaxError
CachingError cachingError →
"Error during caching:\n " <> printCachingError cachingError
where
printCachingError = case _ of
EmptyCases key → "There is no working implementation for " <> key <> " action."
IncorrectCache key → "Trying another implementation for " <> key <> " action."
src/Lunapark/Types.purs
Outdated
@@ -1,14 +1,14 @@ | |||
-- | This module contains types for requests and response. | |||
-- | Most of them are records with `α → Json` and `Json → Either String α` functions | |||
-- | Most of them are records with `α → J.Json` and `Json → Either J.JsonDecodeError α` functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto replace? 🙂 The second Json
should have J.
or all of them shouldn't have J.
import Lunapark.WebdriverError as LWE | ||
import Data.Argonaut.Decode (JsonDecodeError, printJsonDecodeError) as J | ||
|
||
data CachingError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
bower.json
Outdated
@@ -26,7 +26,7 @@ | |||
], | |||
"dependencies": { | |||
"purescript-affjax": "^9.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not-updated dep
done |
The build is failing |
Thank you very much |
Can you please squash commits to clean history up? I don't want to remove you from authors here |
commit 3b7c111 Author: Serhii Khoma <srghma@gmail.com> Date: Thu Nov 19 18:36:44 2020 +0200 fix: ci commit 1831afa Author: Serhii Khoma <srghma@gmail.com> Date: Thu Nov 19 18:15:29 2020 +0200 fix: review -> commments and style commit f94fc1a Author: Serhii Khoma <srghma@gmail.com> Date: Thu Nov 19 17:41:22 2020 +0200 fix: review -> return type Lunapark commit 95ba053 Author: Serhii Khoma <srghma@gmail.com> Date: Thu Nov 19 17:36:30 2020 +0200 fix: review -> indentation commit e60fd79 Author: Serhii Khoma <srghma@gmail.com> Date: Thu Nov 19 17:34:32 2020 +0200 fix: review -> rename LunaparkActionsEffect to ActionsEffect commit b3abe29 Author: Serhii Khoma <srghma@gmail.com> Date: Thu Nov 19 17:11:39 2020 +0200 refactor: add comment commit e7428d9 Author: Serhii Khoma <srghma@gmail.com> Date: Thu Nov 19 16:38:53 2020 +0200 fix: review -> fine grain tryAndCache errors commit 89c37e4 Author: Serhii Khoma <srghma@gmail.com> Date: Thu Nov 19 12:12:16 2020 +0200 fix: review -> rename throwLeftJsonDecodeError to rethrowAsJsonDecodeError and remove throwLeftUserError commit 50f546e Author: Serhii Khoma <srghma@gmail.com> Date: Thu Nov 19 12:06:00 2020 +0200 fix: review -> remove test commit 2c254f4 Author: Serhii Khoma <srghma@gmail.com> Date: Thu Nov 19 12:05:31 2020 +0200 fix: review -> dont export handleAPIError commit 8ec2b5c Author: Serhii Khoma <srghma@gmail.com> Date: Thu Nov 19 11:47:25 2020 +0200 fix: review -> remove extra | commit 49e194e Author: Serhii Khoma <srghma@gmail.com> Date: Wed Nov 18 19:24:48 2020 +0200 feat: remove WithAction and WithLunapark, use rows commit 661bb41 Author: Serhii Khoma <srghma@gmail.com> Date: Wed Nov 18 19:04:42 2020 +0200 refactor: remove BaseRun and Lunapark, add LunaparkBaseEffects, LunaparkEffect, LunaparkActionsEffect commit c8dfbf1 Author: Serhii Khoma <srghma@gmail.com> Date: Wed Nov 18 13:27:30 2020 +0200 feat: rename post_ to post' to match post_ function from Affjax commit c29e049 Author: Serhii Khoma <srghma@gmail.com> Date: Tue Nov 17 15:01:20 2020 +0200 feat: update npm packages commit 69c22bb Author: Serhii Khoma <srghma@gmail.com> Date: Tue Nov 17 14:44:45 2020 +0200 feat: return bower commit 56eb0b4 Author: Serhii Khoma <srghma@gmail.com> Date: Mon Nov 16 20:36:00 2020 +0200 feat: printError commit a914049 Author: Serhii Khoma <srghma@gmail.com> Date: Mon Nov 16 20:34:41 2020 +0200 feat: printError commit 4a68045 Author: Serhii Khoma <srghma@gmail.com> Date: Mon Nov 16 19:14:14 2020 +0200 feat: travis -> use spago commit 8ef0769 Author: Serhii Khoma <srghma@gmail.com> Date: Mon Nov 16 19:09:15 2020 +0200 feat: remove bower commit 34d1fd8 Author: Serhii Khoma <srghma@gmail.com> Date: Mon Nov 16 19:09:07 2020 +0200 feat: add spago commit 42428e2 Author: Serhii Khoma <srghma@gmail.com> Date: Mon Nov 16 19:01:03 2020 +0200 feat: update bower commit 979439b Author: Serhii Khoma <srghma@gmail.com> Date: Mon Nov 16 18:58:57 2020 +0200 feat: update to argonaut 7 and affjax 11 -> run ps-suggest -> fix prev run commit 5b58104 Author: Serhii Khoma <srghma@gmail.com> Date: Mon Nov 16 18:51:31 2020 +0200 feat: update to argonaut 7 and affjax 11 -> run ps-suggest commit 19df447 Author: Serhii Khoma <srghma@gmail.com> Date: Mon Nov 16 18:50:42 2020 +0200 feat: update to argonaut 7 and affjax 11
done |
No description provided.