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();
            }
        }
Exemplo n.º 2
0
        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);
        }