private static void EditCustomer() { Console.WriteLine("Begin CustomerDetails for Edit View"); var view = Proxy.GetValue(ShopsContainer.GetEntityView(_customerId, "Details", "EditCustomer", string.Empty)); view.Should().NotBeNull(); view.Properties.Should().NotBeEmpty(); view.Action.Should().Be("EditCustomer"); view.Properties.Should().NotBeEmpty(); view.Properties.FirstOrDefault(p => p.Name.Equals("Language")).Value = "fr-FR"; view.Properties.FirstOrDefault(p => p.Name.Equals("FirstName")).Value = "Jane"; view.Properties.FirstOrDefault(p => p.Name.Equals("LastName")).Value = "Doe"; view.Properties.FirstOrDefault(p => p.Name.Equals("IncludedTags")).Value = "['First Tag', 'Second Tag']"; var action = Proxy.DoCommand(ShopsContainer.DoAction(view)); action.Messages.Any(m => m.Code.Equals("error", StringComparison.OrdinalIgnoreCase) || m.Code.Equals("validationerror", StringComparison.OrdinalIgnoreCase)).Should().BeFalse(); var customer = CustomersUX.GetCustomer(ShopsContainer, _customerId); customer.Should().NotBeNull(); customer.UserName.Should().Be(_customerUserName); customer.Tags.Count.Should().Be(2); customer.Components.OfType <CustomerDetailsComponent>().Should().NotBeEmpty(); customer.Components.OfType <CustomerDetailsComponent>().FirstOrDefault().View.ChildViews.Should().NotBeEmpty(); customer.Components.OfType <CustomerDetailsComponent>().FirstOrDefault().View.ChildViews.FirstOrDefault().Should().BeOfType <EntityView>(); var details = customer.Components.OfType <CustomerDetailsComponent>().FirstOrDefault().View.ChildViews.FirstOrDefault() as EntityView; details.Properties.Should().NotBeEmpty(); }
private static Customer ValidateCustomer(ShopperContext context, string customerId) { var customer = CustomersUX.GetCustomer(context.ShopsContainer(), customerId); customer.Should().NotBeNull(); customer.Components.OfType <EntitlementsComponent>().Any().Should().BeTrue(); var entitlementsComponent = customer.Components.OfType <EntitlementsComponent>().FirstOrDefault(); entitlementsComponent.Should().NotBeNull(); entitlementsComponent?.Entitlements.Should().NotBeEmpty(); entitlementsComponent?.Entitlements.All(e => !string.IsNullOrEmpty(e.EntityTarget)).Should().BeTrue(); return(customer); }
private static void BuyGiftCardAuthenticated(ShopperContext context) { using (new SampleMethodScope()) { var customerId = CustomersUX.AddCustomer(CustomersUX.GenerateRandomUserName()); customerId.Should().NotBeNullOrEmpty(); context.CustomerId = customerId; context.ShopperId = customerId; context.IsRegistered = true; var orderId = Scenarios.BuyGiftCard.Run(context, 1); orderId.Should().NotBeNull(); RunMinions(context); var order = ValidateOrder(context, orderId); var customer = ValidateCustomer(context, customerId); ValidateEntitlements(context, order, customer, 1, typeof(GiftCard)); } }
static void Main(string[] args) { try { OpsServiceUri = Properties.Settings.Default.OpsServiceUri; ShopsServiceUri = Properties.Settings.Default.ShopsServiceUri; MinionsServiceUri = Properties.Settings.Default.MinionsServiceUri; AuthoringServiceUri = Properties.Settings.Default.AuthoringServiceUri; SitecoreIdServerUri = Properties.Settings.Default.SitecoreIdServerUri; UserName = Properties.Settings.Default.UserName; Password = Properties.Settings.Default.Password; SitecoreTokenRaw = SitecoreIdServerAuth.GetToken(); SitecoreToken = $"Bearer {SitecoreTokenRaw}"; var stopwatch = new Stopwatch(); stopwatch.Start(); Console.ForegroundColor = ConsoleColor.Cyan; if (ShouldBootstrapOnLoad) { Bootstrapping.RunScenarios(); Content.RunScenarios(); } if (ShouldDevOpsScenarios) { Environments.RunScenarios(); Plugins.RunScenarios(); Entities.RunScenarios(); Policies.RunScenarios(); Caching.RunScenarios(); } if (ShouldRunCatalogScenarios) { Catalogs.RunScenarios(); CatalogsUX.RunScenarios(); Categories.RunScenarios(); CategoriesUX.RunScenarios(); // TODO: contains failing tests SellableItems.RunScenarios(); SellableItemsUX.RunScenarios(); } if (ShouldRunPricingScenarios) { Pricing.RunScenarios(); PricingUX.RunScenarios(); } if (ShouldRunPromotionsScenarios) { Promotions.RunScenarios(); PromotionsUX.RunScenarios(); PromotionsRuntime.RunScenarios(); Rules.RunScenarios(); Coupons.RunScenarios(); CouponsUX.RunScenarios(); } if (ShouldRunInventoryScenarios) { Inventory.RunScenarios(); InventoryUX.RunScenarios(); } if (ShouldRunOrdersScenarios) { Fulfillments.RunScenarios(); Payments.RunScenarios(); PaymentsFederated.RunScenarios(); Carts.RunScenarios(); Returns.RunScenarios(); OrdersUX.RunScenarios(); Orders.RunScenarios(); Shipments.RunScenarios(); // ORDERS HAVE TO BE RELEASED FOR SHIPMENTS TO GET GENERATED } if (ShouldRunCustomersScenarios) { CustomersUX.RunScenarios(); } if (ShouldRunEntitlementsScenarios) { Entitlements.RunScenarios(); } if (ShouldRunSearchScenarios) { Search.RunScenarios(); } if (ShouldRunBusinessUsersScenarios) { ComposerUX.RunScenarios(); // Composer.RunScenarios(); } if (ShouldRunVersionScenarios) { Versions.RunScenarios(); } stopwatch.Stop(); Console.WriteLine($"Test Runs Complete - {stopwatch.ElapsedMilliseconds} ms - (Hit any key to continue)"); if (DemoStops) { Console.ReadKey(); } } catch (Exception ex) { ConsoleExtensions.WriteErrorLine("An unexpected exception occurred."); ConsoleExtensions.WriteErrorLine(ex.ToString()); } Console.WriteLine("done."); }