private async Task OpenIdConnectTestSuite(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { var logger = new LoggerFactory() .AddConsole(LogLevel.Warning) .CreateLogger(string.Format("OpenId:{0}:{1}:{2}", serverType, runtimeFlavor, architecture)); using (logger.BeginScope("OpenIdConnectTestSuite")) { var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var connectionString = string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName); var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "OpenIdConnectTesting", UserAdditionalCleanup = parameters => { if (!Helpers.RunningOnMono) { // Mono uses InMemoryStore DbUtils.DropDatabase(musicStoreDbName, logger); } } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair<string, string>( "SQLAZURECONNSTR_DefaultConnection", string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler(); var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; // Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger: logger, cancellationToken: deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); await validator.VerifyHomePage(response); // OpenIdConnect login. await validator.LoginWithOpenIdConnect(); logger.LogInformation("Variation completed successfully."); } } }
public async Task DotnetRun_Tests(TestVariant variant) { var testName = $"DotnetRunTests_{variant}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger("DotnetRunTests"); var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters(variant) { ApplicationPath = Helpers.GetApplicationPath(), PublishApplicationBeforeDeployment = false, EnvironmentName = "Development", UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, logger); }, EnvironmentVariables = { { MusicStoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName) }, }, }; using (var deployer = IISApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { var deploymentResult = await deployer.DeployAsync(); var httpClientHandler = new HttpClientHandler { UseDefaultCredentials = true }; var httpClient = deploymentResult.CreateHttpClient(httpClientHandler); var response = await RetryHelper.RetryRequest( () => httpClient.GetAsync(string.Empty), logger, deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); logger.LogInformation("Verifying home page"); // Verify HomePage should validate that we're using precompiled views. await validator.VerifyHomePage(response); // Verify developer exception page logger.LogInformation("Verifying developer exception page"); response = await RetryHelper.RetryRequest( () => httpClient.GetAsync("PageThatThrows"), logger, cancellationToken : deploymentResult.HostShutdownToken); await validator.VerifyDeveloperExceptionPage(response); logger.LogInformation("Variation completed successfully."); } } }
public async Task OpenIdConnectTestSuite(TestVariant variant) { var testName = $"OpenIdConnectTestSuite_{variant}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger("OpenIdConnectTestSuite"); var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters(variant) { ApplicationPath = Helpers.GetApplicationPath(), PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, EnvironmentName = "OpenIdConnectTesting", UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, logger); }, AdditionalPublishParameters = " /p:PublishForTesting=true" }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair <string, string>( MusicStoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = IISApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { var deploymentResult = await deployer.DeployAsync(); var httpClientHandler = new HttpClientHandler(); var httpClient = deploymentResult.CreateHttpClient(httpClientHandler); // Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = await RetryHelper.RetryRequest(async() => { return(await httpClient.GetAsync(string.Empty)); }, logger : logger, cancellationToken : deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); logger.LogInformation("Verifying home page"); await validator.VerifyHomePage(response); logger.LogInformation("Verifying login by OpenIdConnect"); await validator.LoginWithOpenIdConnect(); logger.LogInformation("Variation completed successfully."); } } }
// TODO: temporarily disabling x86 tests as dotnet xunit test runner currently does not support 32-bit //[ConditionalTheory(Skip = "https://github.com/aspnet/MusicStore/issues/565"), Trait("E2Etests", "E2Etests")] //[OSSkipCondition(OperatingSystems.Windows)] //[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5045/")] //public async Task OpenIdConnect_OnMono(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType, string applicationBaseUrl) //{ // await OpenIdConnectTestSuite(serverType, runtimeFlavor, architecture, applicationBaseUrl); //} private async Task OpenIdConnectTestSuite(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType, string applicationBaseUrl) { using (_logger.BeginScope("OpenIdConnectTestSuite")) { var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture) { PublishApplicationBeforeDeployment = true, TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", ApplicationType = applicationType, ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "OpenIdConnectTesting", UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, _logger); } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair <string, string>( MusicStore.StoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler(); var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; // Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = await RetryHelper.RetryRequest(async() => { return(await httpClient.GetAsync(string.Empty)); }, logger : _logger, cancellationToken : deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, _logger, deploymentResult); await validator.VerifyHomePage(response); // OpenIdConnect login. await validator.LoginWithOpenIdConnect(); _logger.LogInformation("Variation completed successfully."); } } }
public async Task SmokeTestSuite( ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType, string applicationBaseUrl, bool noSource = false) { using (_logger.BeginScope("SmokeTestSuite")) { var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters( Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "SocialTesting", ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null, SiteName = "MusicStoreTestSite", PublishApplicationBeforeDeployment = true, TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0", ApplicationType = applicationType, UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, _logger); } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair <string, string>( MusicStore.StoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _logger)) { var deploymentResult = deployer.Deploy(); Helpers.SetInMemoryStoreForIIS(deploymentParameters, _logger); var httpClientHandler = new HttpClientHandler(); var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri), Timeout = TimeSpan.FromSeconds(5), }; // Request to base address and check if various parts of the body are rendered // & measure the cold startup time. var response = await RetryHelper.RetryRequest(async() => { return(await httpClient.GetAsync(string.Empty)); }, logger : _logger, cancellationToken : deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, _logger, deploymentResult); await validator.VerifyHomePage(response); // Verify the static file middleware can serve static content. await validator.VerifyStaticContentServed(); // Making a request to a protected resource should automatically redirect to login page. await validator.AccessStoreWithoutPermissions(); // Register a user - Negative scenario where the Password & ConfirmPassword do not match. await validator.RegisterUserWithNonMatchingPasswords(); // Register a valid user. var generatedEmail = await validator.RegisterValidUser(); await validator.SignInWithUser(generatedEmail, "Password~1"); // Register a user - Negative scenario : Trying to register a user name that's already registered. await validator.RegisterExistingUser(generatedEmail); // Logout from this user session - This should take back to the home page await validator.SignOutUser(generatedEmail); // Sign in scenarios: Invalid password - Expected an invalid user name password error. await validator.SignInWithInvalidPassword(generatedEmail, "InvalidPassword~1"); // Sign in scenarios: Valid user name & password. await validator.SignInWithUser(generatedEmail, "Password~1"); // Change password scenario await validator.ChangePassword(generatedEmail); // SignIn with old password and verify old password is not allowed and new password is allowed await validator.SignOutUser(generatedEmail); await validator.SignInWithInvalidPassword(generatedEmail, "Password~1"); await validator.SignInWithUser(generatedEmail, "Password~2"); // Making a request to a protected resource that this user does not have access to - should // automatically redirect to the configured access denied page await validator.AccessStoreWithoutPermissions(generatedEmail); // Logout from this user session - This should take back to the home page await validator.SignOutUser(generatedEmail); // Login as an admin user await validator.SignInWithUser("*****@*****.**", "YouShouldChangeThisPassword1!"); // Now navigating to the store manager should work fine as this user has // the necessary permission to administer the store. await validator.AccessStoreWithPermissions(); // Create an album var albumName = await validator.CreateAlbum(); var albumId = await validator.FetchAlbumIdFromName(albumName); // Get details of the album await validator.VerifyAlbumDetails(albumId, albumName); // Verify status code pages acts on non-existing items. await validator.VerifyStatusCodePages(); // Get the non-admin view of the album. await validator.GetAlbumDetailsFromStore(albumId, albumName); // Add an album to cart and checkout the same await validator.AddAlbumToCart(albumId, albumName); await validator.CheckOutCartItems(); // Delete the album from store await validator.DeleteAlbum(albumId, albumName); // Logout from this user session - This should take back to the home page await validator.SignOutUser("Administrator"); // Google login await validator.LoginWithGoogle(); // Facebook login await validator.LoginWithFacebook(); // Twitter login await validator.LoginWithTwitter(); // MicrosoftAccountLogin await validator.LoginWithMicrosoftAccount(); _logger.LogInformation("Variation completed successfully."); } } }
internal static async Task RunTestsAsync(DeploymentResult deploymentResult, ILogger logger) { var httpClientHandler = new HttpClientHandler(); var httpClient = deploymentResult.CreateHttpClient(httpClientHandler); httpClient.Timeout = TimeSpan.FromSeconds(15); // Request to base address and check if various parts of the body are rendered // & measure the cold startup time. var response = await RetryHelper.RetryRequest(async() => { return(await httpClient.GetAsync(string.Empty)); }, logger, cancellationToken : deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); logger.LogInformation("Verifying home page"); await validator.VerifyHomePage(response); logger.LogInformation("Verifying static files are served from static file middleware"); await validator.VerifyStaticContentServed(); logger.LogInformation("Verifying access to a protected resource should automatically redirect to login page."); await validator.AccessStoreWithoutPermissions(); logger.LogInformation("Verifying mismatched passwords trigger validaton errors during user registration"); await validator.RegisterUserWithNonMatchingPasswords(); logger.LogInformation("Verifying valid user registration"); var generatedEmail = await validator.RegisterValidUser(); logger.LogInformation("Verifying duplicate user email registration"); await validator.RegisterExistingUser(generatedEmail); logger.LogInformation("Verifying incorrect password login"); await validator.SignInWithInvalidPassword(generatedEmail, "InvalidPassword~1"); logger.LogInformation("Verifying valid user log in"); await validator.SignInWithUser(generatedEmail, "Password~1"); logger.LogInformation("Verifying change password"); await validator.ChangePassword(generatedEmail); logger.LogInformation("Verifying old password is not valid anymore"); await validator.SignOutUser(generatedEmail); await validator.SignInWithInvalidPassword(generatedEmail, "Password~1"); await validator.SignInWithUser(generatedEmail, "Password~2"); logger.LogInformation("Verifying authenticated user trying to access unauthorized resource"); await validator.AccessStoreWithoutPermissions(generatedEmail); logger.LogInformation("Verifying user log out"); await validator.SignOutUser(generatedEmail); logger.LogInformation("Verifying admin user login"); await validator.SignInWithUser("*****@*****.**", "YouShouldChangeThisPassword1!"); logger.LogInformation("Verifying admin user's access to store manager page"); await validator.AccessStoreWithPermissions(); logger.LogInformation("Verifying creating a new album"); var albumName = await validator.CreateAlbum(); var albumId = await validator.FetchAlbumIdFromName(albumName); logger.LogInformation("Verifying retrieved album details"); await validator.VerifyAlbumDetails(albumId, albumName); logger.LogInformation("Verifying status code pages for non-existing items"); await validator.VerifyStatusCodePages(); logger.LogInformation("Verifying non-admin view of an album"); await validator.GetAlbumDetailsFromStore(albumId, albumName); logger.LogInformation("Verifying adding album to a cart"); await validator.AddAlbumToCart(albumId, albumName); logger.LogInformation("Verifying cart checkout"); await validator.CheckOutCartItems(); logger.LogInformation("Verifying deletion of album from a cart"); await validator.DeleteAlbum(albumId, albumName); logger.LogInformation("Verifying administrator log out"); await validator.SignOutUser("Administrator"); logger.LogInformation("Variation completed successfully."); }
public async Task SmokeTestSuite( ServerType serverType, RuntimeFlavor donetFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, bool noSource = false) { var logger = new LoggerFactory() .AddConsole() .CreateLogger(string.Format("Smoke:{0}:{1}:{2}", serverType, donetFlavor, architecture)); using (logger.BeginScope("SmokeTestSuite")) { var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, donetFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "SocialTesting", PublishWithNoSource = noSource, UserAdditionalCleanup = parameters => { if (!Helpers.RunningOnMono && parameters.ServerType != ServerType.IIS && parameters.ServerType != ServerType.IISNativeModule) { // Mono uses InMemoryStore DbUtils.DropDatabase(musicStoreDbName, logger); } } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair<string, string>( "SQLAZURECONNSTR_DefaultConnection", string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) { var deploymentResult = deployer.Deploy(); Helpers.SetInMemoryStoreForIIS(deploymentParameters, logger); var httpClientHandler = new HttpClientHandler(); var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; // Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger: logger, cancellationToken: deploymentResult.HostShutdownToken); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); await validator.VerifyHomePage(response); // Verify the static file middleware can serve static content. await validator.VerifyStaticContentServed(); // Making a request to a protected resource should automatically redirect to login page. await validator.AccessStoreWithoutPermissions(); // Register a user - Negative scenario where the Password & ConfirmPassword do not match. await validator.RegisterUserWithNonMatchingPasswords(); // Register a valid user. var generatedEmail = await validator.RegisterValidUser(); await validator.SignInWithUser(generatedEmail, "Password~1"); // Register a user - Negative scenario : Trying to register a user name that's already registered. await validator.RegisterExistingUser(generatedEmail); // Logout from this user session - This should take back to the home page await validator.SignOutUser(generatedEmail); // Sign in scenarios: Invalid password - Expected an invalid user name password error. await validator.SignInWithInvalidPassword(generatedEmail, "InvalidPassword~1"); // Sign in scenarios: Valid user name & password. await validator.SignInWithUser(generatedEmail, "Password~1"); // Change password scenario await validator.ChangePassword(generatedEmail); // SignIn with old password and verify old password is not allowed and new password is allowed await validator.SignOutUser(generatedEmail); await validator.SignInWithInvalidPassword(generatedEmail, "Password~1"); await validator.SignInWithUser(generatedEmail, "Password~2"); // Making a request to a protected resource that this user does not have access to - should // automatically redirect to the configured access denied page await validator.AccessStoreWithoutPermissions(generatedEmail); // Logout from this user session - This should take back to the home page await validator.SignOutUser(generatedEmail); // Login as an admin user await validator.SignInWithUser("*****@*****.**", "YouShouldChangeThisPassword1!"); // Now navigating to the store manager should work fine as this user has the necessary permission to administer the store. await validator.AccessStoreWithPermissions(); // Create an album var albumName = await validator.CreateAlbum(); var albumId = await validator.FetchAlbumIdFromName(albumName); // Get details of the album await validator.VerifyAlbumDetails(albumId, albumName); // Verify status code pages acts on non-existing items. await validator.VerifyStatusCodePages(); // Get the non-admin view of the album. await validator.GetAlbumDetailsFromStore(albumId, albumName); // Add an album to cart and checkout the same await validator.AddAlbumToCart(albumId, albumName); await validator.CheckOutCartItems(); // Delete the album from store await validator.DeleteAlbum(albumId, albumName); // Logout from this user session - This should take back to the home page await validator.SignOutUser("Administrator"); // Google login await validator.LoginWithGoogle(); // Facebook login await validator.LoginWithFacebook(); // Twitter login await validator.LoginWithTwitter(); // MicrosoftAccountLogin await validator.LoginWithMicrosoftAccount(); logger.LogInformation("Variation completed successfully."); } } }
public async Task Publish_And_Run_Tests( ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, bool noSource) { using (_logger.BeginScope("Publish_And_Run_Tests")) { var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters( Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, PublishApplicationBeforeDeployment = true, PublishTargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netstandardapp1.5", UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, _logger); } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair<string, string>( MusicStore.StoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; var httpClient = new HttpClient(httpClientHandler); httpClient.BaseAddress = new Uri(deploymentResult.ApplicationBaseUri); // Request to base address and check if various parts of the body are rendered & // measure the cold startup time. // Add retry logic since tests are flaky on mono due to connection issues var response = await RetryHelper.RetryRequest(async () => await httpClient.GetAsync(string.Empty), logger: _logger, cancellationToken: deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, _logger, deploymentResult); await validator.VerifyHomePage(response); // Static files are served? await validator.VerifyStaticContentServed(); if (serverType != ServerType.IISExpress) { if (Directory.GetFiles( deploymentParameters.ApplicationPath, "*.cmd", SearchOption.TopDirectoryOnly).Length > 0) { throw new Exception("publishExclude parameter values are not honored."); } } _logger.LogInformation("Variation completed successfully."); } } }
public async Task Publish_And_Run_Tests(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, bool noSource) { var logger = new LoggerFactory() .AddConsole() .CreateLogger(string.Format("Publish:{0}:{1}:{2}:{3}", serverType, runtimeFlavor, architecture, noSource)); using (logger.BeginScope("Publish_And_Run_Tests")) { var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var connectionString = string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName); var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, PublishApplicationBeforeDeployment = true, PublishWithNoSource = noSource, UserAdditionalCleanup = parameters => { if (!Helpers.RunningOnMono) { // Mono uses InMemoryStore DbUtils.DropDatabase(musicStoreDbName, logger); } } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair<string, string>( "SQLAZURECONNSTR_DefaultConnection", string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; // Request to base address and check if various parts of the body are rendered & measure the cold startup time. // Add retry logic since tests are flaky on mono due to connection issues var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger: logger, cancellationToken: deploymentResult.HostShutdownToken); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); await validator.VerifyHomePage(response); // Static files are served? await validator.VerifyStaticContentServed(); if (serverType != ServerType.IISExpress) { if (Directory.GetFiles(deploymentParameters.ApplicationPath, "*.cmd", SearchOption.TopDirectoryOnly).Length > 0) { throw new Exception("publishExclude parameter values are not honored."); } } logger.LogInformation("Variation completed successfully."); } } }
public async Task SmokeTestSuite( ServerType serverType, RuntimeFlavor donetFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, bool noSource = false) { var logger = new LoggerFactory() .AddConsole(LogLevel.Information) .CreateLogger($"Smoke:{serverType}:{donetFlavor}:{architecture}"); using (logger.BeginScope("SmokeTestSuite")) { var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var deploymentParameters = new DeploymentParameters( Helpers.GetApplicationPath(), serverType, donetFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "SocialTesting", PublishWithNoSource = noSource, UserAdditionalCleanup = parameters => { if (!Helpers.RunningOnMono && TestPlatformHelper.IsWindows && parameters.ServerType != ServerType.IIS) { // Mono uses InMemoryStore DbUtils.DropDatabase(musicStoreDbName, logger); } } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair <string, string>( "SQLAZURECONNSTR_DefaultConnection", string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) { var deploymentResult = deployer.Deploy(); Helpers.SetInMemoryStoreForIIS(deploymentParameters, logger); var httpClientHandler = new HttpClientHandler() { // Temporary workaround for issue https://github.com/dotnet/corefx/issues/4960 AllowAutoRedirect = false }; var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri), Timeout = TimeSpan.FromSeconds(5) }; // Request to base address and check if various parts of the body are rendered // & measure the cold startup time. var response = await RetryHelper.RetryRequest(async() => { return(await httpClient.GetAsync(string.Empty)); }, logger : logger, cancellationToken : deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); await validator.VerifyHomePage(response); // Verify the static file middleware can serve static content. await validator.VerifyStaticContentServed(); // Making a request to a protected resource should automatically redirect to login page. await validator.AccessStoreWithoutPermissions(); // Register a user - Negative scenario where the Password & ConfirmPassword do not match. await validator.RegisterUserWithNonMatchingPasswords(); // Register a valid user. var generatedEmail = await validator.RegisterValidUser(); await validator.SignInWithUser(generatedEmail, "Password~1"); // Register a user - Negative scenario : Trying to register a user name that's already registered. await validator.RegisterExistingUser(generatedEmail); // Logout from this user session - This should take back to the home page await validator.SignOutUser(generatedEmail); // Sign in scenarios: Invalid password - Expected an invalid user name password error. await validator.SignInWithInvalidPassword(generatedEmail, "InvalidPassword~1"); // Sign in scenarios: Valid user name & password. await validator.SignInWithUser(generatedEmail, "Password~1"); // Change password scenario await validator.ChangePassword(generatedEmail); // SignIn with old password and verify old password is not allowed and new password is allowed await validator.SignOutUser(generatedEmail); await validator.SignInWithInvalidPassword(generatedEmail, "Password~1"); await validator.SignInWithUser(generatedEmail, "Password~2"); // Making a request to a protected resource that this user does not have access to - should // automatically redirect to the configured access denied page await validator.AccessStoreWithoutPermissions(generatedEmail); // Logout from this user session - This should take back to the home page await validator.SignOutUser(generatedEmail); // Login as an admin user await validator.SignInWithUser("*****@*****.**", "YouShouldChangeThisPassword1!"); // Now navigating to the store manager should work fine as this user has // the necessary permission to administer the store. await validator.AccessStoreWithPermissions(); // Create an album var albumName = await validator.CreateAlbum(); var albumId = await validator.FetchAlbumIdFromName(albumName); // Get details of the album await validator.VerifyAlbumDetails(albumId, albumName); // Verify status code pages acts on non-existing items. await validator.VerifyStatusCodePages(); // Get the non-admin view of the album. await validator.GetAlbumDetailsFromStore(albumId, albumName); // Add an album to cart and checkout the same await validator.AddAlbumToCart(albumId, albumName); await validator.CheckOutCartItems(); // Delete the album from store await validator.DeleteAlbum(albumId, albumName); // Logout from this user session - This should take back to the home page await validator.SignOutUser("Administrator"); // Google login await validator.LoginWithGoogle(); // Facebook login await validator.LoginWithFacebook(); // Twitter login await validator.LoginWithTwitter(); // MicrosoftAccountLogin await validator.LoginWithMicrosoftAccount(); logger.LogInformation("Variation completed successfully."); } } }
// TODO: temporarily disabling x86 tests as dotnet xunit test runner currently does not support 32-bit //[ConditionalTheory(Skip = "https://github.com/aspnet/MusicStore/issues/565"), Trait("E2Etests", "E2Etests")] //[OSSkipCondition(OperatingSystems.Windows)] //[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:5043/")] //public async Task OpenIdConnect_OnMono(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) //{ // await OpenIdConnectTestSuite(serverType, runtimeFlavor, architecture, applicationBaseUrl); //} private async Task OpenIdConnectTestSuite(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { using (_logger.BeginScope("OpenIdConnectTestSuite")) { var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { PublishApplicationBeforeDeployment = true, PublishTargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netstandardapp1.5", ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "OpenIdConnectTesting", UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, _logger); } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair<string, string>( MusicStore.StoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler(); var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; // Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger: _logger, cancellationToken: deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, _logger, deploymentResult); await validator.VerifyHomePage(response); // OpenIdConnect login. await validator.LoginWithOpenIdConnect(); _logger.LogInformation("Variation completed successfully."); } } }
public async Task Publish_And_Run_Tests( ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, bool noSource) { var logger = new LoggerFactory() .AddConsole(LogLevel.Warning) .CreateLogger($"Publish:{serverType}:{runtimeFlavor}:{architecture}:{noSource}"); using (logger.BeginScope("Publish_And_Run_Tests")) { var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var connectionString = string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName); var deploymentParameters = new DeploymentParameters( Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, PublishApplicationBeforeDeployment = true, PublishWithNoSource = noSource, UserAdditionalCleanup = parameters => { if (!Helpers.RunningOnMono) { // Mono uses InMemoryStore DbUtils.DropDatabase(musicStoreDbName, logger); } } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair <string, string>( "SQLAZURECONNSTR_DefaultConnection", string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; var httpClient = new HttpClient(httpClientHandler); httpClient.BaseAddress = new Uri(deploymentResult.ApplicationBaseUri); // Request to base address and check if various parts of the body are rendered & // measure the cold startup time. // Add retry logic since tests are flaky on mono due to connection issues var response = await RetryHelper.RetryRequest(async() => { return(await httpClient.GetAsync(string.Empty)); }, logger : logger, cancellationToken : deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); await validator.VerifyHomePage(response); // Static files are served? await validator.VerifyStaticContentServed(); if (serverType != ServerType.IISExpress) { if (Directory.GetFiles( deploymentParameters.ApplicationPath, "*.cmd", SearchOption.TopDirectoryOnly).Length > 0) { throw new Exception("publishExclude parameter values are not honored."); } } logger.LogInformation("Variation completed successfully."); } } }
private async Task OpenIdConnectTestSuite(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { var logger = new LoggerFactory() .AddConsole(LogLevel.Warning) .CreateLogger(string.Format("OpenId:{0}:{1}:{2}", serverType, runtimeFlavor, architecture)); using (logger.BeginScope("OpenIdConnectTestSuite")) { var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var connectionString = string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName); var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "OpenIdConnectTesting", UserAdditionalCleanup = parameters => { if (!Helpers.RunningOnMono && TestPlatformHelper.IsWindows) { // Mono uses InMemoryStore DbUtils.DropDatabase(musicStoreDbName, logger); } } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair <string, string>( "SQLAZURECONNSTR_DefaultConnection", string.Format(DbUtils.CONNECTION_STRING_FORMAT, musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler() { AllowAutoRedirect = false }; var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; // Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = await RetryHelper.RetryRequest(async() => { return(await httpClient.GetAsync(string.Empty)); }, logger : logger, cancellationToken : deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); await validator.VerifyHomePage(response); // OpenIdConnect login. await validator.LoginWithOpenIdConnect(); logger.LogInformation("Variation completed successfully."); } } }
public async Task Publish_And_Run_Tests( ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType, string applicationBaseUrl, bool noSource) { using (_logger.BeginScope("Publish_And_Run_Tests")) { var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters( Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, PublishApplicationBeforeDeployment = true, PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.1", Configuration = Helpers.GetCurrentBuildConfiguration(), ApplicationType = applicationType, UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, _logger); } }; if (applicationType == ApplicationType.Standalone) { deploymentParameters.AdditionalPublishParameters = "-r " + RuntimeEnvironment.GetRuntimeIdentifier(); } // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair <string, string>( MusicStoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _logger)) { var deploymentResult = deployer.Deploy(); var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; var httpClient = new HttpClient(httpClientHandler); httpClient.BaseAddress = new Uri(deploymentResult.ApplicationBaseUri); // Request to base address and check if various parts of the body are rendered & // measure the cold startup time. // Add retry logic since tests are flaky on mono due to connection issues var response = await RetryHelper.RetryRequest(async() => await httpClient.GetAsync(string.Empty), logger : _logger, cancellationToken : deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, _logger, deploymentResult); Console.WriteLine("Verifying home page"); await validator.VerifyHomePage(response); Console.WriteLine("Verifying static files are served from static file middleware"); await validator.VerifyStaticContentServed(); if (serverType != ServerType.IISExpress) { if (Directory.GetFiles( deploymentParameters.ApplicationPath, "*.cmd", SearchOption.TopDirectoryOnly).Length > 0) { throw new Exception("publishExclude parameter values are not honored."); } } _logger.LogInformation("Variation completed successfully."); } } }
public async Task SmokeTestSuite( ServerType serverType, RuntimeFlavor donetFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, bool noSource = false) { using (_logger.BeginScope("SmokeTestSuite")) { var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters( Helpers.GetApplicationPath(), serverType, donetFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "SocialTesting", ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null, SiteName = "MusicStoreTestSite", PublishApplicationBeforeDeployment = true, PublishTargetFramework = donetFlavor == RuntimeFlavor.Clr ? "net451" : "netstandardapp1.5", UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, _logger); } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair<string, string>( MusicStore.StoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _logger)) { var deploymentResult = deployer.Deploy(); Helpers.SetInMemoryStoreForIIS(deploymentParameters, _logger); var httpClientHandler = new HttpClientHandler(); var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri), Timeout = TimeSpan.FromSeconds(5), }; // Request to base address and check if various parts of the body are rendered // & measure the cold startup time. var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger: _logger, cancellationToken: deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, _logger, deploymentResult); await validator.VerifyHomePage(response); // Verify the static file middleware can serve static content. await validator.VerifyStaticContentServed(); // Making a request to a protected resource should automatically redirect to login page. await validator.AccessStoreWithoutPermissions(); // Register a user - Negative scenario where the Password & ConfirmPassword do not match. await validator.RegisterUserWithNonMatchingPasswords(); // Register a valid user. var generatedEmail = await validator.RegisterValidUser(); await validator.SignInWithUser(generatedEmail, "Password~1"); // Register a user - Negative scenario : Trying to register a user name that's already registered. await validator.RegisterExistingUser(generatedEmail); // Logout from this user session - This should take back to the home page await validator.SignOutUser(generatedEmail); // Sign in scenarios: Invalid password - Expected an invalid user name password error. await validator.SignInWithInvalidPassword(generatedEmail, "InvalidPassword~1"); // Sign in scenarios: Valid user name & password. await validator.SignInWithUser(generatedEmail, "Password~1"); // Change password scenario await validator.ChangePassword(generatedEmail); // SignIn with old password and verify old password is not allowed and new password is allowed await validator.SignOutUser(generatedEmail); await validator.SignInWithInvalidPassword(generatedEmail, "Password~1"); await validator.SignInWithUser(generatedEmail, "Password~2"); // Making a request to a protected resource that this user does not have access to - should // automatically redirect to the configured access denied page await validator.AccessStoreWithoutPermissions(generatedEmail); // Logout from this user session - This should take back to the home page await validator.SignOutUser(generatedEmail); // Login as an admin user await validator.SignInWithUser("*****@*****.**", "YouShouldChangeThisPassword1!"); // Now navigating to the store manager should work fine as this user has // the necessary permission to administer the store. await validator.AccessStoreWithPermissions(); // Create an album var albumName = await validator.CreateAlbum(); var albumId = await validator.FetchAlbumIdFromName(albumName); // Get details of the album await validator.VerifyAlbumDetails(albumId, albumName); // Verify status code pages acts on non-existing items. await validator.VerifyStatusCodePages(); // Get the non-admin view of the album. await validator.GetAlbumDetailsFromStore(albumId, albumName); // Add an album to cart and checkout the same await validator.AddAlbumToCart(albumId, albumName); await validator.CheckOutCartItems(); // Delete the album from store await validator.DeleteAlbum(albumId, albumName); // Logout from this user session - This should take back to the home page await validator.SignOutUser("Administrator"); // Google login await validator.LoginWithGoogle(); // Facebook login await validator.LoginWithFacebook(); // Twitter login await validator.LoginWithTwitter(); // MicrosoftAccountLogin await validator.LoginWithMicrosoftAccount(); _logger.LogInformation("Variation completed successfully."); } } }
public async Task RunTests( ServerType serverType, RuntimeFlavor runtimeFlavor, ApplicationType applicationType, RuntimeArchitecture runtimeArchitecture) { var testName = $"PublishAndRunTests_{serverType}_{runtimeFlavor}_{applicationType}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger("Publish_And_Run_Tests"); var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters( Helpers.GetApplicationPath(), serverType, runtimeFlavor, runtimeArchitecture) { PublishApplicationBeforeDeployment = true, PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, TargetFramework = Helpers.GetTargetFramework(runtimeFlavor), Configuration = Helpers.GetCurrentBuildConfiguration(), ApplicationType = applicationType, UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, logger); } }; // Override the connection strings using environment based configuration deploymentParameters.EnvironmentVariables .Add(new KeyValuePair <string, string>( MusicStoreConfig.ConnectionStringKey, DbUtils.CreateConnectionString(musicStoreDbName))); using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { var deploymentResult = await deployer.DeployAsync(); var httpClientHandler = new HttpClientHandler { UseDefaultCredentials = true }; var httpClient = deploymentResult.CreateHttpClient(httpClientHandler); // Request to base address and check if various parts of the body are rendered & // measure the cold startup time. // Add retry logic since tests are flaky on mono due to connection issues var response = await RetryHelper.RetryRequest(() => httpClient.GetAsync(string.Empty), logger, cancellationToken : deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); logger.LogInformation("Verifying home page"); await validator.VerifyHomePage(response); logger.LogInformation("Verifying static files are served from static file middleware"); await validator.VerifyStaticContentServed(); if (serverType != ServerType.IISExpress) { if (Directory.GetFiles( deploymentParameters.ApplicationPath, "*.cmd", SearchOption.TopDirectoryOnly).Length > 0) { throw new Exception("publishExclude parameter values are not honored."); } } logger.LogInformation("Variation completed successfully."); } } }
public static async Task RunTestsAsync(DeploymentResult deploymentResult, ILogger logger) { var httpClientHandler = new HttpClientHandler(); var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri), Timeout = TimeSpan.FromSeconds(5), }; using (httpClient) { // Request to base address and check if various parts of the body are rendered // & measure the cold startup time. var response = await RetryHelper.RetryRequest(async () => { return await httpClient.GetAsync(string.Empty); }, logger, cancellationToken: deploymentResult.HostShutdownToken); Assert.False(response == null, "Response object is null because the client could not " + "connect to the server after multiple retries"); var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult); Console.WriteLine("Verifying home page"); await validator.VerifyHomePage(response); Console.WriteLine("Verifying static files are served from static file middleware"); await validator.VerifyStaticContentServed(); Console.WriteLine("Verifying access to a protected resource should automatically redirect to login page."); await validator.AccessStoreWithoutPermissions(); Console.WriteLine("Verifying mismatched passwords trigger validaton errors during user registration"); await validator.RegisterUserWithNonMatchingPasswords(); Console.WriteLine("Verifying valid user registration"); var generatedEmail = await validator.RegisterValidUser(); Console.WriteLine("Verifying duplicate user email registration"); await validator.RegisterExistingUser(generatedEmail); Console.WriteLine("Verifying incorrect password login"); await validator.SignInWithInvalidPassword(generatedEmail, "InvalidPassword~1"); Console.WriteLine("Verifying valid user log in"); await validator.SignInWithUser(generatedEmail, "Password~1"); Console.WriteLine("Verifying change password"); await validator.ChangePassword(generatedEmail); Console.WriteLine("Verifying old password is not valid anymore"); await validator.SignOutUser(generatedEmail); await validator.SignInWithInvalidPassword(generatedEmail, "Password~1"); await validator.SignInWithUser(generatedEmail, "Password~2"); Console.WriteLine("Verifying authenticated user trying to access unauthorized resource"); await validator.AccessStoreWithoutPermissions(generatedEmail); Console.WriteLine("Verifying user log out"); await validator.SignOutUser(generatedEmail); Console.WriteLine("Verifying admin user login"); await validator.SignInWithUser("*****@*****.**", "YouShouldChangeThisPassword1!"); Console.WriteLine("Verifying admin user's access to store manager page"); await validator.AccessStoreWithPermissions(); Console.WriteLine("Verifying creating a new album"); var albumName = await validator.CreateAlbum(); var albumId = await validator.FetchAlbumIdFromName(albumName); Console.WriteLine("Verifying retrieved album details"); await validator.VerifyAlbumDetails(albumId, albumName); Console.WriteLine("Verifying status code pages for non-existing items"); await validator.VerifyStatusCodePages(); Console.WriteLine("Verifying non-admin view of an album"); await validator.GetAlbumDetailsFromStore(albumId, albumName); Console.WriteLine("Verifying adding album to a cart"); await validator.AddAlbumToCart(albumId, albumName); Console.WriteLine("Verifying cart checkout"); await validator.CheckOutCartItems(); Console.WriteLine("Verifying deletion of album from a cart"); await validator.DeleteAlbum(albumId, albumName); Console.WriteLine("Verifying administrator log out"); await validator.SignOutUser("Administrator"); Console.WriteLine("Verifying Google login scenarios"); await validator.LoginWithGoogle(); Console.WriteLine("Verifying Facebook login scenarios"); await validator.LoginWithFacebook(); Console.WriteLine("Verifying Twitter login scenarios"); await validator.LoginWithTwitter(); Console.WriteLine("Verifying Microsft login scenarios"); await validator.LoginWithMicrosoftAccount(); logger.LogInformation("Variation completed successfully."); } }