public void TestLoginPageObject() { var username = "******"; var password = "******"; var loginAction = new LoginAction(browser, username, password); var loginSuccess = loginAction.Execute(true); Assert.True(loginSuccess, "expected user name didn't match found"); }
public void TestBadPasswordLoginFail() { var username = "******"; var password = "******"; var loginAction = new LoginAction(browser, username, password); var loginSuccess = loginAction.Execute(true); Assert.False(loginSuccess, "user shows as logged in with bad password"); //(this is why we made the page objects available in the action...) var foundBadPasswordError = loginAction.LoginPage.logOnErrorBadUsernameOrPassword(); //first make sure the returned element isn't null before we try and retrieve the text Assert.NotNull(foundBadPasswordError); var expectedBadMsg = loginAction.LoginPage.expectedBadUsernameOrPasswordText(); Assert.True(expectedBadMsg.Equals(foundBadPasswordError.Text), "Bad password error did not match expected"); }