DEV Community 👩‍💻👨‍💻

Discussion on: Docker + Rails + System tests with Headless Chrome

dstull profile image
Doug Stull Author

Hi Jack - thanks!

If I understand correctly you are referencing the ability to run the testing suite outside the app container...

With the rails system tests, the testing suite is integrated in the app git repo and is hitting the backend. If I stick to that approach to perform the system tests, then the only option I can see is to have the system tests run from inside the container for the app.

However, if we were using some testing suite that was perhaps testing a frontend framework instead, I could definitely see that as being the way to go as it perhaps wouldn't be so tightly coupled to the backend code/framework.

For this example I believe the benefits of utilizing the rails system testing suite outweigh the negatives. I assume that would hold true for me up and until a split of the frontend and backend technologies were to happen.

jackxxu profile image
Jack Xiaosong Xu

Hi Doug,

Yes, I am referring to the ability to run integration tests outside the app container. I believe that in capybara and headless chrome selenium driver, you can specify an external url to run the integration test. This enables CI agent to run the test against the docker container.

Docker images, at least the production ones, are supposed to have the bare minimum of what needs to get the job done. I think it should probably exclude all the development and test gems and I would also exclude the test directory.

If the purpose of the image is for test, then it is fine to run tests inside the container itself.