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 }