Extract as Trait or Factory in a separate file.
In order to minify errors after changing texts on frontend we should get translations directly from the frontend's en.json, fr.json files. It can be achieved by reading these files from a FeatureContext.php file method like getTranslationWithCode(locale).
Make FeatureContext.php contains just features methods like "Before", "BeforeStep" etc. So the steps methods like "I click", "I see" should be added as traits. These traits can be separated to groups: Base("I click", "I see"), Group("I publish", "I assign"), Specific("I see something in specific modal")
We should use some "Given" steps programmaticaly in order to decrease running time of the tests.
Make a reusable spin wrapper to make code cleaner and tinier
function iFind($xpath, $timeout = 10) {
return $this->spin(function(FeatureContext $context) use ($xpath) {
return $context->getSession()->getPage()->find('xpath', $xpath);
}, $timeout);
}