public void Verify_Login_Functionality()
 {
     try
     {
         //Verifying error message for no username and paswword
         CommonMethods.ClickLoginButton();
         //Message changed for V2
         if (BrowserServices.GetElementText("CssSelector", LoginPageObjects.ErrorMessageCssSelector) == CommonMethods.Config["usernamepasswordmissing"])
         {
             Console.Out.WriteLine("Error message for username password missing should be present.");
         }
         else
         {
             Assert.AreEqual(BrowserServices.GetElementText("CssSelector", LoginPageObjects.ErrorMessageCssSelector), CommonMethods.Config["usernamepasswordmissingV2"]);
             Console.Out.WriteLine("Error message for username password missing should be changed for V2 app.");
         }
         //Verifying error message for no paswword
         BrowserServices.EnterValueInTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Username"), CommonMethods.Config["username"]);
         CommonMethods.ClickLoginButton();;
         Assert.AreEqual(BrowserServices.GetElementText("CssSelector", LoginPageObjects.ErrorMessageCssSelector), CommonMethods.Config["passwordmissing"]);
         //Password missing message is hidden because of the z-index
         if (BrowserServices.GetAttribute("CssSelector", LoginPageObjects.ErrorMessageCssSelector, "style").Contains("z-index: -1;"))
         {
             Console.Out.WriteLine("Password missing message should be hidden because of z index in V2 app.");
         }
         //Verifying error message for no username
         BrowserServices.ClearTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Username"));
         //Password Label Changed to Pwd
         if (BrowserServices.IsElementPresent("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Password")))
         {
             BrowserServices.EnterValueInTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Password"), CommonMethods.Config["password"]);
         }
         else
         {
             BrowserServices.EnterValueInTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Pwd"), CommonMethods.Config["password"]);
             Console.Out.WriteLine("Password label should be changed to Pwd in V2 app.");
         }
         CommonMethods.ClickLoginButton();
         Assert.AreEqual(BrowserServices.GetElementText("CssSelector", LoginPageObjects.ErrorMessageCssSelector), CommonMethods.Config["usernamemissing"]);
         CommonMethods.Login(CommonMethods.Config["username"], CommonMethods.Config["password"]);
         Assert.True(BrowserServices.IsElementPresent("CssSelector", DashboardPageObject.CompareExpenseCssSelector), "Compare Expense Link should be present after the login.");
     }
     catch (Exception e)
     {
         BrowserServices.ScreenShot("Login_Functionality_Shot");
         Console.Out.WriteLine(e);
     }
 }
 public static void Login(string username, string password)
 {
     //Perform Login and Verify the login is successful
     BrowserServices.ClearTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Username"));
     BrowserServices.EnterValueInTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Username"), username);
     //Password Label changed to Pwd in V2
     if (BrowserServices.IsElementPresent("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Password")))
     {
         BrowserServices.ClearTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Password"));
         BrowserServices.EnterValueInTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Password"), password);
     }
     else
     {
         Console.Out.WriteLine("Password Label Should be changed to Pwd in V2 app.");
         BrowserServices.ClearTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Pwd"));
         BrowserServices.EnterValueInTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Pwd"), password);
     }
     ClickLoginButton();
 }
 public void Verify_Login_Functionality()
 {
     //Start the test by setting AUT's name, window or the page name that's being tested, viewport width and height
     _eyes.Open(_driver, "Hackathan App", "Login Functionality Verification", new RectangleSize(1366, 728));
     //Navigate the browser to the "ACME" demo app. To see visual bugs after the first run, use the commented line below instead.
     //_driver.Url = CommonMethods.Config["url"];
     //Url navigation for V2 app.
     _driver.Url = CommonMethods.Config["urlV2"];
     //Click Login Button
     CommonMethods.ClickLoginButton();
     //Visual checkpoint #1 - Check the username and Password misssing message.
     _eyes.CheckWindow("Username & Password Missing");
     //Enter Username
     BrowserServices.EnterValueInTextBox("XPath", String.Format(LoginPageObjects.LoginFormTextBoxXPath, "Username"), CommonMethods.Config["username"]);
     //Click Login Button
     CommonMethods.ClickLoginButton();
     //Visual checkpoint #2 - Check the username missing message.
     _eyes.CheckWindow("Password Missing");
     //Clear Username
     BrowserServices.ClearTextBox("XPath", String.Format(LoginPageObjects.LoginFormTextBoxXPath, "Username"));
     //Enter Password
     if (BrowserServices.IsElementPresent("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Password")))
     {
         BrowserServices.EnterValueInTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Password"), CommonMethods.Config["password"]);
     }
     else
     {
         BrowserServices.EnterValueInTextBox("XPath", Format(LoginPageObjects.LoginFormTextBoxXPath, "Pwd"), CommonMethods.Config["password"]);
         Console.Out.WriteLine("Password label should be changed to Pwd in V2 app.");
     }
     //Click Login Button
     CommonMethods.ClickLoginButton();
     //Visual checkpoint #3 - Check the password missing message.
     _eyes.CheckWindow("Username Missing");
     //Enter Username
     BrowserServices.EnterValueInTextBox("XPath", String.Format(LoginPageObjects.LoginFormTextBoxXPath, "Username"), CommonMethods.Config["username"]);
     //Click Login Button
     CommonMethods.ClickLoginButton();
     //Visual checkpoint #3 - Check the password missing message.
     _eyes.CheckWindow("Login Complete");
     //End the test.
     _eyes.CloseAsync();
 }