Change modes of the main test files for integration tests
Refactoring common actions into helper functions for tests.