bootstrap-ruby / bootstrap_form

Official repository of the bootstrap_form gem, a Rails form builder that makes it super easy to create beautiful-looking forms using Bootstrap 5.
MIT License
1.64k stars 352 forks source link

Dockerize System Tests #710

Closed lcreid closed 8 months ago

lcreid commented 8 months ago

@donv very nicely added system tests that generate screenshots for the README. This PR adds support to the optional Docker and Docker Compose files so that the system tests can be run in Docker.

The intent is to ensure that system tests can still be run without Docker, but that they will also run for those who prefer to develop in a Docker environment, because they want to isolate their development work, or for whatever other reason.

This PR introduces a new Docker Compose file: docker-compose-system-test.yml. This file uses a standard Selenium image for Chrome to run the browser. Part of the reason for a separate file is the current docker-compose.yml results in smaller containers, since it doesn't have the full browser. I also wanted to try things in a completely separate file, to avoid breaking the existing Docker workflow.

The approach in this PR is highly experimental and includes some rough edges:

lcreid commented 8 months ago

@donv would you mind pulling this branch and testing if it still runs system tests however you were running them before?

lcreid commented 8 months ago

I think it may be a dream to make the system tests work on all possible platforms people could be using, since none of them have exactly the same fonts. At least, I haven't seen a good solution to this problem. Let me know if you've seen screenshot tests that work across platforms.

donv commented 8 months ago

@lcreid I got a problem:

Minitest::UnexpectedError: LoadError: cannot load such file -- sassc

Will investigate.

lcreid commented 8 months ago

I should have mentioned that I have been using Rails 7.0.8 while working on this PR.

lcreid commented 8 months ago

@donv Did you generate the screenshots for the README on a Mac, or Windows, or Linux (distro?)? The reason I ask is that I'm trying to find a font on Linux that will be close (or the same) metrics-wise to your screenshots, so we can at least visually scan the screenshots quickly for significant differences.

donv commented 8 months ago

@donv Did you generate the screenshots for the README on a Mac, or Windows, or Linux (distro?)? The reason I ask is that I'm trying to find a font on Linux that will be close (or the same) metrics-wise to your screenshots, so we can at least visually scan the screenshots quickly for significant differences.

I generated the screenshots on MAC.

I have recently, in another project, implemented a scheme for generating the screenshots in GitHub actions and updating them using pull requests from a separate branch for screenshots. This seems to work very well, and I think that should be the way forward.

lcreid commented 8 months ago

I have recently, in another project, implemented a scheme for generating the screenshots in GitHub actions and updating them using pull requests from a separate branch for screenshots. This seems to work very well, and I think that should be the way forward.

Brilliant! I've created an issue for this, and assigned it to myself. But I'll probably un-assign myself in a day or two, when I don't find time to work on it. Feel free to assign yourself.