public void SignInTest1() { String inputUsername = "******"; String inputPassword = "******"; HomePage homePage = new HomePage(driver, test); SignInPage signInPage = new SignInPage(driver, test); ElementMethods elementMethods = new ElementMethods(driver, test); test.Log(Status.Info, "Step 1 : Navigate to WSECU website"); homePage.NavigateToWSECU(); test.Log(Status.Info, "Step 2 : Enter Username and click 'Sign in'"); homePage.OnlineBankingSignIn("TestUser"); test.Log(Status.Info, "Step 3 : Verify user navigate to Online Banking signin page"); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromMilliseconds(5000)); wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//input[@name='username']"))); if (driver.Title.Equals("Sign in to Online Banking")) { test.Log(Status.Pass, "Navigate to Online Banking Sign In page successfully"); } else { test.Log(Status.Fail, "Failed to navigate to Sign In page"); Assert.Fail("Failed to navigate to Sign In page"); } test.Log(Status.Info, "Step 4 : Verify Username entered in previous step populates on screen."); string username = signInPage.elmSingInUsername.GetAttribute("value"); if (username.Equals(inputUsername)) { test.Log(Status.Pass, "Username is populated"); } else { test.Fail("Username is not populated"); } test.Log(Status.Info, "Step 5 : Enter incorrect password and click 'Sign in'"); signInPage.enterPassword(inputPassword); elementMethods.ClickSubmit(signInPage.btnSignIn); test.Log(Status.Info, "Step 6 : Verify error message display : 'Sorry, incorrect username.'"); if (signInPage.txtErrorMessage.Displayed) { test.Log(Status.Pass, "Error message displays"); } else { test.Log(Status.Fail, "Error message does not display"); } }
public void OnlineBankingSignIn(string userName) { elementMethods.EnterText(elmUsername, userName); elementMethods.ClickSubmit(btnOnlineBankingSignIn); }