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);
        }
Beispiel #2
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);
            }
        }
Beispiel #3
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);
        }
        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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        private ClientLogicalForm CreateNewPurchaseInvoice(UserContext userContext)
        {
            // Invoke using the Purchase Invoice action on Role Center and catch the new page
            var newPurchaseInvoicePage = userContext.EnsurePage(
                MiniPurchaseInvoiceCard,
                userContext.RoleCenterPage.Action("Purchase Invoice")
                .InvokeCatchForm());

            var vendorName = TestScenario.SelectRandomRecordFromListPage(
                TestContext,
                userContext,
                MiniVendorList,
                "Name");

            TestScenario.SaveValueAndIgnoreWarning(
                TestContext,
                userContext,
                newPurchaseInvoicePage.Control("Vendor Name"),
                vendorName);

            var vendorInvoiceNo = SafeRandom.GetRandomNext(100000, 999999);

            TestScenario.SaveValueWithDelay(
                newPurchaseInvoicePage.Control("Vendor Invoice No."),
                vendorInvoiceNo);

            // Add a random number of lines between 2 and 15
            var noOfLines = SafeRandom.GetRandomNext(2, 15);

            for (var line = 0; line < noOfLines; line++)
            {
                AddPurchaseInvoiceLine(userContext, newPurchaseInvoicePage, line);
            }

            userContext.ValidateForm(newPurchaseInvoicePage);
            TestContext.WriteLine(
                "Created Purchase Invoice {0}",
                newPurchaseInvoicePage.Caption);
            return(newPurchaseInvoicePage);
        }