Refactor end2end tests