Increase wait time and extract common code for epics spec
What does this MR do and why?
The spec uses default eventually matcher wait which is just 3 attempts * 0.5s sleep, so only 1.5 seconds. This is enough in most cases and this spec actually has 100% pass rate in master
runs, but after looking at broader data of mr runs, it does actually fail from time to time (https://gitlab.com/gitlab-org/gitlab/-/jobs/8160175393#L1935) when some tests created enough load on sidekiq
worker so it doesn't update the epic dates in time.
Also reduces some of the code duplication and fixes rubocop violations.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.