Added some testing code for login page. As well as converting use of window to  for easier testing