Apart the quantity of time wasted to instrument the test for every action (scroll a little down to reach the Save button, add some artifical pause to wait a modal window to open or to close...) and the quantity of times it fails executing simple operations (e.g. random characters skipped while writing into an input box, generating then a failing assertion on input validation) and the amount of totally random behaviours (the same test fails five times in a row, then runs correctly for no apparent reason), I had to try and fail several times to run them on Github Actions.
Laravel's documentation provides some (very appreciated) hint about it, but I had to manage a specific use case.
My application expects the browser to use an Italian locale, especially to format dates in
<input type="date"> boxes. And, of course, the default locale for runners on GitHub Actions is English, so dates were formatted in different ways and failed to be correctly managed.
I had to add a pair of lines on my GitHub Workflow file:
... - name: setup run: | [existing stuff] sudo locale-gen it_IT.UTF-8 sudo update-locale LANG=it_IT.UTF-8 [more stuff] ...
before the execution of Chrome Driver, to install and use my required locale, then in
code/tests/DuskTestCase.php I added a line in the
return $items->merge([ '--disable-gpu', '--headless', '--lang=it', // THIS ONE ]);
So the headless browser executed for the tests has an Italian locale, and everything works fine.
At least, until the next randomly skipped character into an input box...