improved window management during tests