Esempio n. 1
0
        public static VehicleEntryPage YesMoreVehicle(this AddAnotherVehiclePage addAnotherVehiclePage)
        {
            ParameterValidator.ValidateNotNull(addAnotherVehiclePage, "AddAnotherVehicle");
            // Select decision when prompted to add more vehicle
            addAnotherVehiclePage.SelectAddMoreVehicleButton(AnswerOption.Yes);
            // Select Next Button
            VehicleEntryPage vinEntryPage = addAnotherVehiclePage.SelectNextButton <VehicleEntryPage>();

            //Verification
            vinEntryPage.ValidateVehicleEntryPageDisplayed();
            return(vinEntryPage);
        }
Esempio n. 2
0
        public static T EnterPolicyLevelVehicleInfo <T>(this VehicleInfoPage vehicleInfoPage, PolicyLevelVehicleInformation policyLevelVehicleInformation)
        {
            ParameterValidator.ValidateNotNull(vehicleInfoPage, "VehicleInfoPage");
            ParameterValidator.ValidateNotNull(policyLevelVehicleInformation, "Policy Level Vehicle Information");
            //1. Enter policy level vehicle info
            vehicleInfoPage.InputVehicleInformation(policyLevelVehicleInformation);

            // wait 5s for allow async call to complete
            Browser.Wait(5);

            // Wait an additional 5s if territory can be pulled
            if (!string.IsNullOrWhiteSpace(policyLevelVehicleInformation.GaragingZipCode))
            {
                Browser.Wait(5);
            }

            if (policyLevelVehicleInformation.GaragingAddress != null)
            {
                // Wait for asynchronous process of default coverages complete
                Browser.Wait(10);

                //2. Select next button
                GaragingAddressPage garagingAddressPage = vehicleInfoPage.SelectNextButton <GaragingAddressPage>();
                // verification
                garagingAddressPage.ValidateGaragingAddressPageDisplayed();

                //3. Input Garaging address
                garagingAddressPage.InputGaragingAddress(policyLevelVehicleInformation.GaragingAddress);
            }

            //4. Select Next button
            VehicleEntryPage vehicleEntryPage = new VehicleEntryPage();

            if (!policyLevelVehicleInformation.IsValidVehicleData)
            {
                dynamic unknownPage = vehicleInfoPage.SelectNextButton();
                if (unknownPage is VehicleSuggestionsPage)
                {
                    // Select 'I don't see my vehicle' link if the vehicle Suggestion screen displayed
                    VehicleSuggestionsPage vehicleSuggestionsPage = unknownPage;
                    vehicleSuggestionsPage.SelectIDontSeeMyVehicles();
                }
                //Verification
                vehicleEntryPage.ValidateVehicleEntryPageDisplayed();
            }
            else
            {
                VehicleSuggestionsPage vehicleSuggestionsPage = vehicleInfoPage.SelectNextButton <VehicleSuggestionsPage>();

                //Refresh Vehicle suggestions if vehicle list not returned yet
                //by going to previous page and select Next button again
                if (vehicleEntryPage.IsPageDisplayed())
                {
                    dynamic currentPage;
                    if (policyLevelVehicleInformation.GaragingAddress != null)
                    {
                        currentPage = vehicleEntryPage.SelectPreviousButton <GaragingAddressPage>();
                    }
                    else
                    {
                        currentPage = vehicleEntryPage.SelectPreviousButton <VehicleInfoPage>();
                    }
                    // Wait 5s to allow async call to complete
                    Browser.Wait(5);
                    currentPage.SelectNextButton <VehicleSuggestionsPage>();
                }
                //Verification
                vehicleSuggestionsPage.ValidateVehicleSuggestionsPageDisplayed();
            }
            return((T)Activator.CreateInstance(typeof(T)));
        }