unifying code in frontend tests