Fix login in test

Fixes an issue with test startup when login window disappears before the test manages to login