torchbox / tbxforms

A Torchbox-flavoured template pack for django-crispy-forms, adapted from crispy-forms-gds.
https://pypi.org/project/tbxforms/
BSD 2-Clause "Simplified" License
6 stars 5 forks source link

Find a way to automate updating the HTML fixtures #41

Closed jams2 closed 1 year ago

jams2 commented 1 year ago

We have dozens of tests that render a form, field or fieldset and compare the output to a html file. One of the necessary changes that Balazs introduced causes 60+ of those tests to fail, which identifies what is probably the largest roadblock to progress on this project.

Also related to the test failures on https://github.com/torchbox/tbxforms/pull/39

It's something we really need to solve as it makes maintenance of tbxforms a real drag - speaking from experience, as I manually edited (with the help of macros/regex in emacs) most of the html files to get the tests passing for the initial release.

Kyle suggested looking into something that works like Jest's snapshot tests, which is a great idea. We don't want to have to manually manage html fixtures, but we do care about the way forms are rendered, so we need to be able to review changes to rendered components and update the fixtures easily. I'm going to get a solution happening this week, which will hopefully make other progress easier.

jams2 commented 1 year ago

I found https://tophat.github.io/syrupy/ which is more extensible than other comparable packages. Including it is a small cost, and replicating a subset of its functionality for our specific use-case in future, if necessary, would be achievable.