lucky_cli icon indicating copy to clipboard operation
lucky_cli copied to clipboard

Add BrowserClient for spec support

Open jwoertink opened this issue 5 years ago • 2 comments

We have ApiClient which helps you to test ApiAction specs, but now we need a BrowserClient for testing browser based actions when you're not using Flow.

There are a few catches with this that we need to take in to consideration:

  • How do we handle sessions?
  • How do we handle cookies?
  • How do we handle doing a POST where the Content-Type might change from text/html to application/x-www-form-urlencoded or even multipart/form-data?

jwoertink avatar Aug 31 '20 18:08 jwoertink

@jwoertink maybe we could add a super simple BrowserClient that just do the requests... like rails does using get, post test helpers

then we can improve in the future with sessions/cookies/content-type, at least we can have an action tester, does it makes sense?

ps: I just realized after writing my comment, is your BrowserClient expected to make http calls to a running lucky server? or to run the actions actions just on the crystal side?

fernandes avatar Nov 10 '20 18:11 fernandes

When you run your specs, it will run a test server, so the ApiClient.post() or in this case BrowserClient.post() would actually send to the running server.

A simple one would be good to at least have a start.

jwoertink avatar Nov 10 '20 18:11 jwoertink