예제 #1
0
 public static void ClosePage(TestContext testContext, UserContext context, ClientLogicalForm form)
 {
     if (form.State == ClientLogicalFormState.Open)
     {
         using (new TestTransaction(testContext, String.Format("ClosePage{0}", UserContext.GetActualPageNo(form))))
         {
             context.InvokeInteraction(new CloseFormInteraction(form));
         }
     }
 }
예제 #2
0
 public static void ApplyColumnFilter(
     TestContext testContext,
     UserContext userContext,
     ClientRepeaterColumnControl column,
     string value)
 {
     using (new TestTransaction(testContext, "FilterBy" + column.Caption))
     {
         var filterForm = column.Action("Filter...").InvokeCatchDialog();
         var filterControl = filterForm.Control(column.Caption);
         filterControl.SaveValue(value);
         userContext.InvokeInteraction(
             new InvokeActionInteraction(
                 filterForm.Action("OK")));
     }
 }
        private void AddPurchaseInvoiceLine(
            UserContext userContext,
            ClientLogicalForm purchaseInvoicePage,
            int index)
        {
            using (new TestTransaction(TestContext, "AddPurchaseInvoiceLine"))
            {
                var repeater = purchaseInvoicePage.Repeater();
                var rowCount = repeater.Offset + repeater.DefaultViewport.Count;
                if (index >= rowCount)
                {
                    // scroll to the next viewport
                    userContext.InvokeInteraction(
                        new ScrollRepeaterInteraction(repeater, 1));
                }

                var rowIndex = (int) (index - repeater.Offset);
                var itemsLine = repeater.DefaultViewport[rowIndex];

                // select random Item No. from  lookup
                var itemNoControl = itemsLine.Control("Item No.");
                var itemNo = TestScenario.SelectRandomRecordFromLookup(
                    TestContext,
                    userContext,
                    itemNoControl,
                    "No.");
                TestScenario.SaveValueWithDelay(itemNoControl, itemNo);

                var qtyToOrder = SafeRandom.GetRandomNext(1, 10);
                TestScenario.SaveValueWithDelay(itemsLine.Control("Quantity"), qtyToOrder);
            }
        }
        private void AddSalesOrderLine(UserContext userContext, ClientLogicalForm newSalesOrderPage, int index)
        {
            var repeater = newSalesOrderPage.Repeater();
            var rowCount = repeater.Offset + repeater.DefaultViewport.Count;
            if (index >= rowCount)
            {
                // scroll to the next viewport
                userContext.InvokeInteraction(new ScrollRepeaterInteraction(repeater, 1));
            }

            var rowIndex = (int)(index - repeater.Offset);
            var itemsLine = repeater.DefaultViewport[rowIndex];

            // Activate Type field
            itemsLine.Control("Type").Activate();

            // set Type = Item
            TestScenario.SaveValueWithDelay(itemsLine.Control("Type"), "Item");

            // Set Item No. from random lookup
            var itemNoControl = itemsLine.Control("No.");
            var itemNo = TestScenario.SelectRandomRecordFromLookup(TestContext, userContext, itemNoControl, "No.");
            TestScenario.SaveValueWithDelay(itemNoControl, itemNo);

            var qtyToOrder = SafeRandom.GetRandomNext(1, 10).ToString(CultureInfo.InvariantCulture);

            TestScenario.SaveValueAndIgnoreWarning(TestContext, userContext, itemsLine.Control("Quantity"), qtyToOrder);

            TestScenario.SaveValueAndIgnoreWarning(TestContext, userContext, itemsLine.Control("Qty. to Ship"), qtyToOrder, "OK");

            // Look at the line for 1 seconds.
            DelayTiming.SleepDelay(DelayTiming.ThinkDelay);
        }