Add functional test for leaving domain