Ejemplo n.º 1
0
        public VehicleInfoPage ValidateVehicleInfoIsFilledOut(PolicyLevelVehicleInformation policyLevelVehiclelnformation)
        {
            var node = GetLastNode();

            try
            {
                ParameterValidator.ValidateNotNull(policyLevelVehiclelnformation, "Policy Information");
                List <KeyValuePair <string, string[]> > comparisons = new List <KeyValuePair <string, string[]> >()
                {
                    new KeyValuePair <string, string[]>("Radius", new string[] { policyLevelVehiclelnformation.Radius, GetText(_drpRadius) })
                };
                if (policyLevelVehiclelnformation.Interstate != null)
                {
                    comparisons.Add(new KeyValuePair <string, string[]>("lnterstate", new string[] { policyLevelVehiclelnformation.Interstate, GetText(_btnSelectedlnterstate) }));
                }
                if (policyLevelVehiclelnformation.WorkersCompensation != null)
                {
                    comparisons.Add(new KeyValuePair <string, string[]>("Workers Compensation", new string[] { policyLevelVehiclelnformation.WorkersCompensation, GetText(_btnSelectedWorkersCompensation) }));
                }
                if (policyLevelVehiclelnformation.GaragingZipCode != null)
                {
                    comparisons.Add(new KeyValuePair <string, string[]>("Garaging Zip", new string[] { policyLevelVehiclelnformation.GaragingZipCode, GaragingZipCodeTextBox.GetValue() }));
                }
                if (policyLevelVehiclelnformation.Transportation != null)
                {
                    comparisons.Add(new KeyValuePair <string, string[]>("Transportation", new string[] { policyLevelVehiclelnformation.Transportation, GetText(_btnSelectedTransportation) }));
                }
                if (policyLevelVehiclelnformation.Repossession != null)
                {
                    comparisons.Add(new KeyValuePair <string, string[]>("Repossession", new string[] { policyLevelVehiclelnformation.Repossession, GetText(_btnSelectedRepossession) }));
                }
                if (policyLevelVehiclelnformation.PrimarilyOperate != null)
                {
                    comparisons.Add(new KeyValuePair <string, string[]>("Primarily Operate", new string[] { policyLevelVehiclelnformation.PrimarilyOperate, GetText(_btnSelectedPrimarilyOperate) }));
                }
                foreach (var item in comparisons)
                {
                    if (item.Value[0] == item.Value[1])
                    {
                        SetPassValidation(node, ValidationMessage.ValidateVehicleInfoIsFilledOut, item.Key, item.Value[0]);
                    }
                    else
                    {
                        SetFailValidation(node, ValidationMessage.ValidateVehicleInfoIsFilledOut, item.Key, item.Value[0], item.Value[1]);
                    }
                }
            }
            catch (Exception e)
            {
                SetErrorValidation(node, ValidationMessage.ValidateVehicleInfoIsFilledOut, e);
            }
            return(this);
        }
Ejemplo n.º 2
0
 public VehicleInfoPage InputVehicleInformation(PolicyLevelVehicleInformation policyLevelVehiclelnformation)
 {
     GetLastNode().LogDataInfo(policyLevelVehiclelnformation);
     ParameterValidator.ValidateNotNull(policyLevelVehiclelnformation, "Policy Level Vehicle Information");
     if (IsDropdownEnabled(_drpRadius))
     {
         RadiusDropdown.SelectByText(policyLevelVehiclelnformation.Radius);
     }
     else
     {
         GetLastNode().Info("Radius was set to default value: " + RadiusDropdown.Text);
     }
     if (policyLevelVehiclelnformation.Interstate != null)
     {
         InterstateButton(policyLevelVehiclelnformation.Interstate).ScrollIntoViewAndClick();
     }
     if (policyLevelVehiclelnformation.GaragingZipCode != null)
     {
         GaragingZipCodeTextBox.InputText(policyLevelVehiclelnformation.GaragingZipCode);
     }
     if (policyLevelVehiclelnformation.Transportation != null)
     {
         TransportationCompButton(policyLevelVehiclelnformation.Transportation).ScrollIntoViewAndClick();
     }
     if (policyLevelVehiclelnformation.WorkersCompensation != null)
     {
         WorkersCompensationButton(policyLevelVehiclelnformation.WorkersCompensation).ScrollIntoViewAndClick();
     }
     if (policyLevelVehiclelnformation.Repossession != null)
     {
         RepossessionButton(policyLevelVehiclelnformation.Repossession).ScrollIntoViewAndClick();
     }
     if (policyLevelVehiclelnformation.PrimarilyOperate != null)
     {
         PrimarilyOperateButton(policyLevelVehiclelnformation.PrimarilyOperate).ScrollIntoViewAndClick();
     }
     if (policyLevelVehiclelnformation.OwnerOperator != null)
     {
         OwnerOperatorButton(policyLevelVehiclelnformation.OwnerOperator).ScrollIntoViewAndClick();
     }
     if (policyLevelVehiclelnformation.CarrierAI != null)
     {
         CarrierAIButton(policyLevelVehiclelnformation.CarrierAI).ScrollIntoViewAndClick();
         WaitForElementEnabled(_btnNext);
     }
     return(this);
 }
Ejemplo n.º 3
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)));
        }