public void ATC7081a_CRMEFTreceiptforSingleBond() { #region Start Up Excel MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()]; MyRange = MySheet.UsedRange; //Get specific row for the data int testDataRows = MyRange.Rows.Count; int MyRow = 0; for (int i = 2; i <= testDataRows; i++) { if (MyRange.Cells[i, 1].Value.ToString() == "7081") { MyRow = i; break; } } #endregion string managepingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(); string tenancyrequest; User user = this.environment.GetUser(SecurityRole.RBSOfficer); new LoginDialog().Login(user.Id, user.Password); HomePage homePage = new HomePage(driver); homePage.HoverCRMRibbonTab(); homePage.ClickRBSRibbonButton(); homePage.HoverRBSRibbonTab(); homePage.ClickRtaTenancyRequestRibbonButton(); TenancyRequestsSearchPage tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver); tenancyRequestsSearchPage.ClickNewTenancyRequestButton(); TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver); tenancyRequestPage.ClickPageTitle(); string amountPaidLodgement = ((double)Int32.Parse(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString())).ToString("C"); tenancyRequestPage.PopulateTenancyRequestValidationSuccessful( MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(), managepingParty, MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString()); tenancyRequestPage.ClickSaveButton(); tenancyrequest = tenancyRequestPage.GetRequestNumber(); StringAssert.Contains(tenancyrequest, "TR-BL-"); MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value = tenancyrequest; //Add a new request party //tenancyRequestPage.ClickRequestPartyAssociated(); string BaseWindow = driver.CurrentWindowHandle; //Records the current window handle tenancyRequestPage.ClickAddNewRequestPartyImage(); //Enter Request Party details driver = tenancyRequestPage.SwitchNewBrowser(driver, BaseWindow); TenancyRequestPartyPage tenancyRequestPartyPage = new TenancyRequestPartyPage(driver); tenancyRequestPartyPage.SetClientNameValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MISC1")].Value.ToString()); tenancyRequestPartyPage.SetAmountValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MISC2")].Value.ToString()); tenancyRequestPartyPage.ClickSaveCloseButton(); string amountOtherParty = (MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value + MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MISC2")].Value).ToString(); driver = driver.SwitchTo().Window(BaseWindow); tenancyRequestPage = new TenancyRequestPage(driver); Thread.Sleep(2000); tenancyRequestPage.CheckForErrors(); tenancyRequestPage.ClickPageTitle(); tenancyRequestPage.SetStatusReason("Ready for validation"); tenancyRequestPage.ClickSaveButton(); StringAssert.Contains(tenancyRequestPage.GetValidationStatusReason(), "Validation successful"); tenancyRequestPage.ClickSaveCloseButton(); tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver); tenancyRequestsSearchPage.SetTenancyRequestSearchText(tenancyrequest); Assert.IsTrue(tenancyRequestsSearchPage.GetPaymentRefernceRefreshTable(tenancyrequest)); Table table = new Table(tenancyRequestsSearchPage.GetSearchResultTable()); table.ClickCellValue("Name", tenancyrequest, "Name"); tenancyRequestPage = new TenancyRequestPage(driver); table = new Table(tenancyRequestPage.GetPaymentSummaryResultTable()); StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Tenancy Request"), tenancyrequest); StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Payment Type"), "EFT"); StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Amount"), amountPaidLodgement); StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Client"), managepingParty); string referencenumber = table.GetCellValue("Tenancy Request", tenancyrequest, "Reference Number"); MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value = referencenumber; StringAssert.Contains(tenancyRequestPage.GetStatusReason(), "Pending Financials"); StringAssert.Contains(tenancyRequestPage.GetFundedStatus(), "Payment pending"); //Create EFT file with new reference number //string fileLocation = Utils.EFTFileCreator.eFTFileCreator(tenancyrequest, referencenumber); MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value = Utils.BAI2FileCreator.bAI2FileCreator(referencenumber, amountOtherParty); #region Shut down Excel MyBook.Save(); MyBook.Close(); MyApp.Quit(); #endregion }