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"); } using (new TestTransaction(TestContext, "ConfirmShipAndInvoice")) { ClientLogicalForm dialog = userContext.CatchDialog(postConfirmationDialog.Action("OK").Invoke); if (dialog != null) { // The order has been posted and moved to the posted invoices tab, do you want to open... dialog.Action("No").Invoke(); } } }
public static void InvokeActionAndCloseAnyDialog( TestContext context, UserContext userContext, Action action, string closeDialogAction = "Yes") { var dialog = userContext.CatchDialog(action); if (dialog != null) { try { var dialogAction = dialog.Action(closeDialogAction); if (dialogAction != null) { dialogAction.Invoke(); context.WriteLine($"Dialog Caption: {dialog.Caption} Message: {dialog.FindMessage()} was closed with Action: {closeDialogAction}."); } } catch (InvalidOperationException) { context.WriteLine($"Dialog Caption: {dialog.Caption} Message: {dialog.FindMessage()} Action: {closeDialogAction} was not found."); throw; } } }
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); } } }
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"); } using (new TestTransaction(TestContext, "ConfirmShipAndInvoice")) { ClientLogicalForm dialog = userContext.CatchDialog(postConfirmationDialog.Action("OK").Invoke); if (dialog != null) { // after confiming the post we dont expect more dialogs Assert.Fail("Unexpected Dialog on Post - Caption: {0} Message: {1}", dialog.Caption, dialog.FindMessage()); } } }
/// <summary> /// Save the specified value with entry delay and ignore any warning dialogs /// </summary> /// <param name="context">the current test contest</param> /// <param name="userContext">the user context</param> /// <param name="control">the control to be updated</param> /// <param name="value">the value</param> /// <param name="ignoreAction">the name of the action, default is Yes</param> public static void SaveValueAndIgnoreWarning(TestContext context, UserContext userContext, ClientLogicalControl control, string value, string ignoreAction = "Yes") { var dialog = userContext.CatchDialog(() => SaveValueWithDelay(control, value)); if (dialog != null) { try { var action = dialog.Action(ignoreAction); if (action != null) { action.Invoke(); context.WriteLine("Dialog Caption: {0} Message: {1} was ignored with Action: {2} ", dialog.Caption, dialog.FindMessage(), ignoreAction); } } catch (InvalidOperationException) { context.WriteLine("Dialog Caption: {0} Message: {1} Action: {2} was not found.", dialog.Caption, dialog.FindMessage(), ignoreAction); throw; } } }