changes to the tests to handle window switching