public int SearchExpense(TestData data) { var resultRows = -1; Log.Information("In SearchExpense..."); try { WaitForProgressToComplete(); Thread.Sleep(20000); // Workaround - No Progress Bar TestDataSheet expenseRows = data.Get("Expense"); GetElement(SearchProject).SelectComboValue(expenseRows.Value(0, "ProjectName")); WaitForProgressToComplete(); GetElement(SearchEmployee).SelectComboValue(expenseRows.Value(0, "EmployeeName")); WaitForProgressToComplete(); GetElement(SearchYear).SelectComboValue(expenseRows.Value(0, "SearchYear")); WaitForProgressToComplete(3); if (IsElementPresent(ExpenseTable)) { resultRows = GetElement(ExpenseTable).GetTableRows().Count; } } catch (Exception ex) { throw ex; } Log.Information("End of SearchExpense..."); return(resultRows); }
public void CreateNewProject(TestDataSheet data) { Log.Information("In CreateProject..."); WaitForProgressToComplete(5); GetElement(ProjectName).EnterText(data.Value(0, "ProjectName")); GetElement(ProjectShortName).EnterText(data.Value(0, "ProjectShortName")); GetElement(Client).SelectComboValue(data.Value(0, "Client")); GetElement(StartDate).EnterText(data.Value(0, "StartDate")); Thread.Sleep(3000); // Workaround GetElement(DurationType).SelectComboValue(data.Value(0, "DurationType")); GetElement(Duration).EnterText(data.Value(0, "Duration")); GetElement(ProjectDescription).SendKeys(Keys.Tab); GetElement(Next).ClickIt(); var purhcaseOrderFile = Path.Combine(ConfigManager.DataFolder, data.Value(0, "PurchaseOrderFile")); SelectFile(PurchaseOrder, purhcaseOrderFile); GetElement(Rate).EnterText(data.Value(0, "Rate")); GetElement(Weekends).MultiSelectComboValues(data.Value(0, "Weekends").Split(',')); GetElement(Next).ClickIt(); GetElement(HomeAddress1).EnterText(data.Value(0, "HomeAddress1")); GetElement(HomeAddress2).EnterText(data.Value(0, "HomeAddress2")); GetElement(HomeCountry).SelectComboValue(data.Value(0, "HomeCountry")); GetElement(HomeCity).EnterText(data.Value(0, "HomeCity")); GetElement(HomeZip).EnterText(data.Value(0, "HomeZip")); GetElement(Next).ClickIt(); GetElement(Submit).ClickIt(); WaitForProgressToComplete(10); Log.Information("End of CreateProject"); }
public void EditExpense(TestData data) { Log.Information("In EditExpense..."); try { TestDataSheet expenseRows = data.Get("Expense"); int searchRows = SearchExpense(data); if (searchRows > 0) { var searchCriteria = String.Format("Consultant={0}", expenseRows.Value(0, "EmployeeName")); GetElement(ExpenseTable) .GetTableCell("Actions", searchCriteria) .GetElement(EditExpenseIcon) .ClickIt(); } else { throw new Exception("No results found in Expense Summary Table"); } } catch (Exception ex) { throw ex; } Log.Information("End of EditExpense"); }
public void DeleteInvoice(TestData data, string invoiceId) { Log.Information("In DeleteInvoice..."); WaitForProgressToComplete(10); HoverElement(AddInvoiceBtn); // Workaround TestDataSheet invoiceSheet = data.Get("Invoice"); List <TestDataRow> invoiceDataRows = invoiceSheet.FilterRows("InvoiceId=" + invoiceId); TestDataRow invoiceData = invoiceDataRows[0]; // To get data from table DataTable dt = GetElement(InvoicesTable).GetTableData(); foreach (DataRow dr in dt.Rows) { foreach (DataColumn dc in dt.Columns) { Log.Information(dr[dc].ToString()); } } /* To delete an invoice * var searchCriteria = String.Format("Inv Num={0}", invoiceData.Value("InvoiceNum")); * GetElement(InvoicesTable).GetTableCell("Actions", searchCriteria).GetElement(DeleteInv).ClickIt(); * GetElement(OkButton).ClickIt();*/ Log.Information("End of DeleteInvoice"); }
protected override void Because() { _basicFormat = new TestDataSheet ( new Cache <string, ColumnDescription>() { { "Organ", new ColumnDescription(0, new List <string>() { "PeripheralVenousBlood" }, ColumnDescription.MeasurementLevel.Discrete) }, { "Time [min]", new ColumnDescription(5, null, ColumnDescription.MeasurementLevel.Numeric) }, { "Concentration [pmol/l]", new ColumnDescription(6, null, ColumnDescription.MeasurementLevel.Numeric) }, { "Error [pmol/l]", new ColumnDescription(7, null, ColumnDescription.MeasurementLevel.Numeric) } } ); }
protected override void Because() { _basicFormat = new TestDataSheet ( new Cache <string, ColumnDescription>() { { "Time [invalidUnit]", new ColumnDescription(5, null, ColumnDescription.MeasurementLevel.Numeric) }, { "Concentration", new ColumnDescription(6, null, ColumnDescription.MeasurementLevel.Numeric) }, { "Concentration_unit", new ColumnDescription(5, new List <string>() { "pmol/l" }, ColumnDescription.MeasurementLevel.Discrete) }, { "Error", new ColumnDescription(7, null, ColumnDescription.MeasurementLevel.Numeric) }, { "Error_unit", new ColumnDescription(5, new List <string>() { "pmol/l" }, ColumnDescription.MeasurementLevel.Discrete) } } ); }
public bool SearchClient(TestDataSheet data, string clientStatus = "All") { Log.Information("Start of SearchClient()..."); WaitForProgressToComplete(5); HoverElement(AddClientBtn); WaitForProgressToComplete(25); GetElement(ClientStatus).SelectComboValue(clientStatus); GetElement(ClientSearch).EnterText(data.Value(0, "ClientName")); WaitForProgressToComplete(5); if (IsElementPresent(ClientSearchResults)) { if (IsElementPresent(SearchResultClientCard)) { var actualClientName = GetElement(SearchResultClientCard) .GetElement(SearchResultClientName).Text; Log.Information("Found {actualClientName} in Search Results", actualClientName); return(String.Equals(actualClientName, data.Value(0, "ClientName"))); } else { return(false); } } else { return(false); } }
public void AddClient(TestData data) { Log.Information("In AddClient()...start"); TestDataSheet clientData = data.Get("Client"); WaitForProgressToComplete(2); GetElement(ClientName).EnterText(clientData.Value(0, "ClientName")); GetElement(RelationshipManager).SelectComboValue(clientData.Value(0, "RelationshipManager")); GetElement(Email).EnterText(clientData.Value(0, "Email")); GetElement(Phone).EnterText(clientData.Value(0, "Phone")); GetElement(Next).ClickIt(); WaitForLoadingToComplete(); GetElement(HomeAddress1).EnterText(clientData.Value(0, "HomeAddress1")); GetElement(HomeAddress2).EnterText(clientData.Value(0, "HomeAddress2")); GetElement(HomeCountry).SelectComboValue(clientData.Value(0, "HomeCountry")); GetElement(HomeState).SelectComboValue(clientData.Value(0, "HomeState")); GetElement(HomeCity).EnterText(clientData.Value(0, "HomeCity")); GetElement(HomeZip).EnterText(clientData.Value(0, "HomeZip")); GetInlineSwitchElement("Same as Address", clientData.Value(0, "SameAsAddress")).ClickIt(); GetElement(Next).ClickIt(); WaitForLoadingToComplete(); GetElement(Weekends).MultiSelectComboValues(clientData.Value(0, "Weekends").Split(',')); GetElement(Next).ClickIt(); GetElement(Submit).ClickIt(); Log.Information("In AddClient()...End"); }
public bool SearchProject(TestDataSheet data, string projectStatus = "All") { Log.Information("Start of SearchProject()..."); WaitForProgressToComplete(); HoverElement(AddProjectLink); GetElement(ProjectStatus).SelectComboValue(projectStatus); GetElement(ProjectSearch).EnterText(data.Value(0, "ProjectName")); WaitForProgressToComplete(); if (IsElementPresent(ProjectSearchResults)) { if (IsElementPresent(SearchResultProjectCard)) { var searchResultProjectName = new BaseElement("Xpath", ".//span[@class='empName']"); var searchResultCard = GetElement(SearchResultProjectCard); var actualProjectName = searchResultCard.GetElement(searchResultProjectName).Text; Log.Information("Found {actualProjectName} in Search Results", actualProjectName); return(String.Equals(actualProjectName, data.Value(0, "ProjectName"))); } else { return(false); } } else { return(false); } }
public Login LogIn(TestDataSheet data, int rowNum = 0) { GetElement(UserName).EnterText(data.Value(rowNum, "UserName")); GetElement(Password).EnterText(data.Value(rowNum, "Password")); GetElement(LoginBtn).ClickIt(); Log.Information("Logging with User Name {UserName}, Password {Password}", data.Value(0, "UserName"), data.Value(0, "Password")); return(this); }
public void AddClientProjects(TestDataSheet clientData) { Log.Information("AddClientProjects...Start"); WaitForProgressToComplete(); GetElement(OthersTab).ClickIt(); GetElement(ProjectsAccordion).ClickIt(); WaitForProgressToComplete(10); foreach (TestDataRow dataRow in clientData.FilterRows()) { GetElement(AddProjectLink).ClickIt(); Project project = new Project(this.DriverManager); project.CreateNewProject(clientData); } Log.Information("AddClientProjects...End"); }
public void ActivateEmployeeViaUrl(TestDataSheet data) { try { var employeeEmail = data.Value(0, "Email"); var employeeLastName = data.Value(0, "LastName"); var activationLink = this.GetActivationUrl(employeeEmail); this.DriverManager.OpenUrl(activationLink); GetElement(LastName).EnterText(employeeLastName); GetElement(Email).EnterText(employeeEmail); WaitForProgressToComplete(); GetElement(ConfirmBtn).ClickIt(); } catch (Exception ex) { Log.Error("Error in ActivateEmployeeViaUrl {message} {stack}", ex.Message, ex.StackTrace); throw ex; } }
public void EditInvoice(TestData data, string invoiceId) { Log.Information("In EditInvoice..."); WaitForProgressToComplete(10); HoverElement(AddInvoiceBtn); // Workaround TestDataSheet invoiceSheet = data.Get("Invoice"); List <TestDataRow> invoiceDataRows = invoiceSheet.FilterRows("InvoiceId=" + invoiceId); TestDataRow invoiceData = invoiceDataRows[0]; GetElement(InvoicesAccordion).ClickIt(); var searchCriteria = String.Format("Inv Num={0}", invoiceData.Value("InvoiceNum")); GetElement(InvoicesTable).GetTableCell("Actions", searchCriteria).GetElement(EditInv).ClickIt(); //GetElement(OkButton).ClickIt(); GetElement(DiscountValue).EnterText("15", Keys.Tab); GetElement(Save).ClickIt(); Log.Information("End of EditInvoice"); }
public void AddNewExpense(TestData data) { Log.Information("In AddNewExpense..."); try { TestDataSheet expenseRows = data.Get("Expense"); WaitForProgressToComplete(); HoverElement(AddExpense); GetElement(AddExpense).ClickIt(); WaitForProgressToComplete(10); var empName = expenseRows.Value(0, "EmployeeName"); GetElement(EmployeeName).SelectComboValue(empName); WaitForProgressToComplete(30); // Workaround - no progress bar GetElement(ProjectName).Select("Text", expenseRows.Value(0, "ProjectName")); GetInlineSwitchElement("Approved By Client", expenseRows.Value(0, "ApprovedByClient")).ClickIt(); GetElement(StartDate).EnterText(expenseRows.Value(0, "StartDate")); GetElement(EndDate).EnterText(expenseRows.Value(0, "EndDate")); GetElement(ApproverName).EnterText(expenseRows.Value(0, "ApproverName")); List <TestDataRow> receiptLines = data.Get("Receipts") .FilterRows("EmployeeName=" + empName); foreach (TestDataRow receipt in receiptLines) { GetElement(AddReceipt).ClickIt(); GetElement(ReceiptAmount).EnterText(receipt.Value("ReceiptAmount")); GetElement(ReceiptType).SelectComboValue(receipt.Value("ReceiptType")); GetElement(SaveReceipt).ClickIt(); } GetElement(SaveExpense).ClickIt(); } catch (Exception ex) { throw ex; } Log.Information("End of AddNewExpense"); }
public string Register(TestDataSheet data) { try { Log.Information("RegisterEmployee.Register...Start"); WaitForProgressToComplete(); HoverElement(RegisterEmployeeLink); GetElement(RegisterEmployeeLink).ClickIt(); GetElement(EmployeeType).SelectComboValue(data.Value(0, "EmployeeType")); GetElement(Salutation).SelectComboValue(data.Value(0, "Salutation")); GetElement(FirstName).EnterText(data.Value(0, "FirstName")); GetElement(LastName).EnterText(data.Value(0, "LastName")); GetElement(DateOfBirth).EnterText(data.Value(0, "DateOfBirth")); GetElement(SocialSecurityNumber).EnterText(data.Value(0, "SocialSecurityNumber")); GetElement(Gender).SelectComboValue(data.Value(0, "Gender")); GetElement(Email).EnterText(data.Value(0, "Email")); GetElement(Phone).EnterText(data.Value(0, "Phone")); GetElement(RegistrationSubmit).ClickIt(); var actualMessage = this.Driver.GetElement(AlertMessage).GetText(); GetElement(AlertOkBtn).ClickIt(); if (IsElementPresent(AlertOkBtn)) // Bug { GetElement(AlertOkBtn).ClickIt(); } Log.Information("RegisterEmployee.Register...End"); return(actualMessage); } catch (Exception ex) { Log.Error("Error in RegisterEmployee.Register {message} {stack}", ex.Message, ex.StackTrace); throw ex; } }
public void AddClientContacts(TestDataSheet clientData) { Log.Information("AddClientContact...Start"); WaitForProgressToComplete(); GetElement(OthersTab).ClickIt(); GetElement(ContactsAccordion).ClickIt(); foreach (TestDataRow dataRow in clientData.FilterRows()) { GetElement(AddContactLink).ClickIt(); WaitForProgressToComplete(10); GetElement(ContactType).EnterText(dataRow.Value("ContactType")); WaitForProgressToComplete(); GetElement(ContactEmail).EnterText(dataRow.Value("ContactEmail")); GetElement(ContactType).EnterText(dataRow.Value("ContactType")); // Bug WaitForProgressToComplete(); GetElement(ContactFirstName).ClickIt(); WaitForProgressToComplete(5); GetElement(ContactFirstName).EnterText(dataRow.Value("ContactFirstName")); WaitForProgressToComplete(); GetElement(ContactLastName).EnterText(dataRow.Value("ContactLastName")); GetElement(ContactSave).ClickIt(); } Log.Information("AddClientContact...End"); }
public void UploadDocument(TestDataSheet data, string parentNode) { WaitForProgressToComplete(10); HoverElement(PageHeader); IWebElement rootNode = OpenTreeNode(parentNode); rootNode.OpenTreeNode("Robert-72Hh") .OpenTreeNode("Projects") .OpenTreeNode("Housing-RJvk") .OpenTreeNode("Others"); GetElement(AddFolder).ClickIt(); var folderName = UtilManager.RandomAlphaNumString(4); GetElement(FolderName).EnterText(folderName); GetElement(Submit).ClickIt(); WaitForProgressToComplete(15); GetElement(UploadFile).ClickIt(); var purhcaseOrderFile = Path.Combine(ConfigManager.DataFolder, "Sample.pdf"); SelectFile(BrowseFile, purhcaseOrderFile); WaitForProgressToComplete(10); GetElement(Submit).ClickIt(); }
public string EmployeeRegistrationExpectedMessage(TestDataSheet data) { return(String.Format("Employee {0} {1} added.", data.Value(0, "FirstName"), data.Value(0, "LastName"))); }
public bool AddBasicDetails(TestDataSheet data) { //try //{ Log.Information("RegisterEmployee.AddBasicDetails...Start"); WaitForLoadingToComplete(); GetElement(HomePhone).EnterText(data.Value(0, "HomePhone")); GetElement(HomeAddress1).EnterText(data.Value(0, "HomeAddress1")); GetElement(HomeAddress2).EnterText(data.Value(0, "HomeAddress2")); GetElement(HomeCountry).SelectComboValue(data.Value(0, "HomeCountry")); GetElement(HomeCity).EnterText(data.Value(0, "HomeCity")); GetElement(HomeZip).EnterText(data.Value(0, "HomeZip")); WaitForLoadingToComplete(); GetElement(NextBtn).ClickIt(); // Additional Info GetElement(PositionAppliedFor).EnterText(data.Value(0, "PositionAppliedFor")); GetElement(NextBtn).ClickIt(); // Edu & Exp GetElement(NextBtn).ClickIt(); // Skills & Cert GetElement(AddSkillBtn).ClickIt(); GetElement(SkillName).EnterText(data.Value(0, "SkillName")); GetElement(SkillLevel).SelectComboValue(data.Value(0, "SkillLevel")); if (data.Value(0, "IsCertified").ToLower().Equals("yes")) { GetSwitchElement("Certified", "Yes").ClickIt(); } GetElement(SkillSaveBtn).ClickIt(); GetElement(NextBtn).ClickIt(); // Dependents WaitForLoadingToComplete(); GetElement(AlertOkBtn).ClickIt(); // Application Issue GetElement(NextBtn).ClickIt(); // Emergency Contacts WaitForLoadingToComplete(); GetElement(AlertOkBtn).ClickIt(); // Application Issue GetElement(NextBtn).ClickIt(); // Medical CC WaitForLoadingToComplete(); GetElement(AlertOkBtn).ClickIt(); // Application Issue GetElement(NextBtn).ClickIt(); // Reference WaitForLoadingToComplete(); GetElement(AlertOkBtn).ClickIt(); // Application Issue GetElement(NextBtn).ClickIt(); // Summary WaitForLoadingToComplete(); GetElement(AcknowlegeCheck).ClickIt(); GetElement(SubmitBtn).ClickIt(); Log.Information("RegisterEmployee.AddBasicDetails...End"); return(true); /*} * catch (Exception ex) * { * Log.Error("Error in AddBasicDetails {message} {stack}", ex.Message, ex.StackTrace); * throw ex; * }*/ }
public void AddInvoice(TestData data, String invoiceId) { Log.Information("In AddInvoice()...start"); TestDataSheet invoiceSheet = data.Get("Invoice"); List <TestDataRow> invoiceDataRows = invoiceSheet.FilterRows("InvoiceId=" + invoiceId); TestDataRow invoiceData = invoiceDataRows[0]; WaitForProgressToComplete(5); GetElement(InvoiceNum).EnterText(invoiceData.Value("InvoiceNum")); GetElement(Client).SelectComboValue(invoiceData.Value("Client")); GetElement(Project).SelectComboValue(invoiceData.Value("Project")); GetElement(Employee).SelectComboValue(invoiceData.Value("Employee")); //GetElement(PaymentTerms).SelectComboValue(invoiceData.Value("PaymentTerms")); WaitForProgressToComplete(5); //GetElement(InvoiceDate).EnterText(invoiceData.Value("InvoiceDate")); //GetElement(InvoiceDueDate).EnterText(invoiceData.Value("InvoiceDueDate")); GetElement(StartDate).EnterText(invoiceData.Value("StartDate")); GetElement(EndDate).EnterText(invoiceData.Value("EndDate")); GetElement(EndDate).SendKeys(Keys.Tab); WaitForProgressToComplete(5); /*if (IsElementPresent(AlertOkBtn)) // workaround * GetElement(AlertOkBtn).ClickIt();*/ GetInlineSwitchElement("Apply Discount", invoiceData.Value("ApplyDiscount")).ClickIt(); List <TestDataRow> othRows = data.Get("OtherCharges").FilterRows("InvoiceId=" + invoiceId); AddOtherCharges(othRows); List <TestDataRow> dedRows = data.Get("Deductions").FilterRows("InvoiceId=" + invoiceId); AddDeductions(dedRows); GetElement(DiscountValue).EnterText(invoiceData.Value("DiscountValue"), Keys.Tab); //GetElement(Tax1).EnterText(invoiceData.Value("Tax1")); //GetElement(Tax2).EnterText(invoiceData.Value("Tax2")); //GetElement(Tax2).SendKeys(Keys.Tab); var otherChargesGrandTotal = GetElement(OtherChargesGrandTotal).GetText(); otherChargesGrandTotal.ShouldBe(invoiceData.Value("OtherChargesGrandTotal")); var deductionsGrandTotal = GetElement(DeductionsGrandTotal).GetText(); deductionsGrandTotal.ShouldBe(invoiceData.Value("DeductionsGrandTotal")); //var totalValue = GetElement(Total).GetText(); //totalValue.ShouldBe(invoiceData.Value("Total")); //var discountApplied = GetElement(DiscountApplied).GetText(); //discountApplied.ShouldBe(invoiceData.Value("DiscountApplied")); //var grandTotal = GetElement(GrandTotal).GetText(); //grandTotal.ShouldBe(invoiceData.Value("GrandTotal")); GetElement(Save).ClickIt(); //if (IsElementPresent(AlertOkBtn)) // GetElement(AlertOkBtn).ClickIt(); Log.Information("In AddInvoice()...end"); }