Ejemplo n.º 1
0
        public static string SelectRandomRecord(
            ClientLogicalForm form,
            string keyFieldCaption)
        {
            // selects a random row from the repeater
            var rowCount    = form.Repeater().DefaultViewport.Count;
            var rowToSelect = SafeRandom.GetRandomNext(rowCount);
            var rowControl  = form.Repeater().DefaultViewport[rowToSelect];
            var randomKey   = rowControl.Control(keyFieldCaption).StringValue;

            return(randomKey);
        }
        private void AddSalesOrderLine(UserContext userContext, ClientLogicalForm newSalesOrderPage, int line)
        {
            // Get Line
            var itemsLine = newSalesOrderPage.Repeater().DefaultViewport[line];

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

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

            // Set Item No.
            var itemNo = TestScenario.SelectRandomRecordFromListPage(TestContext, ItemListPageId, userContext, "No.");

            TestScenario.SaveValueWithDelay(itemsLine.Control("No."), itemNo);

            string 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);
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public static string SelectRandomRecord(
     ClientLogicalForm form,
     string keyFieldCaption)
 {
     // selects a random row from the repeater
     var rowCount = form.Repeater().DefaultViewport.Count;
     var rowToSelect = SafeRandom.GetRandomNext(rowCount);
     var rowControl = form.Repeater().DefaultViewport[rowToSelect];
     var randomKey = rowControl.Control(keyFieldCaption).StringValue;
     return randomKey;
 }
Ejemplo n.º 6
0
        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);
        }