zenstruck / browser

A fluent interface for your Symfony functional tests.
MIT License
186 stars 17 forks source link

`Browser::saveCurrentState()` as "real" html #86

Closed kbond closed 2 years ago

kbond commented 2 years ago

When the PHPUnit extension saves the current state of html, save as a real HTML file (with the metadata inside a command).

Closes #85.

kbond commented 2 years ago

One thing that's a bit weird is when the response is non-html (ie json), it's still saved as a .html file. I'm not sure if we want to change this. For JSON though, we can't output as a .json and include the metadata as json doesn't support comments.

kbond commented 2 years ago

I'm going to merge as-is - we can fine-tune later if required. Thanks for the idea @benr77!

benr77 commented 2 years ago

For JSON though, we can't output as a .json and include the metadata as json doesn't support comments.

Is it worth considering outputting the headers as a separate file, so for HTML you'd get a .html and a .txt for the headers, and for JSON a .json and a .txt?

For Panther tests the screenshot is already an additional output file so this kind of makes sense - one output file per "type" of output data. (haven't seen this myself yet but does the JS console output to a dedicated file as well?).

Anyway, cheers for the fast implementation! Let me know if you'd like me to help with testing or anything.