add clickOn function (closes #1405)#1408
Conversation
| , rbdGets = rbdGets rbd ++ H.parseQuery (TE.encodeUtf8 urlQuery) | ||
| } | ||
|
|
||
| clickOn :: Yesod site => Query -> YesodExample site () |
There was a problem hiding this comment.
Could you add documentation for this, and an @since Haddock annotation? Ideally the documentation would include a small example like most of the rest of yesod-test has (You could just copy an example from your tests and that would be fine)
There was a problem hiding this comment.
Whichever Github user @since is, I bet they get a lot of spurious notifications 🤔
There was a problem hiding this comment.
good catch, forgot about that one :)
| yit "can follow a link via clickOn" $ do | ||
| get ("/htmlWithLink" :: Text) | ||
| clickOn "a#thelink" | ||
| statusIs 200 |
There was a problem hiding this comment.
Should this test that the actual new page is returned after the link is clicked?
There was a problem hiding this comment.
Probably. Would be nice to just check URL of the last response, but i can't seem to do that - i'll check the content instead.
yesod-test/ChangeLog.md
Outdated
| @@ -1,3 +1,7 @@ | |||
| ## 1.5.7 | |||
|
|
|||
| * Add clickOn | |||
There was a problem hiding this comment.
Could you link to this PR in the changelog so people can get further details? Just line for 1.5.4
|
this seems to be failing because of a CI timeout. @MaxGabriel - could you poke travis? |
| -- ==== __ Examples__ | ||
| -- | ||
| -- > get "/foobar" | ||
| -- > clickOn "a#idofthelink" |
There was a problem hiding this comment.
Could you add an @since annotation here?
|
Yes, poked. I made one more comment about a missing |
| case findAttributeBySelector (simpleBody res) query "href" of | ||
| Left err -> failure $ query <> " did not parse: " <> T.pack (show err) | ||
| Right [[match]] -> get match | ||
| Right matches -> failure $ "Expected exactly one match for clickOn: got " <> T.pack (show matches) |
There was a problem hiding this comment.
I really like this implementation, very clean pattern matching.
|
Great PR! |
No description provided.