private void PostSalesOrder(UserContext userContext, ClientLogicalForm newSalesOrderPage) { ClientLogicalForm postConfirmationDialog; using (new TestTransaction(TestContext, "Post")) { postConfirmationDialog = newSalesOrderPage.Action("Post...").InvokeCatchDialog(); } if (postConfirmationDialog == null) { userContext.ValidateForm(newSalesOrderPage); Assert.Inconclusive("Post dialog can't be found"); } ClientLogicalForm openPostedInvoiceDialog; using (new TestTransaction(TestContext, "ConfirmShipAndInvoice")) { openPostedInvoiceDialog = userContext.CatchDialog(postConfirmationDialog.Action("OK").Invoke); } ClientLogicalForm postedInvoicePage; using (new TestTransaction(TestContext, "OpenPostedInvoice")) { if (openPostedInvoiceDialog != null) { postedInvoicePage = userContext.CatchForm(openPostedInvoiceDialog.Action("Yes").Invoke); var newSalesInvoiceNo = postedInvoicePage.Control("No.").StringValue; TestContext.WriteLine("Posted Sales Invoice No. {0}", newSalesInvoiceNo); TestScenario.ClosePage(TestContext, userContext, postedInvoicePage); } } }
public void RunCreateAndPostSalesOrder(UserContext userContext) { // select a random customer var custno = TestScenario.SelectRandomRecordFromListPage(TestContext, CustomerListPageId, userContext, "No."); // select a random activity code, mandatory for sales order posting var actcode = TestScenario.SelectRandomRecordFromListPage(TestContext, ActivityCodePageId, userContext, "Code"); // Invoke using the new sales order action on Role Center var newSalesOrderPage = userContext.EnsurePage(SalesOrderPageId, userContext.RoleCenterPage.Action("Sales Order").InvokeCatchForm()); // Start in the No. field newSalesOrderPage.Control("No.").Activate(); // Navigate to Customer field in order to create record newSalesOrderPage.Control("Customer No.").Activate(); var newSalesOrderNo = newSalesOrderPage.Control("No.").StringValue; TestContext.WriteLine("Created Sales Order No. {0}", newSalesOrderNo); // Set Customer to a Random Customer and ignore any credit warning TestScenario.SaveValueAndIgnoreWarning(TestContext, userContext, newSalesOrderPage.Control("Customer No."), custno); // Set Selected Activity Code TestScenario.SaveValueAndIgnoreWarning(TestContext, userContext, newSalesOrderPage.Control("Activity Code"), actcode); //TestScenario.SaveValueWithDelay(newSalesOrderPage.Control("External Document No."), custno); userContext.ValidateForm(newSalesOrderPage); // Add a random number of lines between 2 and 5 int noOfLines = SafeRandom.GetRandomNext(2, 6); for (int line = 0; line < noOfLines; line++) { AddSalesOrderLine(userContext, newSalesOrderPage, line); } // Check Validation errors userContext.ValidateForm(newSalesOrderPage); PostSalesOrder(userContext, newSalesOrderPage); // Close the page TestScenario.ClosePage(TestContext, userContext, newSalesOrderPage); }
private void PostPurchaseInvoice( UserContext userContext, ClientLogicalForm purchaseInvoicePage) { ClientLogicalForm openPostedInvoiceDialog; using (new TestTransaction(TestContext, "Post")) { var postConfirmationDialog = purchaseInvoicePage.Action("Post") .InvokeCatchDialog(); if (postConfirmationDialog == null) { userContext.ValidateForm(purchaseInvoicePage); Assert.Fail("Confirm Post dialog not found"); } openPostedInvoiceDialog = postConfirmationDialog.Action("Yes") .InvokeCatchDialog(); } if (openPostedInvoiceDialog == null) { Assert.Fail("Open Posted Invoice dialog not found"); } ClientLogicalForm postedPurchaseInvoicePage; using (new TestTransaction(TestContext, "OpenPostedPurchaseInvoice")) { postedPurchaseInvoicePage = userContext.EnsurePage( PostedPurchaseInvoiceCard, openPostedInvoiceDialog.Action("Yes").InvokeCatchForm()); } TestContext.WriteLine( "Posted Purchase Invoice {0}", postedPurchaseInvoicePage.Caption); TestScenario.ClosePage( TestContext, userContext, postedPurchaseInvoicePage); }
public void RunCreateAndPostSalesOrder(UserContext userContext) { // Invoke using the new sales order action on Role Center var newSalesOrderPage = userContext.EnsurePage(SalesOrderPageId, userContext.RoleCenterPage.Action("Sales Order").InvokeCatchForm()); // Start in the No. field newSalesOrderPage.Control("No.").Activate(); // Navigate to Sell-to Customer No. field in order to create record var custNameControl = newSalesOrderPage.Control("Customer Name"); custNameControl.Activate(); // select a random customer from Sell-to Customer No. lookup var custName = TestScenario.SelectRandomRecordFromLookup(TestContext, userContext, custNameControl, "Name"); // Set Customer Name to a Random Customer and ignore any credit warning TestScenario.SaveValueAndIgnoreWarning(TestContext, userContext, custNameControl, custName); TestScenario.SaveValueWithDelay(newSalesOrderPage.Control("External Document No."), custName); var newSalesOrderNo = newSalesOrderPage.Control("No.").StringValue; userContext.ValidateForm(newSalesOrderPage); TestContext.WriteLine("Created Sales Order No. {0} for Customer {1}", newSalesOrderNo, custName); // Add a random number of lines between 2 and 25 var noOfLines = SafeRandom.GetRandomNext(2, 25); for (var line = 0; line < noOfLines; line++) { AddSalesOrderLine(userContext, newSalesOrderPage, line); } // Check Validation errors userContext.ValidateForm(newSalesOrderPage); // Post the order PostSalesOrder(userContext, newSalesOrderPage); // Close the page TestScenario.ClosePage(TestContext, userContext, newSalesOrderPage); }