fix(tests): improve functional test setup logic