[SysTestCaseDataDependencyAttribute("USMF"),SysCodeGenAttribute()]
class Sales_Order_Confirmation extends SysTestCase
{
protected SalesTableListPageFormAdaptor SalesTableListPageForm;
protected SalesCreateOrderFormAdaptor SalesCreateOrderForm;
protected str SalesCreateOrder_SalesTable_CustAccount;
protected container SalesCreateOrder_General_General;
protected str SalesCreateOrder_SalesTable_SalesId_Copy;
protected FormAdaptor SalesTable_InventSiteId_LookupForm;
protected container SalesTable_InventSiteId_Lookup_Grid_Grid;
protected FormAdaptor SalesTable_InventLocationId_LookupForm;
protected container SalesTable_InventLocationId_Lookup_Grid_Grid;
protected SalesTableFormAdaptor SalesTableForm;
protected str SalesTable_SalesLine_ItemId;
protected FormAdaptor SalesLine_ItemId_LookupForm;
protected FormAdaptor SalesLine_ItemId_LookupForm1;
protected SalesTotalsFormAdaptor SalesTotalsForm;
protected real SalesTotals_SumTax;
protected SalesEditLinesFormAdaptor SalesEditLinesForm;
public void SetUpTestCase()
{
super();
this.setupData();
}
[SysCodeGenAttribute()]
protected void setupData()
{
SalesCreateOrder_SalesTable_CustAccount = "US-010";
SalesCreateOrder_General_General = ["0"];
SalesTable_InventSiteId_Lookup_Grid_Grid = ["2","4","1","first"];
SalesTable_InventLocationId_Lookup_Grid_Grid = ["3","4","1","first"];
SalesTable_SalesLine_ItemId = "D0001";
SalesTotals_SumTax = 30;
}
[SysCodeGenAttribute(),SysTestMethodAttribute()]
public void testMethod()
{
using (var c = ClientContext::create())
{
//Go to Accounts receivable > Orders > All sales orders.
using (var c1 = c.navigate(menuItemDisplayStr(salestablelistpage),formStr(SalesTableListPage),Microsoft.Dynamics.TestTools.Dispatcher.MenuItemType::Display))
{
SalesTableListPageForm = c1.form();
using (var c2 = c1.action("SystemDefinedNewButton_Click"))
{
//Click New.
SalesTableListPageForm.systemDefinedNewButton().click();
using (var c3 = c2.attach(formStr(SalesCreateOrder)))
{
SalesCreateOrderForm = c3.form();
//In the Customer account field, type a value.
SalesCreateOrderForm.SalesTable_CustAccount().setValue(SalesCreateOrder_SalesTable_CustAccount);
//Expand the General section.
SalesCreateOrderForm.General().activate(conPeek(SalesCreateOrder_General_General,1));
//Note the value in the Sales order field to reference later
SalesCreateOrder_SalesTable_SalesId_Copy = SalesCreateOrderForm.SalesTable_SalesId().getValue();
using (var c4 = c3.action("SalesTable_InventSiteId_RequestPopup"))
{
//In the Site field, enter or select a value.
SalesCreateOrderForm.SalesTable_InventSiteId().openLookup();
using (var c5 = c4.attachPrivate(""))
{
SalesTable_InventSiteId_LookupForm = c5.form();
//In the list, select row 2.
SalesTable_InventSiteId_LookupForm.getGrid("Grid").changeRowInCache(SalesTable_InventSiteId_Lookup_Grid_Grid);
//In the list, click the link in the selected row.
SalesTable_InventSiteId_LookupForm.getGrid("Grid").selectRecord();
}
}
using (var c6 = c3.action("SalesTable_InventLocationId_RequestPopup"))
{
//In the Warehouse field, enter or select a value.
SalesCreateOrderForm.SalesTable_InventLocationId().openLookup();
using (var c7 = c6.attachPrivate(""))
{
SalesTable_InventLocationId_LookupForm = c7.form();
//In the list, select row 3.
SalesTable_InventLocationId_LookupForm.getGrid("Grid").changeRowInCache(SalesTable_InventLocationId_Lookup_Grid_Grid);
//In the list, click the link in the selected row.
SalesTable_InventLocationId_LookupForm.getGrid("Grid").selectRecord();
}
}
//Click OK.
SalesCreateOrderForm.OK().click();
using (var c8 = c3.attach(formStr(SalesTable)))
{
SalesTableForm = c8.form();
//In the Item number field, enter or select a value.
SalesTableForm.SalesLine_ItemId().openLookup();
//In the Item number field, type a value.
SalesTableForm.SalesLine_ItemId().setValue(SalesTable_SalesLine_ItemId);
using (var c9 = c8.attachPrivate(""))
{
SalesLine_ItemId_LookupForm = c9.form();
//Close the page.
SalesLine_ItemId_LookupForm.close();
}
//In the list, mark the selected row.
SalesTableForm.SalesLineGrid().markActiveRow();
using (var c10 = c8.action("SalesLine_ItemId_RequestPopup"))
{
//In the Item number field, enter or select a value.
SalesTableForm.SalesLine_ItemId().openLookup();
using (var c11 = c10.attachPrivate(""))
{
SalesLine_ItemId_LookupForm1 = c11.form();
//Close the page.
SalesLine_ItemId_LookupForm1.close();
}
}
//On the Action Pane, click Sell.
SalesTableForm.Sell().activate();
//On the Action Pane, click Sales order.
SalesTableForm.SalesOrder().activate();
using (var c12 = c8.action("ButtonTotals_Click"))
{
//Click Totals.
SalesTableForm.ButtonTotals().click();
using (var c13 = c12.attach(formStr(SalesTotals)))
{
SalesTotalsForm = c13.form();
//Validate that the value for Sales tax is '30.0000000000000000'.
this.assertEquals(SalesTotals_SumTax,SalesTotalsForm.SumTax().getValue(),"Assertion failed for control SumTax on form SalesTotals");
//Click OK.
SalesTotalsForm.OKButton().click();
}
}
//On the Action Pane, click Sell.
SalesTableForm.Sell().activate();
using (var c14 = c8.action("buttonUpdateConfirmation_Click"))
{
//Click Confirm sales order.
SalesTableForm.buttonUpdateConfirmation().click();
using (var c15 = c14.attach(formStr(SalesEditLines)))
{
SalesEditLinesForm = c15.form();
//Click OK.
SalesEditLinesForm.OK().click();
}
}
}
}
}
}
}
}
}
I Have imported task recording for confirmation of a sales order , using import task recorder add in under D365 Extension in VScode ,
from 45 to 51 , is it possibe to add Cases using excel fike (i.e read values from excel file ) in the same class

Report
All responses (
Answers (