In fact, you already have an answer. What you declare is correct.
Laravel integrated tests will emulate requests internally and can take advantage of some benefits (e.g. Disabling middleware, Mocking, Spying, etc.) to ensure that you isolate a specific problem (test case). The idea is to test the application without introducing the side effects of third-party components into the battlefield, it will be: client browsers , external services , etc. These types of tests are very quick and easy. Also very suitable for testing API calls.
Thus, Selenium is designed to cover all of these cases in which you really want to cover those scenarios that affect the side effects of third-party components, such as JavaScript in Chrome, IE, Firefox, etc., even in different versions. You can understand this as trying to be as close as possible to a real-world scenario, where the client’s browser can actually interfere with the expected behavior of your application. You can also run screenshots if you want to visually check CSS or interactive components. It is important to note that because of this browser, these tests run slower.
The conclusion should be that you do not need to use one or the other exclusively . They work similarly, but in the end, they provide different possibilities. You may have a Laravel integration test suite and a Selenium test suite for those things that are important to you. I offer you this Laracast
I can provide you with an example in my project, but not an appropriate, but at least a way to show that both types of tests can coexist in the same project.
Hope this helps!
source share