public void OutofRangeDependent() { AddEmployeeDialogBox addEmp = new AddEmployeeDialogBox(driver); EmployeeBenifitDashboardPage dashboard = new EmployeeBenifitDashboardPage(driver); Actions.LoginToEmployeeBenifitDashboard(Config.Credentials.Valid.Username, Config.Credentials.Valid.Password, driver); dashboard.AddEmployeeButton.Click(); try { Actions.AddEmployee(Config.EmployeeInfo.OutofRangeDependentInfo.FirstName, Config.EmployeeInfo.OutofRangeDependentInfo.LastName, Config.EmployeeInfo.OutofRangeDependentInfo.NumberOfDependents, driver); addEmp.CancelButton.Click(); Thread.Sleep(2000); dashboard.LogOutLink.Click(); } catch (Exception) { Assert.IsTrue(true); addEmp.CancelButton.Click(); Thread.Sleep(2000); dashboard.LogOutLink.Click(); } Thread.Sleep(3000); }
public static void AddEmployee(string firstname, string lastname, string dependents, IWebDriver driver) { AddEmployeeDialogBox addEmp = new AddEmployeeDialogBox(driver); addEmp.FirstNameTextbox.Clear(); addEmp.FirstNameTextbox.SendKeys(firstname); addEmp.LastNameTextbox.Clear(); addEmp.LastNameTextbox.SendKeys(lastname); addEmp.DependentsTextbox.Clear(); addEmp.DependentsTextbox.SendKeys(dependents); addEmp.AddButton.Click(); }
public void AddEmployeeDialogBoxDisplayValidation() { EmployeeBenifitDashboardPage dashboard = new EmployeeBenifitDashboardPage(driver); AddEmployeeDialogBox addEmp = new AddEmployeeDialogBox(driver); Actions.LoginToEmployeeBenifitDashboard(Config.Credentials.Valid.Username, Config.Credentials.Valid.Password, driver); dashboard.AddEmployeeButton.Click(); try { Assert.IsTrue(addEmp.AddEmployeeDialogBoxHeader.Displayed); Assert.AreEqual(addEmp.AddEmployeeDialogBoxHeader.Text, "Add Employee"); Assert.IsTrue(addEmp.FirstNameLabel.Displayed); Assert.AreEqual(addEmp.FirstNameLabel.Text, "First Name:"); Assert.IsTrue(addEmp.LastNameLabel.Displayed); Assert.AreEqual(addEmp.LastNameLabel.Text, "Last Name:"); Assert.IsTrue(addEmp.DependentsLabel.Displayed); Assert.AreEqual(addEmp.DependentsLabel.Text, "Dependents"); Assert.IsTrue(addEmp.AddButton.Displayed); Assert.AreEqual(addEmp.AddButton.Text, "Add"); Assert.IsTrue(addEmp.CancelButton.Displayed); Assert.AreEqual(addEmp.CancelButton.Text, "Cancel"); Assert.IsTrue(addEmp.CrossButton.Displayed); } catch (Exception) { addEmp.CancelButton.Click(); Thread.Sleep(2000); dashboard.LogOutLink.Click(); } }
public void ValidateUpdateEmployeeInfo() { AddEmployeeDialogBox addEmp = new AddEmployeeDialogBox(driver); EmployeeBenifitDashboardPage dashboard = new EmployeeBenifitDashboardPage(driver); Actions.LoginToEmployeeBenifitDashboard(Config.Credentials.Valid.Username, Config.Credentials.Valid.Password, driver); //Get count before adding an employee int countOfLastNames = dashboard.LastNameList.Count; int countOfFirstNames = dashboard.FirstNameList.Count; int countOfDependents = dashboard.DependentsList.Count; int i; string UpdateFirstName = "Mike"; string UpdateLastName = "Scott"; string existingFirstName = ""; string existingLastName = ""; string existingDependent = ""; string existingID; string Id; int j; int dependents; decimal BenifitsCost; decimal NetPay; string updatedFirstName = Config.EmployeeInfo.UpdateEmployeeInfo.FirstName; string updatedLastName = Config.EmployeeInfo.UpdateEmployeeInfo.LastName; string updatedDependents = Config.EmployeeInfo.UpdateEmployeeInfo.NumberOfDependents; try { for (i = 0; i <= countOfLastNames; i++) { existingLastName = dashboard.FirstNameList[i].Text; if (existingLastName == UpdateLastName) { existingFirstName = dashboard.LastNameList[i].Text; if (existingFirstName == UpdateFirstName) { existingDependent = dashboard.DependentsList[i].Text; if (existingDependent == "2") { dashboard.EditActionList[i].Click(); Actions.UpdateEmployee(Config.EmployeeInfo.UpdateEmployeeInfo.FirstName, Config.EmployeeInfo.UpdateEmployeeInfo.LastName, Config.EmployeeInfo.UpdateEmployeeInfo.NumberOfDependents, driver); Id = dashboard.IdList[i].Text; for (j = 0; j <= countOfLastNames; j++) { existingLastName = dashboard.FirstNameList[j].Text; if (existingLastName == updatedLastName) { existingFirstName = dashboard.LastNameList[i].Text; if (existingFirstName == updatedFirstName) { existingDependent = dashboard.DependentsList[i].Text; if (existingDependent == updatedDependents) { existingID = dashboard.IdList[i].Text; if (Id == existingID) { Assert.IsTrue(true); dependents = Int32.Parse(updatedDependents); BenifitsCost = Actions.BenifitCalculation(dependents, driver); string CalBenifitCost = BenifitsCost.ToString(); Assert.AreEqual(CalBenifitCost, dashboard.BenefitsCostList[i].Text); NetPay = Actions.NetPayCalcualtion(BenifitsCost, driver); string CalNetPay = NetPay.ToString(); Assert.AreEqual(CalNetPay, dashboard.NetPayList[i].Text); break; } } } } } } } } } } catch (Exception) { dashboard.LogOutLink.Click(); } }
public void ValidateAddedValidEmployee() { AddEmployeeDialogBox addEmp = new AddEmployeeDialogBox(driver); EmployeeBenifitDashboardPage dashboard = new EmployeeBenifitDashboardPage(driver); Actions.LoginToEmployeeBenifitDashboard(Config.Credentials.Valid.Username, Config.Credentials.Valid.Password, driver); //Get count before adding an employee int countOfLastNames = dashboard.LastNameList.Count; int countOfFirstNames = dashboard.FirstNameList.Count; int countOfDependents = dashboard.DependentsList.Count; dashboard.AddEmployeeButton.Click(); string fntext = Config.EmployeeInfo.ValidEmployeeInfo.FirstName; string lntext = Config.EmployeeInfo.ValidEmployeeInfo.LastName; string deptext = Config.EmployeeInfo.ValidEmployeeInfo.NumberOfDependents; Actions.AddEmployee(Config.EmployeeInfo.ValidEmployeeInfo.FirstName, Config.EmployeeInfo.ValidEmployeeInfo.LastName, Config.EmployeeInfo.ValidEmployeeInfo.NumberOfDependents, driver); Thread.Sleep(3000); int countofLastNameafterAddition = dashboard.LastNameList.Count; int countOfFirstNameafterAddition = dashboard.FirstNameList.Count; countOfFirstNames = countOfFirstNames + 1; countOfLastNames = countOfLastNames + 1; Assert.AreEqual(countOfFirstNameafterAddition, countOfFirstNames); Assert.AreEqual(countofLastNameafterAddition, countOfLastNames); string addedFirstName = ""; string addedLastName = ""; string addedDependent = ""; int i; int dependents; decimal BenifitsCost; decimal NetPay; for (i = 0; i <= countOfLastNames; i++) { addedFirstName = dashboard.LastNameList[i].Text; if (fntext == addedFirstName) { addedLastName = dashboard.FirstNameList[i].Text; if (lntext == addedLastName) { addedDependent = dashboard.DependentsList[i].Text; if (deptext == addedDependent) { Assert.IsTrue(true); dependents = Int32.Parse(addedDependent); BenifitsCost = Actions.BenifitCalculation(dependents, driver); string CalBenifitCost = BenifitsCost.ToString(); Assert.AreEqual(CalBenifitCost, dashboard.BenefitsCostList[i].Text); NetPay = Actions.NetPayCalcualtion(BenifitsCost, driver); string CalNetPay = NetPay.ToString(); Assert.AreEqual(CalNetPay, dashboard.NetPayList[i].Text); break; } } } } Thread.Sleep(3000); }