Exemplo n.º 1
0
        public void TC070_VerifyingConfirmPage_Contents_RL(int loanamout, string strmobiledevice)
        {
            strUserType = "RL";
            try
            {
                _driver             = _testengine.TestSetup(strmobiledevice, "RL");
                _homeDetails        = new HomeDetails(_driver, "RL");
                _loanPurposeDetails = new LoanPurposeDetails(_driver, "RL");
                _personalDetails    = new PersonalDetails(_driver, "RL");
                _bankDetails        = new BankDetails(_driver, "RL");
                _loanSetUpDetails   = new LoanSetUpDetails(_driver, "RL");
                string firstDate       = "";
                string lastDate        = "";
                double repaymentAmt    = 0;
                int    repaymentcount  = 0;
                string firstLoanAmount = "";
                string lastLoanAmount  = "";
                int    repaymentcountConfirm;
                bool   flag = false;

                //Go to the homepage and click the start application button and then the Request money button
                _homeDetails.homeFunctions_RL(TestData.RandomPassword, loanamout, TestData.ClientType.NewProduct, TestData.Feature.ReturnerDagBankstaging);

                //Select the loan amount and purpose and click on continue button
                _loanPurposeDetails.LoanPurposeFunction_RL(loanamout, TestData.POL.Households);

                //Edit the personal details and change the Rmsrv Code
                _personalDetails.PersonalDetailsFunction_Skipbanklogin(TestData.YourEmployementStatus.FullTime, TestData.ReturnerLoaner, TestData.OverrideCodes.PassAll_RL);

                // select Bank Name
                _bankDetails.SelectBankLst(TestData.BankDetails.Dagbank);

                // Click on Continue Button
                _bankDetails.BankSelectContinueBtn();

                if (bsAutoRefresh)
                {
                    // Entering Username and Password
                    _bankDetails.EnterBankCredentialsTxt(TestData.BankDetails.AUTOTriggerAllNoSACC.Yodlee.UID, TestData.BankDetails.AUTOTriggerAllNoSACC.Yodlee.PWD);

                    // Click on Continue Button
                    _bankDetails.ClickAutoContinueBtn();
                }

                // choose bank account
                _bankDetails.BankAccountSelectBtn();

                // Click on bank select Continue Button
                _bankDetails.ClickBankAccountContBtn();

                // Confirm Bank Details
                _bankDetails.EnterBankDetailsTxt();

                // Click on Confirm account details Continue Button
                _bankDetails.ClickAcctDetailsBtn();

                // Select Category
                _bankDetails.SelectIncomecategory(TestData.IncomeCategory.PrimaryIncome, "0");

                // click on Confirm Income Button
                _bankDetails.ClickConfirmIncomeBtn();

                // select  other debt repayments option No
                _bankDetails.SelectOtherDebtRepaymentsOptionBtn();

                // select dependents
                _bankDetails.SelectDependantsLst(TestData.Dependents.Zero);

                // Click on continue
                _bankDetails.ClickConfirmExpensesBtn();

                // select Governments benefits option No
                _bankDetails.ClickNoGovtBenefitsbtn();

                // click on Agree that information True
                _bankDetails.ClickAgreeAppSubmitBtn();

                // click on confirm Submit button
                _bankDetails.ClickConfirmSummaryBtn();

                if ((loanamout > 2000 && FinalReviewEnabled == "true") && (strUserType == FinalReviewLoanType || FinalReviewLoanType == "ALL"))
                {
                    if (GetPlatform(_driver))
                    {
                        if (loanamout > 2000)
                        {
                            // enter sms input as OTP
                            if (_bankDetails.VerifySMSOTP())
                            {
                                _bankDetails.EnterOTPDetailsTxt(TestData.SMSCode);
                            }
                        }
                        //ClickOn Loan Dashboard...Manual Approval
                        _loanSetUpDetails.ClickLoanDashboardManual();

                        // click on More Button from Bottom Menu
                        _loanSetUpDetails.ClickMoreBtn();

                        // click on Approve button
                        _loanSetUpDetails.ClickApproveBtn();

                        //Click Setup Button
                        _bankDetails.ClickSetup();

                        // Verify ApprovedAmount
                        Assert.IsTrue(_loanSetUpDetails.VerifyApprovedLoan(loanamout),
                                      "Expected Requested Amount : " + loanamout + ". Observed Approved Amount : " +
                                      _loanSetUpDetails.GetApprovedamount());

                        _loanSetUpDetails.ClickDetailedRepaymentSchedule();
                        string[,] details = _loanSetUpDetails.Getrepaymentdetails();
                        //Gives first repay amount
                        firstLoanAmount = details[0, 1];

                        //Gives last repay amount
                        int minrepayLength = details.GetLength(0) - 1;
                        lastLoanAmount = details[minrepayLength, 1];

                        int firstdatelength = details.GetLength(0) - 1;
                        firstDate      = _loanSetUpDetails.GetFirstDateSetupPage(firstdatelength);
                        lastDate       = _loanSetUpDetails.GetLastDateSetupPage();
                        repaymentAmt   = _loanSetUpDetails.GetRepaymentAmountSetupPage();
                        repaymentcount = _loanSetUpDetails.GetRepaymentCountSetupPage();

                        // click on Buton Submit
                        _loanSetUpDetails.ClickSubmitBtn();
                    }
                    else
                    {
                        if (loanamout > 2000)
                        {
                            // enter sms input as OTP
                            if (_bankDetails.VerifySMSOTP())
                            {
                                _bankDetails.EnterOTPDetailsTxt(TestData.SMSCode);
                            }
                        }
                        //ClickOn Loan Dashboard...Manual Approval
                        _loanSetUpDetails.ClickLoanDashboardManual();

                        //click on Final Approve
                        _loanSetUpDetails.FinalApprove();

                        //Click Setup Button
                        _bankDetails.ClickSetup();

                        // Verify ApprovedAmount
                        Assert.IsTrue(_loanSetUpDetails.VerifyApprovedLoan(loanamout),
                                      "Expected Requested Amount : " + loanamout + ". Observed Approved Amount : " +
                                      _loanSetUpDetails.GetApprovedamount());

                        _loanSetUpDetails.ClickDetailedRepaymentSchedule();
                        string[,] details = _loanSetUpDetails.Getrepaymentdetails();

                        //Gives first repay amount
                        firstLoanAmount = details[0, 1];

                        //Gives last repay amount
                        int minrepayLength = details.GetLength(0) - 1;
                        lastLoanAmount = details[minrepayLength, 1];
                        int firstdatelength = details.GetLength(0) - 1;
                        firstDate    = _loanSetUpDetails.GetFirstDateSetupPage(firstdatelength);
                        lastDate     = _loanSetUpDetails.GetLastDateSetupPage();
                        repaymentAmt = _loanSetUpDetails.GetRepaymentAmountSetupPage();

                        repaymentcount = _loanSetUpDetails.GetRepaymentCountSetupPage();

                        // click on Buton Submit
                        _loanSetUpDetails.ClickSubmitBtn();
                    }
                }
                else
                {
                    // Verify ApprovedAmount
                    Assert.IsTrue(_loanSetUpDetails.VerifyApprovedLoan(loanamout), "Expected Requested Amount : " + loanamout + ". Observed Approved Amount : " + _loanSetUpDetails.GetApprovedamount());

                    // Verify ApprovedAmount
                    Assert.IsTrue(_loanSetUpDetails.VerifyApprovedLoan(loanamout),
                                  "Expected Requested Amount : " + loanamout + ". Observed Approved Amount : " +
                                  _loanSetUpDetails.GetApprovedamount());

                    _loanSetUpDetails.ClickDetailedRepaymentSchedule();
                    string[,] details = _loanSetUpDetails.Getrepaymentdetails();
                    //Gives first repay amount
                    firstLoanAmount = details[0, 1];

                    //Gives last repay amount
                    int minrepayLength = details.GetLength(0) - 1;
                    lastLoanAmount = details[minrepayLength, 1];

                    int firstdatelength = details.GetLength(0) - 1;
                    firstDate      = _loanSetUpDetails.GetFirstDateSetupPage(firstdatelength);
                    lastDate       = _loanSetUpDetails.GetLastDateSetupPage();
                    repaymentAmt   = _loanSetUpDetails.GetRepaymentAmountSetupPage();
                    repaymentcount = _loanSetUpDetails.GetRepaymentCountSetupPage();

                    // click on Buton Submit
                    _loanSetUpDetails.ClickSubmitBtn();
                }

                //  Scrolling the Loan Contract
                _loanSetUpDetails.Loancontract();

                //verify repayment details

                string firstDateConfirm = _loanSetUpDetails.GetFirstDateConfirmPage();
                string lastDateConfirm  = _loanSetUpDetails.GetLastDateConfirmPage();

                double repaymentAmtConfirm = _loanSetUpDetails.GetRepaymentAmountConfirmPage();
                if (firstLoanAmount == lastLoanAmount)
                {
                    flag = true;
                    repaymentcountConfirm = _loanSetUpDetails.GetRepaymentCountConfirmPage(flag, loanamout);
                }
                else
                {
                    repaymentcountConfirm = _loanSetUpDetails.GetRepaymentCountConfirmPage(flag, loanamout);
                }
                //int repaymentcountConfirm = _loanSetUpDetails.GetRepaymentCountConfirmPage();
                if (repaymentAmt == repaymentAmtConfirm)
                {
                    Console.WriteLine("");
                }
                else
                {
                    Console.WriteLine("");
                }

                Assert.IsTrue(repaymentAmt == repaymentAmtConfirm, "repayment amount didn't matched");
                Assert.IsTrue(firstDateConfirm.Contains(firstDate), "first date not matched");
                Assert.IsTrue(lastDateConfirm.Contains(lastDate), "last date not matched");
                //Assert.IsTrue(_loanSetUpDetails.getAmtOfCredit(loanamout));
                Assert.IsTrue(_loanSetUpDetails.getDisclosureDate(), "DISCLOSURE DATE MATCHED");
                Assert.IsTrue(repaymentcount == repaymentcountConfirm, "repayment count unmatched");

                // Confirming accepting contract
                _loanSetUpDetails.ConfirmAcceptingContract();

                // click on I Agree button
                _loanSetUpDetails.ClickOnAgreeBtn();

                // click on No thanks Button
                _loanSetUpDetails.ClickNothanksBtn();

                if (GetPlatform(_driver))
                {
                    // Click on To Loan Dashboard Button
                    _loanSetUpDetails.ClickMobileLoanDashboardBtn();

                    // click on More Button from Bottom Menu
                    _loanSetUpDetails.ClickMoreBtn();

                    //Logout
                    _loanSetUpDetails.Logout();
                }
                else
                {
                    // Click on Loan Dashboard Button
                    _loanSetUpDetails.ClickLoanDashboard();

                    //Logout
                    _loanSetUpDetails.Logout();
                }
            }
            catch (Exception ex)
            {
                Fail(ex.Message);
            }
        }