public void ATC6904a_CRMTopupExcessBondValidation() { #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() == "Topup_6904") { MyRow = i; break; } } #endregion //Data preparation step-Tenancy with bond balance of 100 //Creating a tenancy request for the data prep string managepingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(); 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(); tenancyRequestPage.SetRequestTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString()); string rentalPremises = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(); string[] address = rentalPremises.Split(','); string roadno = address[0].Split(' ')[0]; string roadname = address[0].Split(' ')[1]; string locality = address[1].Split(' ')[1] + "," + address[2] + "," + address[3]; tenancyRequestPage.CreateNewAddress(roadno,roadname,locality,"Room"); tenancyRequestPage = new TenancyRequestPage(driver); tenancyRequestPage.SetManagingPartyListValue(managepingParty); tenancyRequestPage.SetTenancyTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString()); tenancyRequestPage.SetTenancyManagementTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString()); tenancyRequestPage.SetInitialRequestPartyWithSearch(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString()); tenancyRequestPage.SetInitialConrtibution(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString()); tenancyRequestPage.SetAmountPaidWithLodgement(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString()); tenancyRequestPage.SetLodgementTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString()); tenancyRequestPage.SetWeeklyRent(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString()); tenancyRequestPage.SetTenancyStartDate(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString()); tenancyRequestPage.SetAnticipatedEndDate(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString()); tenancyRequestPage.SetPaymentType(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString()); tenancyRequestPage.SetDwellingTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("DWELLING_TYPE")].Value.ToString()); tenancyRequestPage.ClickSaveButton(); string tenancyrequest = tenancyRequestPage.GetRequestNumber(); MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value = tenancyrequest; string amount = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(); 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()); 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 BPay file with new reference number string dateValue = DateTime.Today.ToString("yyyyMMdd"); string fileLocation = Utils.BPayFileCreator.bPayFileCreator(referencenumber, dateValue, tenancyrequest, MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString() + "00"); MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value = fileLocation; #region Shut down Excel MyBook.Save(); MyBook.Close(); MyApp.Quit(); #endregion }
public void ATC6904c_CRMTopupExcessBondValidation() { #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() == "Topup_6904") { MyRow = i; break; } } #endregion string managepingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(); //Login as RBS user 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(); //(Template) - Create new Tenancy Request (Bond Lodgement) TenancyRequestsSearchPage tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver); tenancyRequestsSearchPage.ClickNewTenancyRequestButton(); TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver); tenancyRequestPage.ClickPageTitle(); /*Enter details.Details entered - Tenancy (prepared Tenancy) - Rooming Accommodation - Rent subsidy - rent $200 - amount paId $701*/ tenancyRequestPage.SetRequestTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString()); tenancyRequestPage.SetRentalPremisesValue("*"+MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString()); tenancyRequestPage.SetManagingPartyListValue(managepingParty); tenancyRequestPage.SetTenancyTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString()); tenancyRequestPage.SetTenancyManagementTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString()); tenancyRequestPage.SetInitialRequestPartyWithSearch(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString()); tenancyRequestPage.SetInitialConrtibution("701"); tenancyRequestPage.SetAmountPaidWithLodgement("701"); tenancyRequestPage.SetLodgementTypeListValue("Top up"); tenancyRequestPage.SetWeeklyRent(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString()); tenancyRequestPage.SetTenancyStartDate(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString()); tenancyRequestPage.SetAnticipatedEndDate(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString()); tenancyRequestPage.SetPaymentType(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString()); tenancyRequestPage.SetDwellingTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("DWELLING_TYPE")].Value.ToString()); tenancyRequestPage.SetSubsidy("Yes"); tenancyRequestPage.SetTenancyValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value.ToString()); //Save Tenancy Request tenancyRequestPage.ClickSaveButton(); string tenancyrequest = tenancyRequestPage.GetRequestNumber(); //Update Status Reason to 'Ready for validation' tenancyRequestPage.SetStatusReason("Ready for validation"); tenancyRequestPage.ClickSaveCloseButton(); tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver); tenancyRequestsSearchPage.SetTenancyRequestSearchText(tenancyrequest); Table table = new Table(tenancyRequestsSearchPage.GetSearchResultTable()); table.ClickCellValue("Name", tenancyrequest, "Name"); tenancyRequestPage = new TenancyRequestPage(driver); tenancyRequestPage.ClickPageTitle(); //Confirm Status Reason set to 'Validation failed' StringAssert.Contains(tenancyRequestPage.GetStatusReason(), "Validation failed"); //Confirm Queue reason for excess bond added.Status set to 'To be resolved' //tenancyRequestPage.ClickQueueReasons(); Table queueReasonTable = new Table(tenancyRequestPage.GetQueueReasonTable()); StringAssert.Contains(queueReasonTable.GetCellContainsValue("Reason", "Invalid bond amount : Exceeds maximum bond", "Status Reason"), "To be resolved"); //Confirm Maximum Allowed Bond set correctly //Assert: Maximum Allowed Bond set to $2800 Assert.AreEqual(tenancyRequestPage.GetMaximumAllowedAmount(), "$800.00"); }
public void ATC6780_CRMNewTenancyRequestTestResidentialTenancyTest() { #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() == "6780") { MyRow = i; break; } } #endregion 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(); //Attemp to save with NO Mandatory data tenancyRequestPage.SetRequestTypeListValue("Bond Lodgement"); tenancyRequestPage.ClickSaveButton(); //StringAssert.StartsWith(tenancyRequestPage.GetRentalPremiseAddressErrorText(), "You must provide a value for Rental Premises."); //Attempt to Enter Invalid Bedroom values tenancyRequestPage.SetNumberOfBedrooms("0"); StringAssert.Contains(tenancyRequestPage.GetAlertMessage(), "You must enter a whole number between 1 and 12."); StringAssert.Contains(tenancyRequestPage.GetAlertMessage(), "You must enter a whole number between 1 and 12."); //Attempt to Enter Invalid Bedoom values tenancyRequestPage.SetNumberOfBedrooms("13"); StringAssert.Contains(tenancyRequestPage.GetAlertMessage(), "You must enter a whole number between 1 and 12."); StringAssert.Contains(tenancyRequestPage.GetAlertMessage(), "You must enter a whole number between 1 and 12."); //Attempt to Enter Invalid Bedroom values tenancyRequestPage.SetNumberOfBedrooms("1"); //StringAssert.Contains(tenancyRequestPage.GetRTAValidationMessage(), "You must"); This needs a ! contrains //Attemp to save with Mandatory data // tenancyRequestPage.PopulateTenancyRequestFormResidentialTenancy("1 THOMAS ST, BIRKDALE, QLD, 4159", "Residential Tenancy", "AMANDA TEST", "3", "AARON BALL", "700", "700", "Initial"); tenancyRequestPage.PopulateTenancyRequestFormResidentialTenancy( MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(), 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("INITIAL_CONTRIBUTION")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString()); tenancyRequestPage.ClickSaveButton(); StringAssert.Equals(tenancyRequestPage.GetRequestNumber(), "TR-BL-"); //Assert the warning message regarding Tenancy Start Date and Total Contribution amount warningMessage = tenancyRequestPage.GetWarningMessage(); StringAssert.Contains(warningMessage, "Tenancy Start is blank, please select a date."); //Fill in start date and check that warning message is removed //tenancyRequestPage.ClickTenancyStartDate(); tenancyRequestPage.SetTenancyStartDate("01/03/2015"); tenancyRequestPage.ClickSaveButton(); //StringAssert.Contains(tenancyRequestPage.GetWarningMessage(),"Tenancy Start is blank, please select a date."); //Assert that Date Bond Received at RTA is read only controlMode = tenancyRequestPage.GetPropertyDataControlModeRTADateReceivedAtRTA(); StringAssert.Equals(controlMode, "locked"); //Assert that Funded Status is read only controlMode = tenancyRequestPage.GetPropertyDataControlModeRTAFundedStatus(); StringAssert.Equals(controlMode, "locked"); String tenancyNumber = tenancyRequestPage.GetRequestNumber(); StringAssert.StartsWith(tenancyNumber, "TR-BL-"); //Assert that saved record can be found in the record grid tenancyRequestPage.ClickSaveCloseButton(); tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver); tenancyRequestsSearchPage.SetTenancyRequestSearchText(tenancyNumber); Table table = new Table(tenancyRequestsSearchPage.GetSearchResultTable()); //Assert that the status reason can be confirmed on the table StringAssert.Equals(table.GetCellValue("Name", tenancyNumber, "Status Reason"), "New"); //Assert that a value in a particular column in a table exists StringAssert.Equals(table.GetCellContainsValue("Name", tenancyNumber, "Amount Bond Paid with Lodgement"), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString()); ////Assert that a search result record can be opened table.ClickCellValue("Name", tenancyNumber, "Name"); tenancyRequestPage = new TenancyRequestPage(driver); StringAssert.Equals(tenancyRequestPage.GetRequestNumber(), tenancyNumber); #region Shut down Excel MyBook.Save(); MyBook.Close(); MyApp.Quit(); #endregion }