Esempio n. 1
0
        public void InputPayrollFormDetails(string FormTypetoCreate, string CurrentOrClosedWeekending)
        {
            //Inputs all information needed to create a new payroll form
            FormType.SelectByText(FormTypetoCreate, "FormType");
            CenterDropDown.SelectByIndex(1, "Center");

            var routeNumberValue = GenerateRandomRouteNumber();

            //Save this route number value for use later
            ScenarioContext.Current["RouteNumber"] = routeNumberValue;
            RouteNumber.EnterText(routeNumberValue, "RouteNumber");
            RouteNumber.SendKeys(Keys.Tab);

            var WeekendingDateToSelect = DateTime.Now;

            if (CurrentOrClosedWeekending == "Current")
            {
                WeekendingDateToSelect = (DateTime.Now.AddDays(6 - (int)DateTime.Now.DayOfWeek));
            }
            else
            {
                DateTime StartOfWeek = DateTime.Today.AddDays(-(int)DateTime.Today.DayOfWeek);
                WeekendingDateToSelect = StartOfWeek.AddDays(-1);
            }
            var departDateValue = WeekendingDateToSelect.AddDays(-2).ToShortDateString();

            ScenarioContext.Current["DepartDate"] = departDateValue;
            DepartDate.EnterText(departDateValue, "DepartDate");
            DepartDate.SendKeys(Keys.Tab);
            WeekendingDate.EnterText(WeekendingDateToSelect.ToShortDateString(), "WeekendingDate");
            WeekendingDate.SendKeys(Keys.Tab);
            driver.RobustWait();

            if (FormTypetoCreate == "Regular")
            {
                Cases.EnterText("25", "Cases");
                Pounds.EnterText("4000", "Cases");
                Cubes.EnterText("25", "Cubes");
                Stops.EnterText("5", "Stops");
            }
        }