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); }
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); }