zenstruck / browser

A fluent interface for your Symfony functional tests.
MIT License
190 stars 18 forks source link

Split HasBrowser trait while keeping the generic trait #23

Closed wouterj closed 3 years ago

wouterj commented 3 years ago

This partially reverts #3, while keeping the API introduced there.

With this change, HasBrowser is still available with the same API as before. Yet, all browsers are also available in their own trait.

I'm not sure if you want this amount of trait hacking in the library. I'm experimenting with using Browser in Pest. Having a trait for each browser implementation is the best way to configure the browser implementation in Pest.

kbond commented 3 years ago

Awesome, this looks like the best of both worlds.

Curious to see your pest experiment. It's on my list to check out. Glad to hear it seems like it works with Symfony/browser.

kbond commented 3 years ago

How do you think this should be documented?

(and btw, I'm completely open to an overhaul of the docs if necessary - I find them awkward)

kbond commented 3 years ago

@wouter, as we've discussed in Slack, I'm in favour of just 3 traits (no "trait hacking"):

  1. HasBrowser: with browser() method that returns an instance of KernelBrowser
  2. HasHttpBrowser: with httpBrowser() method that returns an instance of HttpBrowser
  3. HasPantherBrowser: with pantherBrowser() method that returns an instance of PantherBrowser

Are we still on the same page here?

wouterj commented 3 years ago

Yes, sorry for the delay here. Everything is now according to our decision as fasr as I can see.

We also discussed changing the README a bit IIRC, to focus on "browser" and then explain panther + httpclient and their special APIs. Let's do that in another PR :)

kbond commented 3 years ago

Thanks @wouterj!