Adding a scenario to login with latest password after a password change

Removed init of class member variables to null per a CR feedback.
This commit is contained in:
Praburaj 2014-05-28 10:42:40 -07:00
parent b8782ee2bf
commit fdfaeacbf1
1 changed files with 11 additions and 6 deletions

View File

@ -10,9 +10,9 @@ namespace E2ETests
{ {
private const string Connection_string_Format = "Server=(localdb)\\v11.0;Database={0};Trusted_Connection=True;MultipleActiveResultSets=true"; private const string Connection_string_Format = "Server=(localdb)\\v11.0;Database={0};Trusted_Connection=True;MultipleActiveResultSets=true";
private string ApplicationBaseUrl = null; private string ApplicationBaseUrl;
private HttpClient httpClient = null; private HttpClient httpClient;
private HttpClientHandler httpClientHandler = null; private HttpClientHandler httpClientHandler;
[Theory] [Theory]
[InlineData(HostType.Helios, KreFlavor.DesktopClr, "http://localhost:5001/")] [InlineData(HostType.Helios, KreFlavor.DesktopClr, "http://localhost:5001/")]
@ -56,7 +56,7 @@ namespace E2ETests
SignOutUser(generatedUserName); SignOutUser(generatedUserName);
//Sign in scenarios: Invalid password - Expected an invalid user name password error. //Sign in scenarios: Invalid password - Expected an invalid user name password error.
SignInWithInvalidPassword(generatedUserName); SignInWithInvalidPassword(generatedUserName, "InvalidPassword~1");
//Sign in scenarios: Valid user name & password. //Sign in scenarios: Valid user name & password.
SignInWithUser(generatedUserName, "Password~1"); SignInWithUser(generatedUserName, "Password~1");
@ -64,6 +64,11 @@ namespace E2ETests
//Change password scenario //Change password scenario
ChangePassword(generatedUserName); ChangePassword(generatedUserName);
//SignIn with old password and verify old password is not allowed and new password is allowed
SignOutUser(generatedUserName);
SignInWithInvalidPassword(generatedUserName, "Password~1");
SignInWithUser(generatedUserName, "Password~2");
//Making a request to a protected resource that this user does not have access to - should automatically redirect to login page again //Making a request to a protected resource that this user does not have access to - should automatically redirect to login page again
AccessStoreWithoutPermissions(generatedUserName); AccessStoreWithoutPermissions(generatedUserName);
@ -228,7 +233,7 @@ namespace E2ETests
Console.WriteLine("Successfully signed out of '{0}''s session", userName); Console.WriteLine("Successfully signed out of '{0}''s session", userName);
} }
private void SignInWithInvalidPassword(string userName) private void SignInWithInvalidPassword(string userName, string invalidPassword)
{ {
var response = httpClient.GetAsync("/Account/Login").Result; var response = httpClient.GetAsync("/Account/Login").Result;
var responseContent = response.Content.ReadAsStringAsync().Result; var responseContent = response.Content.ReadAsStringAsync().Result;
@ -236,7 +241,7 @@ namespace E2ETests
var formParameters = new List<KeyValuePair<string, string>> var formParameters = new List<KeyValuePair<string, string>>
{ {
new KeyValuePair<string, string>("UserName", userName), new KeyValuePair<string, string>("UserName", userName),
new KeyValuePair<string, string>("Password", "InvalidPassword~1"), new KeyValuePair<string, string>("Password", invalidPassword),
new KeyValuePair<string, string>("__RequestVerificationToken", HtmlDOMHelper.RetrieveAntiForgeryToken(responseContent, "/Account/Login")), new KeyValuePair<string, string>("__RequestVerificationToken", HtmlDOMHelper.RetrieveAntiForgeryToken(responseContent, "/Account/Login")),
}; };