public Complete_AddClientCase(Application app, Model_AddClientCase clientDetails) { application = app; List <Window> windows = windowTools.GetWindows(application); Window window = windowTools.GetWindow(windows, "AddClientCase"); UIItemCollection items = windowTools.GetWindowItems(window); windowTools.PostToComboBoxes(items, clientDetails.mandatoryComboBoxes); windowTools.PostToTextBoxes(items, clientDetails.mandatoryTextBoxes); windowTools.PostToDatePicker(items, clientDetails.mandatoryDatePickers, window); windowTools.PostToTextBoxes(items, clientDetails.optionalTextBoxes); windowTools.PostToComboBoxes(items, clientDetails.optionalComboBoxes); windowTools.PostToDatePicker(items, clientDetails.optionalDatePickers, window); //Note: GeoCode cannot be manually entered, code below solves issue window.Items[26].DoubleClick(); //Find button sets GeoCode after address details are entered windows = application.GetWindows(); //Find EditAddressFindByMap windows[3].Items[1].DoubleClick(); //DoubleClick OkButton Button okButton = windowTools.GetButton(window, SearchCriteria.ByAutomationId("okButton")); windowTools.DoubleClickIUItem(okButton); }
private void Test_CreateNewClient() { string facilityName = "CBI Toronto Yonge"; start = _report.getNow(); new TestStackTest.Views.Login(_application, new TestStackTest.Commands.LoginDefault()); _report.createReportItem("System Login - Create New Client", start); start = _report.getNow(); new TestStackTest.Views.SelectFacility(_application, new TestStackTest.Commands.SelectFacilityDefault(), facilityName); _report.createReportItem("Select Facility - Create New Client", start); start = _report.getNow(); new TestStackTest.Views.Desktop(_application, new TestStackTest.Commands.Desktop_ClickButton(), 0); _report.createReportItem("Click Desktop Client Button- Create New Client", start); start = _report.getNow(); new TestStackTest.Views.ClientCaseSearch(_application, new TestStackTest.Commands.ClientCaseSearch_SearchLastName(), "ZZZZZZZZZZZZZZZZZZZZZZZZZZZ"); _report.createReportItem("Search For Unkown Client - Create New Client", start); // the step above should result in a message box appearing saying that no user of that name has been found, but if it doesn't open skip closing it if (_application.GetWindows().Count == 3) { start = _report.getNow(); new TestStackTest.Views.MessageBox(_application, new TestStackTest.Commands.MessageBoxDefault()); _report.createReportItem("Close Unknown Client Modal Message Box - Create New Client", start); } start = _report.getNow(); new TestStackTest.Views.ClientCaseSearch(_application, new TestStackTest.Commands.ClientCaseSearch_ClickAddNewClientButton()); _report.createReportItem("Click Add New Client Button - Create New Client", start); //the section below is data driven, and contains the older style of assembly, keep it until it can be refactored start = _report.getNow(); ExcelReader excelReader = new ExcelReader(testDataLocation); ExcelReader.ReturnObject dataSet = excelReader.ReadSheet(1, 51); _report.createReportItem("Read Test Data Set - Create New Client", start); start = _report.getNow(); Model_AddClientCase clientDetails = new Model_AddClientCase(dataSet.results[0], dataSet.headers); _report.createReportItem("Create New Client Data Model - Create New Client", start); //set client last name test global to be used in all _clientLastName = clientDetails.mandatoryTextBoxes["lastName"]; start = _report.getNow(); new Complete_AddClientCase(_application, clientDetails); _report.createReportItem("Fill Add New Client Form - Create New Client", start); start = _report.getNow(); new ShutDownSystemUnderTest(_application); _report.createReportItem("Shutdown - Create New Client", start); }