I have some flickering specs (integration specs that rely on browser / JS).
One way to avoid these flickering tests from stopping the workflow and requiring me to do a rerun, is to have a step that runs the test suite again for the specs that failed:
- run: name: RSpec interaction tests command: | bundle exec rspec [--flags] ./interaction - run: name: RSpec interaction tests (2nd run) when: on_fail command: | bundle exec rspec [--flags] --only-failures ./interaction
But this does only half of what I need:
As you can see, the 2nd pass runs when the 1st one failed.
And is now green, but this job was still marked as failed and the workflow stopped.
Is there a way to achieve what I want?
I guess that I can do something like
- run: name: RSpec interaction tests command: | bundle exec rspec [--flags] ./interaction bundle exec rspec [--flags] --only-failures ./interaction
But it is not as explicit why I’m doing this, the 2nd rspec command will run every time, even when the 1st run had no errors (taking up some seconds of job execution), and perhaps the job spec has some config that fits this use case.