second pass: factor out functions from e2e test