Пример #1
0
        public static DriverEnterPage YesMoreDriver(this AddAnotherDriverPage addAnotherDriverPage)
        {
            ParameterValidator.ValidateNotNull(addAnotherDriverPage, "AddAnotherDriverPage");

            // Select decision when promted to add more driver
            addAnotherDriverPage.SelectAddMoreDriverButton(AnswerOption.Yes);
            //Select Next Button
            DriverEnterPage driverEnterPage = addAnotherDriverPage.SelectNextButton <DriverEnterPage>();

            //verification
            driverEnterPage.ValidateDriverEnterPageDisplayed();
            return(driverEnterPage);
        }
Пример #2
0
        public static DriverEnterPage NoMoreVehicle(this AddAnotherVehiclePage addAnotherVehiclePage)
        {
            ParameterValidator.ValidateNotNull(addAnotherVehiclePage, "addAnotherVehiclePage");

            // Select decsion when prompted to add more vehicle
            addAnotherVehiclePage.SelectAddMoreVehicleButton(AnswerOption.No);
            // Select next button
            DriverEnterPage driverEnterPage = addAnotherVehiclePage.SelectNextButton <DriverEnterPage>();

            //Verification
            driverEnterPage.ValidateDriverEnterPageDisplayed();
            return(driverEnterPage);
        }
Пример #3
0
        public static T AddDriver <T>(this DriverEnterPage driverEnterPage, DriverInformation driverInformation)
        {
            ParameterValidator.ValidateNotNull(driverEnterPage, "Driver enter page");
            ParameterValidator.ValidateNotNull(driverInformation, "Driver information");

            AddAnotherDriverPage addAnotherDriverPage = new AddAnotherDriverPage();
            CDLExperiencePage    cDLExperiencePage    = new CDLExperiencePage();
            DriverOverviewPage   driverOverviewPage   = new DriverOverviewPage();

            if (driverInformation.IsPO)
            {
                //1. Complete driver info and select next
                driverEnterPage.EnterDriverInfo(driverInformation).SelectNextButton();
            }
            else
            {
                //1.1 Complete Name and Date of Birth
                driverEnterPage.EnterNameAndDOB(driverInformation);
                //Verification
                driverEnterPage.ValidateNextButtonDisplayedAndEnabled();

                //1.2 Complete license number and state and select next
                driverEnterPage.EnterLicenseAndState(driverInformation).SelectNextButton();
            }
            //Verification
            cDLExperiencePage.ValidateCDLExperiencePageDisplayed();

            //2. Complete CDL Experience info and select next
            dynamic currentPage = cDLExperiencePage.EnterCDLExperience(driverInformation.CDLExperience).SelectNextButton();

            if (driverInformation.MVRStatus == OrderMVRStatus.Invalid ||
                (driverInformation.MVRStatus == OrderMVRStatus.Unknown &&
                 currentPage is AccidentsAndViolationsPage))
            {
                AccidentsAndViolationsPage accidentsAndViolationsPage = new AccidentsAndViolationsPage();
                //verification
                accidentsAndViolationsPage.ValidateAccidentsAndViolationsPageDisplayed();

                //3. Complete Accident and Violation info and select next
                ConvictionsPage convictionsPage = accidentsAndViolationsPage.EnterAccidentAndViolation(driverInformation.AccidentsAndViolations).SelectNextButton();

                //Verification
                convictionsPage.ValidateConvictionsPageDisplayed();

                //4. Complete Convictions info
                convictionsPage.EnterConviction(driverInformation.Conviction);

                // Navigate to Driver Overview page if process is edit Flow
                if (driverInformation.IsEditFlow)
                {
                    //Select next button
                    convictionsPage.SelectNextButton <DriverOverviewPage>();
                }
                // Require the second driver if DoseNotDrive was checked
                else if (driverInformation.DoesNotDrive)
                {
                    // Select Next Button
                    convictionsPage.SelectNextButton <DriverEnterPage>();
                }
                else
                {
                    // Select Next button
                    convictionsPage.SelectNextButton <AddAnotherDriverPage>();
                }
            }
            if (driverInformation.IsEditFlow)
            {
                // verification
                driverOverviewPage.ValidateDriverOverviewPageDisplayed();
            }
            else if (driverInformation.DoesNotDrive)
            {
                //Verification
                driverEnterPage.ValidateDriverEnterPageDisplayed();
            }
            else
            {
                // Verification
                addAnotherDriverPage.ValidateAddAnotherDriverPageDisplayed();
            }
            return((T)Activator.CreateInstance(typeof(T)));
        }