List of usage examples for org.openqa.selenium Keys PAGE_DOWN
Keys PAGE_DOWN
To view the source code for org.openqa.selenium Keys PAGE_DOWN.
Click Source Link
From source file:org.eclipse.che.selenium.pageobject.CheTerminal.java
License:Open Source License
/** * scroll terminal by pressing key 'PageDown' * * @param item is the name of the highlighted item *//* ww w . j a v a 2s .c o m*/ public void movePageDownListTerminal(String item) { loader.waitOnClosed(); typeIntoActiveTerminal(Keys.PAGE_DOWN.toString()); WaitUtils.sleepQuietly(2); WebElement element = seleniumWebDriver .findElement(By.xpath(format("(//span[contains(text(), '%s')])[position()=1]", item))); new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC).until(visibilityOf(element)); new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) .until((WebDriver input) -> element.getCssValue("background-color").equals(LINE_HIGHLIGHTED_GREEN)); }
From source file:org.eclipse.scout.rt.testing.ui.rap.RapMock.java
License:Open Source License
protected Keys toSeleniumKey(Key key) { switch (key) { case Shift:// w ww .jav a 2 s. c om return Keys.SHIFT; case Control: return Keys.CONTROL; case Alt: return Keys.ALT; case Delete: return Keys.DELETE; case Backspace: return Keys.BACK_SPACE; case Enter: return Keys.ENTER; case Esc: return Keys.ESCAPE; case Tab: return Keys.TAB; case ContextMenu: throw new IllegalArgumentException("Unknown keyboard key: " + key); case Up: return Keys.UP; case Down: return Keys.DOWN; case Left: return Keys.LEFT; case Right: return Keys.RIGHT; case Windows: return Keys.META; case F1: return Keys.F1; case F2: return Keys.F2; case F3: return Keys.F3; case F4: return Keys.F4; case F5: return Keys.F5; case F6: return Keys.F6; case F7: return Keys.F7; case F8: return Keys.F8; case F9: return Keys.F9; case F10: return Keys.F10; case F11: return Keys.F11; case F12: return Keys.F12; case Home: return Keys.HOME; case End: return Keys.END; case PageUp: return Keys.PAGE_UP; case PageDown: return Keys.PAGE_DOWN; case NumPad0: return Keys.NUMPAD0; case NumPad1: return Keys.NUMPAD1; case NumPad2: return Keys.NUMPAD2; case NumPad3: return Keys.NUMPAD3; case NumPad4: return Keys.NUMPAD4; case NumPad5: return Keys.NUMPAD5; case NumPad6: return Keys.NUMPAD6; case NumPad7: return Keys.NUMPAD7; case NumPad8: return Keys.NUMPAD8; case NumPadMultiply: return Keys.MULTIPLY; case NumPadDivide: return Keys.DIVIDE; case NumPadAdd: return Keys.ADD; case NumPadSubtract: return Keys.SUBTRACT; case NumPadDecimal: return Keys.DECIMAL; case NumPadSeparator: return Keys.SEPARATOR; default: throw new IllegalArgumentException("Unknown keyboard key: " + key); } }
From source file:org.safs.selenium.webdriver.lib.WDLibrary.java
License:Open Source License
/** * Convert a Java KEYCODE to a Selenium WebDriver Keys Enum * @param keycode int, a java keycode// w w w. j a v a2 s . co m * @return Keys enum for (primarily) non-printable (control) characters, or null. */ public static Keys convertToKeys(int keycode) { Keys key = null; switch (keycode) { case java.awt.event.KeyEvent.VK_ADD: key = Keys.ADD; break; case java.awt.event.KeyEvent.VK_ALT: key = Keys.ALT; break; case java.awt.event.KeyEvent.VK_KP_DOWN: key = Keys.ARROW_DOWN; break; case java.awt.event.KeyEvent.VK_KP_LEFT: key = Keys.ARROW_LEFT; break; case java.awt.event.KeyEvent.VK_KP_RIGHT: key = Keys.ARROW_RIGHT; break; case java.awt.event.KeyEvent.VK_KP_UP: key = Keys.ARROW_UP; break; case java.awt.event.KeyEvent.VK_BACK_SPACE: key = Keys.BACK_SPACE; break; case java.awt.event.KeyEvent.VK_CANCEL: key = Keys.CANCEL; break; case java.awt.event.KeyEvent.VK_CLEAR: key = Keys.CLEAR; break; case java.awt.event.KeyEvent.VK_WINDOWS: key = Keys.COMMAND; break; case java.awt.event.KeyEvent.VK_CONTROL: key = Keys.CONTROL; break; case java.awt.event.KeyEvent.VK_DECIMAL: key = Keys.DECIMAL; break; case java.awt.event.KeyEvent.VK_DELETE: key = Keys.DELETE; break; case java.awt.event.KeyEvent.VK_DIVIDE: key = Keys.DIVIDE; break; case java.awt.event.KeyEvent.VK_DOWN: key = Keys.DOWN; break; case java.awt.event.KeyEvent.VK_END: key = Keys.END; break; case java.awt.event.KeyEvent.VK_ENTER: key = Keys.ENTER; break; case java.awt.event.KeyEvent.VK_EQUALS: key = Keys.EQUALS; break; case java.awt.event.KeyEvent.VK_ESCAPE: key = Keys.ESCAPE; break; case java.awt.event.KeyEvent.VK_F1: key = Keys.F1; break; case java.awt.event.KeyEvent.VK_F2: key = Keys.F2; break; case java.awt.event.KeyEvent.VK_F3: key = Keys.F3; break; case java.awt.event.KeyEvent.VK_F4: key = Keys.F4; break; case java.awt.event.KeyEvent.VK_F5: key = Keys.F5; break; case java.awt.event.KeyEvent.VK_F6: key = Keys.F6; break; case java.awt.event.KeyEvent.VK_F7: key = Keys.F7; break; case java.awt.event.KeyEvent.VK_F8: key = Keys.F8; break; case java.awt.event.KeyEvent.VK_F9: key = Keys.F9; break; case java.awt.event.KeyEvent.VK_F10: key = Keys.F10; break; case java.awt.event.KeyEvent.VK_F11: key = Keys.F11; break; case java.awt.event.KeyEvent.VK_F12: key = Keys.F12; break; case java.awt.event.KeyEvent.VK_HELP: key = Keys.HELP; break; case java.awt.event.KeyEvent.VK_HOME: key = Keys.HOME; break; case java.awt.event.KeyEvent.VK_INSERT: key = Keys.INSERT; break; case java.awt.event.KeyEvent.VK_LEFT: key = Keys.LEFT; break; case java.awt.event.KeyEvent.VK_META: key = Keys.META; break; case java.awt.event.KeyEvent.VK_MULTIPLY: key = Keys.MULTIPLY; break; case java.awt.event.KeyEvent.VK_NUMPAD0: key = Keys.NUMPAD0; break; case java.awt.event.KeyEvent.VK_NUMPAD1: key = Keys.NUMPAD1; break; case java.awt.event.KeyEvent.VK_NUMPAD2: key = Keys.NUMPAD2; break; case java.awt.event.KeyEvent.VK_NUMPAD3: key = Keys.NUMPAD3; break; case java.awt.event.KeyEvent.VK_NUMPAD4: key = Keys.NUMPAD4; break; case java.awt.event.KeyEvent.VK_NUMPAD5: key = Keys.NUMPAD5; break; case java.awt.event.KeyEvent.VK_NUMPAD6: key = Keys.NUMPAD6; break; case java.awt.event.KeyEvent.VK_NUMPAD7: key = Keys.NUMPAD7; break; case java.awt.event.KeyEvent.VK_NUMPAD8: key = Keys.NUMPAD8; break; case java.awt.event.KeyEvent.VK_NUMPAD9: key = Keys.NUMPAD9; break; case java.awt.event.KeyEvent.VK_PAGE_DOWN: key = Keys.PAGE_DOWN; break; case java.awt.event.KeyEvent.VK_PAGE_UP: key = Keys.PAGE_UP; break; case java.awt.event.KeyEvent.VK_PAUSE: key = Keys.PAUSE; break; case java.awt.event.KeyEvent.VK_RIGHT: key = Keys.RIGHT; break; case java.awt.event.KeyEvent.VK_SEMICOLON: key = Keys.SEMICOLON; break; case java.awt.event.KeyEvent.VK_SEPARATOR: key = Keys.SEPARATOR; break; case java.awt.event.KeyEvent.VK_SHIFT: key = Keys.SHIFT; break; case java.awt.event.KeyEvent.VK_SPACE: key = Keys.SPACE; break; case java.awt.event.KeyEvent.VK_SUBTRACT: key = Keys.SUBTRACT; break; case java.awt.event.KeyEvent.VK_TAB: key = Keys.TAB; break; case java.awt.event.KeyEvent.VK_UP: key = Keys.UP; break; } return key; }
From source file:org.xwiki.test.selenium.WikiEditorTest.java
License:Open Source License
/** * Tests that the specified tool bar button works. * //from ww w. ja v a2 s .c o m * @param buttonTitle the title of a tool bar button * @param format the format of the text inserted by the specified button * @param defaultText the default text inserted if there's no text selected in the text area */ private void testToolBarButton(String buttonTitle, String format, String defaultText) { editInWikiEditor(this.getClass().getSimpleName(), getTestMethodName(), SYNTAX); WebElement textArea = getDriver().findElement(By.id("content")); textArea.clear(); textArea.sendKeys("a"); String buttonLocator = "//img[@title = '" + buttonTitle + "']"; getSelenium().click(buttonLocator); // Type b and c on two different lines and move the caret after b. textArea.sendKeys("b", Keys.RETURN, "c", Keys.ARROW_LEFT, Keys.ARROW_LEFT); getSelenium().click(buttonLocator); // Move the caret after c, type d and e, then select d. textArea.sendKeys(Keys.PAGE_DOWN, Keys.END, "de", Keys.ARROW_LEFT, Keys.chord(Keys.SHIFT, Keys.ARROW_LEFT)); getSelenium().click(buttonLocator); if (defaultText.isEmpty()) { assertEquals("a" + format + "b" + format + "\nc" + format + "de", textArea.getAttribute("value")); } else { assertEquals(String.format("a" + format + "b" + format + "\nc" + format + "e", defaultText, defaultText, "d"), textArea.getAttribute("value")); } }
From source file:Scenarios.Payments.MakePayment_Individual_NewCustomer_MultipleSpaces_paythroughCheck.java
@Test(dataProvider = "getCustSearchData") public void MakePayment_Individual_NewCustomer_MultipleSpaces_paythroughCheck( Hashtable<String, String> tabledata) throws InterruptedException { try {/*from ww w . j a va 2s. c o m*/ logger = extent.startTest("MakePayment_Individual_NewCustomer_MultipleSpaces_paythroughCheck", "MakePayment_Individual_NewCustomer_MultipleSpaces_paythroughCheck"); Reporter.log("Test case started: " + testcaseName, true); if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Payments").equals("Y"))) { resultFlag = "skip"; throw new SkipException("Skipping the test"); } //Login To the Application LoginPage loginPage = new LoginPage(driver); loginPage.login(tabledata.get("UserName"), tabledata.get("Password")); logger.log(LogStatus.INFO, "Login to Application successfully"); Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver); logger.log(LogStatus.INFO, "PopUp window object is created successfully"); //Bifrostpop.clickContiDevice(); Thread.sleep(10000); String biforstNum = Bifrostpop.getBiforstNo(); Reporter.log(biforstNum + "", true); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t"); ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles()); Reporter.log(tabs.size() + "", true); driver.switchTo().window(tabs.get(1)); driver.get("http://wc2qa.ps.com/CustomerScreen/Mount"); List<WebElement> biforstSystem = driver.findElements( By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']")); for (WebElement ele : biforstSystem) { if (biforstNum.equalsIgnoreCase(ele.getText().trim())) { Reporter.log(ele.getText() + "", true); ele.click(); break; } } driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(5000); driver.switchTo().window(tabs.get(0)); driver.navigate().refresh(); Thread.sleep(5000); driver.findElement(By.xpath( "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']")) .click(); Thread.sleep(5000); //Verify that the user lands on the "PM Dashboard" screen after login and walkin cust title PM_Homepage pmhomepage = new PM_Homepage(driver); pmhomepage.clk_findAndLeaseSpace(); Thread.sleep(10000); logger.log(LogStatus.PASS, "find and Lease a space btn is clicked successfully"); StandardStoragePage stndstorage = new StandardStoragePage(driver); logger.log(LogStatus.INFO, "Standard Storage object created"); stndstorage.click_SqFt50(); stndstorage.click_SqFt100(); stndstorage.click_SqFt150(); Thread.sleep(5000); logger.log(LogStatus.PASS, "Selected desired spaces"); stndstorage.click_Search(); logger.log(LogStatus.PASS, "Clicked on Search button"); Reporter.log("Clicked on Search button", true); Thread.sleep(10000); //============Fetching space number and based on that clicking the radio button======================== JavascriptExecutor jse = (JavascriptExecutor) driver; List<WebElement> norows = driver.findElements(By.xpath( "//div[@id='onsiteUnitGrid']//div[@class='k-grid-content ps-container ps-active-y']//table//tbody//tr")); String space = null; if (norows.size() > 0) { Thread.sleep(10000); space = driver.findElement(By.xpath( "//div[@id='onsiteUnitGrid']//div[@class='k-grid-content ps-container ps-active-y']//table//tbody//tr[1]/td[4]")) .getText(); Reporter.log("space number is:" + space, true); } else { logger.log(LogStatus.INFO, "Application is not populating any data/space details"); } //String Space = "4008"; WebElement RdBtn_Space = driver.findElement(By.xpath( "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']")); logger.log(LogStatus.PASS, "check the radio button based on the space and click on the reservation button"); jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space); Thread.sleep(10000); jse.executeScript("arguments[0].click();", RdBtn_Space); logger.log(LogStatus.PASS, "Clicked on check box of a space in this location: " + space); Reporter.log("Clicked on check box of a space in this location: " + space, true); //generics.Page_ScrollDown(); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); //==================================================================================== SpaceDashboard_ThisLoc SpaceDashboard_ThisLoc = new SpaceDashboard_ThisLoc(driver); Thread.sleep(10000); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); SpaceDashboard_ThisLoc.click_Rent(); Thread.sleep(6000); logger.log(LogStatus.PASS, "Clicked on Rent button"); Reporter.log("Clicked on Rent button", true); Leasing_ConfirmSpace cnfmSpace = new Leasing_ConfirmSpace(driver); Thread.sleep(8000); //Add another space cnfmSpace.click_AddAnotherSpace(); //Thread.sleep(10000); logger.log(LogStatus.PASS, "Clicked on Add another space button"); stndstorage.click_SqFt50(); stndstorage.click_SqFt100(); stndstorage.click_SqFt150(); Thread.sleep(5000); logger.log(LogStatus.PASS, "Selected desired spaces"); stndstorage.click_Search(); logger.log(LogStatus.PASS, "Clicked on Search button"); Reporter.log("Clicked on Search button", true); //==================================================================================== List<WebElement> norows1 = driver.findElements(By.xpath( "//div[@class='onsite-list']//div[@class='k-grid-content ps-container ps-active-y']//table//tbody//tr")); String space1 = null; if (norows1.size() > 0) { Thread.sleep(10000); space1 = driver.findElement(By.xpath( "//div[@class='onsite-list']//div[@class='k-grid-content ps-container ps-active-y']//table//tbody//tr[1]/td[4]")) .getText(); Reporter.log("space number is:" + space1, true); } else { logger.log(LogStatus.INFO, "Application is not populating any data/space details"); } //String Space = "4008"; WebElement RdBtn_Space1 = driver.findElement(By.xpath( "//td[@class='grid-cell-space'][text()='" + space1 + "']/../td/input[@name='selectedIds']")); logger.log(LogStatus.PASS, "check the radio button based on the space and click on the reservation button"); jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space1); Thread.sleep(10000); jse.executeScript("arguments[0].click();", RdBtn_Space1); logger.log(LogStatus.PASS, "Clicked on check box of a space in this location: " + space1); Reporter.log("Clicked on check box of a space in this location: " + space1, true); //generics.Page_ScrollDown(); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); //====================================================================================== Thread.sleep(10000); //jse.executeScript("window.scrollBy(0,1000)", ""); EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(driver); eventFiringWebDriver.executeScript("document.getElementById('chooseSizeDialog').scrollTop =300"); //Thread.sleep(5000); /*swapVechpage.clk_btn_SwapSpace(); logger.log(LogStatus.INFO, "clicking on the swap space button");*/ Thread.sleep(8000); driver.findElement( By.xpath("//div[@class='OnSite unit-grid-section clearfix']//a[@id='addSpaceButton']")).click(); logger.log(LogStatus.PASS, "Clicked on Add space button"); Thread.sleep(10000); cnfmSpace.click_space_radiobtn1(); Thread.sleep(1000); logger.log(LogStatus.PASS, "selected first space"); //============================================================== cnfmSpace.clk_ConfirmwtCust(); Thread.sleep(10000); logger.log(LogStatus.PASS, "Clicked on confirm with customer button"); Reporter.log("Clicked on confirm with customer button", true); //switching to customer screen driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.PASS, "Switching to customer screen"); Reporter.log("Switching to customer screen", true); Thread.sleep(10000); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); WebElement confirmBtn = driver.findElement( By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")); Thread.sleep(10000); confirmBtn.click(); logger.log(LogStatus.PASS, "Clicked on confirm button"); Reporter.log("Clicked on confirm button", true); Thread.sleep(10000); //switching back to wc2 tab driver.switchTo().window(tabs.get(0)); Thread.sleep(5000); logger.log(LogStatus.PASS, "Switching back to PM screen"); Reporter.log("Switching back to PM screen", true); //Filling contact information Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver); Thread.sleep(5000); //String FN = "AUT" + generics.get_RandmString(); contactinfo.txt_Fname(tabledata.get("Firstname")); //contactinfo.txt_Fname(FN); contactinfo.txt_Lname(tabledata.get("LastName")); contactinfo.clickContact_State(); List<WebElement> allstates = driver.findElements( By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']")); //Identify the WebElement which will appear after scrolling down for (WebElement state : allstates) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } //contactinfo.select_State(tabledata.get("StateCode")); contactinfo.txt_Number(tabledata.get("DrivingLicenseNum")); contactinfo.txt_street1(tabledata.get("Street")); contactinfo.txt_city(tabledata.get("City")); contactinfo.select_State2address(); List<WebElement> allstatesadd = driver .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']")); for (WebElement state : allstatesadd) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } //contactinfo.select_State2(tabledata.get("State")); Thread.sleep(3000); contactinfo.txt_Zipcode(tabledata.get("Zipcode")); contactinfo.select_phoneType1(); Thread.sleep(3000); /*List<WebElement> phonTypes1= driver.findElements(By.xpath("//ul[@id='ContactForm_LesseePhones[_-index-__0]_Phone_PhoneTypeID_listbox')]//li[@class='k-item']")); //div[@id='ContactForm_LesseePhones[_-index-__0]_Phone_PhoneTypeID-list'] System.out.println(phonTypes1.size()); for(WebElement type: phonTypes1) { System.out.println(type.getText()); System.out.println(tabledata.get("PhoneType")); Thread.sleep(3000); if(tabledata.get("PhoneType").contains(type.getText().trim())) { type.click(); break; } }*/ driver.findElement( By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(), '" + tabledata.get("PhoneType") + " ')]")) .click(); Thread.sleep(2000); contactinfo.txt_AreaCode(tabledata.get("Areacode")); Thread.sleep(2000); contactinfo.txt_Exchg(tabledata.get("Exchange")); Thread.sleep(2000); contactinfo.txt_lineNumber(tabledata.get("LineNumber")); Thread.sleep(2000); contactinfo.txt_email(tabledata.get("Email")); Thread.sleep(2000); contactinfo.click_CustLookUp(); Thread.sleep(15000); // Click on New Customer button on Choose an Account PopUp driver.findElement(By.linkText("Create New Customer")).click(); // Select "No" Radio button for Military Thread.sleep(8000); driver.findElement(By.xpath("//label[@id='currently-military-false']/span[1]")).click(); // Click on Verify button Thread.sleep(5000); driver.findElement(By.partialLinkText("Verify")).click(); Thread.sleep(8000); if (contactinfo.verify_overrideAddress_Select()) { contactinfo.click_overrideAddress_Select(); } else if (contactinfo.verify_overridePhone_Select()) { contactinfo.click_overridePhone_Select(); } Thread.sleep(5000); driver.findElement(By.id("confirmWithCustomerButton")).click(); Thread.sleep(5000); //Click on Confirm with Cust button logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully"); // Navigating to Customer screen driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); //Declines to provide Emergency contact info EmergencyContactData con = new EmergencyContactData(driver); Thread.sleep(4000); con.click_decline_EmgcyContact(); logger.log(LogStatus.PASS, "Clicked on checkbox-decline to give Emergency contact"); Reporter.log("Clicked on checkbox-decline to give Emergency contact", true); Thread.sleep(6000); con.btn_confirmWithCust(); Thread.sleep(5000); logger.log(LogStatus.PASS, "Clicked on confirm with customer button"); Reporter.log("Clicked on confirm with customer button", true); //switching to customer screen driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.PASS, "Switching to customer screen"); Reporter.log("Switching to customer screen", true); Thread.sleep(5000); WebElement confirmBtn3 = driver.findElement( By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")); confirmBtn3.click(); logger.log(LogStatus.PASS, "Clicked on confirm button"); Reporter.log("Clicked on confirm button", true); Thread.sleep(10000); //switching back to wc2 tab driver.switchTo().window(tabs.get(0)); Thread.sleep(5000); logger.log(LogStatus.PASS, "Switching back to PM screen"); Reporter.log("Switching back to PM screen", true); Authorized_Access_Contacts auth = new Authorized_Access_Contacts(driver); auth.clk_savebutton(); Thread.sleep(10000); logger.log(LogStatus.PASS, "Clicked on save and proceed button successfully"); Reporter.log("Clicked on save and proceed button successfully", true); //verifying Amount data Leasing_EligiblePromotionsPage promo = new Leasing_EligiblePromotionsPage(driver); promo.clickSavenProceed(); logger.log(LogStatus.PASS, "Clicked on save and proceed button successfully"); Reporter.log("Clicked on save and proceed button successfully", true); Thread.sleep(8000); Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver); leaseQues.clickStorageContent(); Thread.sleep(5000); List<WebElement> allstorage = driver.findElements(By.xpath( "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']")); for (WebElement storage : allstorage) { if ((tabledata.get("StorageContent")).equalsIgnoreCase(storage.getText())) { storage.click(); break; } } //Insurance is ON Thread.sleep(5000); leaseQues.clickAddInsuranceNo(); logger.log(LogStatus.INFO, "clicked No Insurance"); Thread.sleep(10000); leaseQues.clickAccessZone(); Thread.sleep(10000); List<WebElement> allAccessZone = driver.findElements(By.xpath( "//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[@class='k-item']")); // String acsZone ="01-Normal-24HR"; for (WebElement accessZone : allAccessZone) { if ((tabledata.get("AccessZone")).equalsIgnoreCase(accessZone.getText())) { accessZone.click(); break; } } Thread.sleep(10000); /*List<WebElement> allKaypadZone= driver.findElements(By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__KeypadZone_listbox']//li[@class='k-item']")); //String keyZone="0- Gate 1"; for(WebElement keypadZone: allKaypadZone) { if((tabledata.get("KeypadZone")).equalsIgnoreCase(keypadZone.getText())) { keypadZone.click(); break; } }*/ leaseQues.clickKeypadZone(); Thread.sleep(3000); List<WebElement> allKaypadZone = driver.findElements(By.xpath( "//ul[@id='LeaseQuestionnaireUnits_0__KeypadZone_listbox']/li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li")); for (WebElement keypadZone : allKaypadZone) { if (keypadZone.getText().contains("0 - Gate 1")) { keypadZone.click(); break; } } Thread.sleep(10000); leaseQues.clickConfirmCust(); // switching to customer screen logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button"); Reporter.log("Clicked on Confirm with Customer button", true); Thread.sleep(2000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.PASS, "Switched to Customer Screen"); Reporter.log("Switched to Customer Screen", true); driver.findElement( By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click(); logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen"); Reporter.log("Clicked on Confirm button in customer screen", true); Thread.sleep(12000); List<WebElement> allCheckbox = driver.findElements( By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']")); for (WebElement checkbox : allCheckbox) { checkbox.click(); } Thread.sleep(5000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(3000); WebElement signature = driver.findElement( By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']")); Actions actionBuilder = new Actions(driver); Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature) .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature) .build(); drawAction.perform(); Thread.sleep(4000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(6000); driver.switchTo().window(tabs.get(0)); Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver); Thread.sleep(8000); review.clickApprove_btn(); Thread.sleep(8000); review.clickSaveproceed_btn(); Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver); Thread.sleep(15000); logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page"); rentalfee.clickConfirmCust_btn(); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(8000); Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver); Thread.sleep(2000); payment.clickPaymenetList(); logger.log(LogStatus.INFO, "Clicked on payment clk_PayThroughdropdwn dropdown "); Thread.sleep(2000); List<WebElement> lst = driver.findElements(By.xpath("//div[@class='k-animation-container']//ul//li")); Reporter.log("The size is:" + lst.size(), true); int Size = lst.size(); for (int i = 0; i < Size; i++) { if (i == 1) { lst.get(i).click(); break; } } // switching to customer screen logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button"); Reporter.log("Clicked on Confirm with Customer button", true); Thread.sleep(2000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.PASS, "Switched to Customer Screen"); Reporter.log("Switched to Customer Screen", true); driver.findElement( By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click(); logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen"); Reporter.log("Clicked on Confirm button in customer screen", true); Thread.sleep(2000); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.PASS, "Switching back to PM screen"); Reporter.log("Switching back to PM screen", true); // switched back to Main screen payment.clickPaymenetList(); Thread.sleep(3000); driver.findElement(By.xpath( "//div[@class='k-list-container k-popup k-group k-reset k-state-border-down']/ul/li[text()='Check']")) .click(); logger.log(LogStatus.PASS, "selected check option option"); Thread.sleep(6000); payment.clickmanualentry(); logger.log(LogStatus.INFO, "Clicking on Manual entry button successfully"); payment.Enter_routingNumber(tabledata.get("CheckRoutingNum")); logger.log(LogStatus.INFO, "Entering routing Number successfully"); payment.Enter_accountNumber(tabledata.get("CheckAccNum")); logger.log(LogStatus.INFO, "Entering Account Number successfully"); payment.Enter_checkNumber(tabledata.get("CheckNum")); logger.log(LogStatus.INFO, "Entering Check Number successfully"); Thread.sleep(5000); String amount = driver .findElement(By.xpath( "//div[text()='Total Remaining']/following-sibling::div[@ class='payment-row__now']")) .getText(); Thread.sleep(5000); payment.enterAmount(amount); //payment.Enter_checkAmount(tabledata.get("CheckAmount")); logger.log(LogStatus.INFO, "Entering Check amount successfully"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(6000); payment.Select_autopaycheckbox(); logger.log(LogStatus.INFO, "Select Auto pay enable checkbox successfully"); payment.clickApply_btn(); Thread.sleep(5000); Thread.sleep(6000); payment.click_CollectSignature(); logger.log(LogStatus.INFO, "Click on Collect signature button successfully"); Thread.sleep(6000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); WebElement signature1 = driver .findElement(By.xpath("//div[@class='signature-area']/canvas[@class='signature-pad']")); Actions actionBuilder1 = new Actions(driver); Action drawAction1 = actionBuilder1.moveToElement(signature1, 660, 96).click().clickAndHold(signature1) .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature1) .build(); drawAction1.perform(); Thread.sleep(6000); payment.clickAccept_Btn(); logger.log(LogStatus.INFO, "Cust Signature and click on Accept button successfully"); Thread.sleep(6000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(10000); payment.clickApprove_Btn(); logger.log(LogStatus.INFO, "Click on Approve button successfully"); Thread.sleep(6000); payment.clickSubmit_btn(); logger.log(LogStatus.INFO, "Click on Submit button successfully"); driver.findElement(By.id("employeeNumber")).sendKeys("930326"); Thread.sleep(2000); driver.findElement(By.partialLinkText("Ok")).click(); Thread.sleep(2000); Thread.sleep(5000); if (driver.findElement(By.xpath("//a[contains(text(),'No')]")).isDisplayed()) { driver.findElement(By.xpath("//a[contains(text(),'No')]")).click(); } else if (driver.findElement(By.xpath("//a[contains(text(),'Ok')]")).isDisplayed()) { driver.findElement(By.xpath("//a[contains(text(),'Ok')]")).click(); } Thread.sleep(15000); pmhomepage.clk_AdvSearchLnk(); Thread.sleep(8000); Advance_Search advSearch = new Advance_Search(driver); String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='" + tabledata.get("FirstName") + "'andlastname='" + tabledata.get("LastName") + "'))"; String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery); advSearch.enterAccNum(accNUm); //advSearch.enterAccNum("45226383"); Thread.sleep(5000); logger.log(LogStatus.INFO, "Entered acc num successfully"); advSearch.clickSearchAccbtn(); logger.log(LogStatus.INFO, "Click on search button successfully"); Thread.sleep(8000); Cust_AccDetailsPage cust_accdetails = new Cust_AccDetailsPage(driver); String toatlDueNowAmtAfterMakePymt = cust_accdetails.getTotalDueNow(); logger.log(LogStatus.PASS, "Total due now amount after making payment in customer dashbaord is:" + toatlDueNowAmtAfterMakePymt); Thread.sleep(1000); //String nextPymtDueAmtAftermakePymt=cust_accdetails.get_NextPymtDueAmount(); //logger.log(LogStatus.PASS, "Next Payment due amount after making payment is:"+nextPymtDueAmtAftermakePymt); cust_accdetails.clk_Acc_ActivitiesTab(); logger.log(LogStatus.INFO, "Click on Account activities tab successfully"); Thread.sleep(10000); cust_accdetails.clk_CheckExpandLink(); logger.log(LogStatus.INFO, "Clicked on expand button in first row"); Thread.sleep(6000); cust_accdetails.clk_ReversePaymntLnk(); logger.log(LogStatus.INFO, "Clicked on Reverse Payment link"); Thread.sleep(8000); ReversePaymentPage ReversePayment = new ReversePaymentPage(driver); boolean rev = driver.findElement(By.xpath("//h3[contains(text(),'Reverse Payment')]")).isDisplayed(); if (rev) { String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "Reverse Payment screen is displayed successfully"); logger.log(LogStatus.INFO, "Reverse Payment screen is displayed successfully", image); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "Reverse Payment screen is not displayed "); logger.log(LogStatus.INFO, "Reverse Payment screen is not displayed ", image); } //ReversePayment.Clk_RdBtn_Yes(); //logger.log(LogStatus.INFO, "Clicked on No radio button"); ReversePayment.clickReason(); logger.log(LogStatus.INFO, "Clicked on Reason drop down"); //ReversePayment.SelectValueFromReasonList("Misapplied Payment"); ReversePayment.SelectValueFromReasonListeason(); logger.log(LogStatus.INFO, "Select value from Reason dropdown"); ReversePayment.enter_Note( "PM received a Bad check from bank for a customer payment so reversing the payment"); logger.log(LogStatus.INFO, "Entered note"); ReversePayment.click_ReverseBtn(); logger.log(LogStatus.INFO, "Clicked on Reverse button"); Thread.sleep(6000); TransactionReversedPage trnspage = new TransactionReversedPage(driver); trnspage.enter_EmployeeId(tabledata.get("UserName")); logger.log(LogStatus.INFO, "Entered EmployeeID"); Thread.sleep(3000); trnspage.click_OkBtn(); logger.log(LogStatus.INFO, "Clicked on OK button"); Thread.sleep(6000); if (cust_accdetails.isCustdbTitleDisplayed()) { logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully"); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; logger.log(LogStatus.FAIL, "customer Dashboard is not displayed "); } Thread.sleep(1000); String toatlDueNowAmtAfterReversePymt = cust_accdetails.getTotalDueNow(); logger.log(LogStatus.PASS, "Total due now amount after reverse payment in customer dashbaord is:" + toatlDueNowAmtAfterReversePymt); Thread.sleep(1000); //String nextPymtDueAmtAfterReversePymt=cust_accdetails.get_NextPymtDueAmount(); //logger.log(LogStatus.PASS, "Next Payment due amount after reverse payment is:"+nextPymtDueAmtAfterReversePymt); /*if(toatlDueNowAmtAfterReversePymt.equals(toatlDueNowAmtBeforeMakePymt)){ String scpath=Generic_Class.takeScreenShotPath(); String image=logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "Total due now amount before making and after reversing the payment is same and changes data are reflecting properly in Customer Dashboard sucessfully"); logger.log(LogStatus.INFO, "Total due now amount before making and after reversing the payment is same and changes data are reflecting properly in Customer Dashboard sucessfully",image); }else{ if(resultFlag.equals("pass")) resultFlag="fail"; String scpath=Generic_Class.takeScreenShotPath(); String image=logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "Total due now amount before making and after reversing the payment is not same and changes data are not reflecting properly in Customer Dashboard "); logger.log(LogStatus.INFO, "Total due now amount before making and after reversing the payment is not same and changes data are not reflecting properly in Customer Dashboard ",image); }*/ } catch (Exception ex) { ex.printStackTrace(); resultFlag = "fail"; Reporter.log("Exception ex: " + ex, true); logger.log(LogStatus.FAIL, "Test Script fail due to exception"); } }
From source file:Scenarios.Payments.MakePayment_WithInsurance.java
@Test(dataProvider = "getLoginData") public void Leasing_LeaseWithInsurance(Hashtable<String, String> tabledata) throws Exception { if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Leasing").equals("Y"))) { resultFlag = "skip"; logger.log(LogStatus.SKIP, "Leasing_LeaseWithInsurance is Skipped"); throw new SkipException("Skipping the test Leasing_LeaseWithInsurance"); }//from w ww .ja v a2s.c o m Reporter.log("Test Case Started", true); Thread.sleep(5000); try { logger = extent.startTest("Leasing_LeaseWithInsurance", "Lease with insurance"); testcaseName = tabledata.get("TestCases"); Reporter.log("Test case started: " + testcaseName, true); Thread.sleep(5000); JavascriptExecutor jse = (JavascriptExecutor) driver; LoginPage loginPage = new LoginPage(driver); logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully "); Thread.sleep(2000); loginPage.enterUserName(tabledata.get("UserName")); Thread.sleep(2000); logger.log(LogStatus.PASS, "entered username sucessfully"); Thread.sleep(2000); loginPage.enterPassword(tabledata.get("Password")); logger.log(LogStatus.PASS, "entered password sucessfully"); Thread.sleep(2000); loginPage.clickLogin(); logger.log(LogStatus.PASS, "clicked on login in button sucessfully"); logger.log(LogStatus.PASS, "Login to Application successfully"); // =================Handling customer facing device======================== Thread.sleep(5000); Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver); logger.log(LogStatus.INFO, "PopUp window object is created successfully"); String biforstNum = Bifrostpop.getBiforstNo(); Reporter.log(biforstNum + "", true); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t"); ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles()); Reporter.log(tabs.size() + "", true); driver.switchTo().window(tabs.get(1)); driver.get(Generic_Class.getPropertyValue("CustomerScreenPath")); List<WebElement> biforstSystem = driver.findElements( By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']")); for (WebElement ele : biforstSystem) { if (biforstNum.equalsIgnoreCase(ele.getText().trim())) { Reporter.log(ele.getText() + "", true); ele.click(); break; } } driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(5000); driver.switchTo().window(tabs.get(0)); Thread.sleep(5000); driver.findElement(By.xpath( "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']")) .click(); Thread.sleep(5000); // ================================================================================= Thread.sleep(3000); PM_Homepage pmhomepage = new PM_Homepage(driver); logger.log(LogStatus.PASS, "creating object for the PM home page sucessfully"); if (pmhomepage.get_WlkInCustText().trim().contains("Walk-In Customer")) { String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "Walk in customer window displayed sucessfully"); logger.log(LogStatus.INFO, "Walk in customer window displayed sucessfully", image); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "Walk in customer window is not displayed"); logger.log(LogStatus.INFO, "Walk in customer window is not displayed", image); } if (pmhomepage.isFindAndLeaseButtonDisplayed()) { logger.log(LogStatus.PASS, "Find and Lease button displayed sucessfully on Walk in customer window"); } else { logger.log(LogStatus.FAIL, "Find and Lease button is not displayed sucessfully on Walk in customer window"); } if (pmhomepage.isFindAnExtReservationTextFieldDisplayed()) { logger.log(LogStatus.PASS, "Or Find an Existing Reservation text field is dispalyed sucessfully on Walk in customer window"); } else { logger.log(LogStatus.FAIL, "Or Find an Existing Reservation text field is not dispalyed sucessfully on Walk in customer window"); } if (pmhomepage.isFindReservationDispalyed()) { logger.log(LogStatus.PASS, "Find reservation button is dispalyed sucessfully on Walk in customer window"); } else { logger.log(LogStatus.FAIL, "Find reservation button is not dispalyed sucessfully on Walk in customer window"); } pmhomepage.clk_findAndLeaseSpace(); logger.log(LogStatus.INFO, "Click on Find And Lease Space Link successfully"); Thread.sleep(4000); StandardStoragePage stdStorage = new StandardStoragePage(driver); logger.log(LogStatus.PASS, "Creating object for the Standard stroage page sucessfully"); Thread.sleep(1000); if (stdStorage.isSelected_yesradiobutton()) { logger.log(LogStatus.PASS, "New Customer Radio button selected by default when WALK-INS: FIND A SPACE page is launched sucessfully"); } else { logger.log(LogStatus.FAIL, "New Customer Radio button is not selected by default when WALK-INS: FIND A SPACE page is launched sucessfully"); } stdStorage.Clk_ChkBx_AvlSpace(); logger.log(LogStatus.PASS, "Clicked on available bold space size checkbox in StandardStorage sucessfully"); stdStorage.click_Search(); logger.log(LogStatus.INFO, "Click on search button successfully"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); // =====================Fetching space number and based on that clicking the radio button======================== Thread.sleep(10000); List<WebElement> norows = driver .findElements(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr")); String space = null; logger.log(LogStatus.INFO, "Total number of avaiable sizes count is------>:" + norows.size()); if (norows.size() > 0) { Thread.sleep(5000); space = driver.findElement(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr[1]/td[4]")) .getText(); Reporter.log("space number is:" + space, true); } else { logger.log(LogStatus.FAIL, "Application is not populating any data/space details with selected size dimension"); throw new Exception("Application is not populating any data/space details"); } Thread.sleep(2000); WebElement RdBtn_Space = driver.findElement(By.xpath( "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']")); logger.log(LogStatus.PASS, "check the radio button based on the space and click on the reservation button"); Thread.sleep(5000); jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space); jse.executeScript("arguments[0].click();", RdBtn_Space); logger.log(LogStatus.PASS, "Clicked on check box of a space in this location:-------> " + space); Reporter.log("Clicked on check box of a space in this location: " + space, true); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); SpaceDashboard_ThisLoc thisloc = new SpaceDashboard_ThisLoc(driver); logger.log(LogStatus.PASS, "creating object for the This location page sucessfully"); thisloc.click_Rent(); logger.log(LogStatus.PASS, "clicked on the rent button sucessfully"); Thread.sleep(5000); Leasing_ConfirmSpace confirmSpace = new Leasing_ConfirmSpace(driver); Thread.sleep(5000); confirmSpace.clk_ConfirmwtCust(); logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button"); Reporter.log("Clicked on Confirm with Customer button", true); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(5000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.PASS, "Switched to Customer Screen"); Reporter.log("Switched to Customer Screen", true); Thread.sleep(9000); String monthlyRent = driver .findElement(By.xpath("//table[@class='spaces']/tbody//tr//td[@class='monthly-rent']")) .getText(); driver.findElement( By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click(); logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen"); Reporter.log("Clicked on Confirm button in customer screen", true); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.PASS, "Switching back to screen"); Reporter.log("Switching back to screen", true); // Filling contact information Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver); Thread.sleep(5000); String FN = "AUT" + Generic_Class.get_RandmString(); contactinfo.txt_Fname(FN); contactinfo.txt_Lname(tabledata.get("LastName")); contactinfo.clickContact_State(); List<WebElement> allstates = driver.findElements( By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']")); // Identify the WebElement which will appear after scrolling down for (WebElement state : allstates) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } // contactinfo.select_State(tabledata.get("StateCode")); contactinfo.txt_Number(tabledata.get("DrivingLicenseNum")); contactinfo.txt_street1(tabledata.get("Street")); contactinfo.txt_city(tabledata.get("City")); contactinfo.select_State2address(); List<WebElement> allstatesadd = driver .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']")); for (WebElement state : allstatesadd) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } // contactinfo.select_State2(tabledata.get("State")); Thread.sleep(3000); contactinfo.txt_Zipcode(tabledata.get("Zipcode")); contactinfo.select_phoneType1(); Thread.sleep(3000); driver.findElement( By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(),'" + tabledata.get("PhoneType") + " ')]")) .click(); Thread.sleep(2000); contactinfo.txt_AreaCode(tabledata.get("Areacode")); Thread.sleep(2000); contactinfo.txt_Exchg(tabledata.get("Exchange")); Thread.sleep(2000); contactinfo.txt_lineNumber(tabledata.get("LineNumber")); Thread.sleep(2000); contactinfo.txt_email(tabledata.get("Email")); Thread.sleep(2000); contactinfo.click_CustLookUp(); Thread.sleep(15000); // Click on New Customer button on Choose an Account PopUp driver.findElement(By.linkText("Create New Customer")).click(); Thread.sleep(8000); contactinfo.clk_ActiveDutyMilitaryNoRadioBtn(driver); // Click on Verify button Thread.sleep(5000); driver.findElement(By.partialLinkText("Verify")).click(); logger.log(LogStatus.INFO, "cliked on the Verify button button "); Thread.sleep(9000); driver.findElement(By.id("confirmWithCustomerButton")).click(); Thread.sleep(5000); // Click on Confirm with Cust button logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully"); // Navigating to Customer screen driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); // Entering Emergency Contact details Thread.sleep(5000); Leasing_EmergencyConatctsPage emergCon = new Leasing_EmergencyConatctsPage(driver); Thread.sleep(2000); emergCon.clickAuthorizedfor_radio(); Thread.sleep(2000); emergCon.click_custDeclines_chkBox(); emergCon.clickconfirmWithCust(); Thread.sleep(4000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(8000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(2000); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Leasing_AuthorizedAccessContactsPage autContact = new Leasing_AuthorizedAccessContactsPage(driver); Thread.sleep(8000); autContact.clickSavenProceed(); Thread.sleep(8000); Leasing_EligiblePromotionsPage eligpromo = new Leasing_EligiblePromotionsPage(driver); logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page"); eligpromo.clickSavenProceed(); Thread.sleep(8000); Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver); leaseQues.clickStorageContent(); Thread.sleep(5000); List<WebElement> allstorage = driver.findElements(By.xpath( "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']")); for (WebElement storage : allstorage) { if (tabledata.get("StorageContent").equalsIgnoreCase(storage.getText())) { storage.click(); break; } } // Insurance is ON Thread.sleep(5000); if (leaseQues.isInsuranceYesRadioBtnDisplayed()) { String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "Add insurance option available in the page"); logger.log(LogStatus.INFO, "Add insurance option available in the page", image); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "Add insurance option is not there in the page"); logger.log(LogStatus.INFO, "Add insurance option is not there in the page", image); } Thread.sleep(3000); leaseQues.clickAddInsuranceYes(); logger.log(LogStatus.PASS, "Selecting Insurance yes Radio button to add insurnace"); Thread.sleep(1000); leaseQues.clickCoverageList(); Thread.sleep(5000); driver.findElement(By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__InsuranceSelection_listbox']/li[2]")) .click(); Thread.sleep(5000); leaseQues.clickAccessZone(); Thread.sleep(2000); driver.findElement( By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[2]")) .click(); Thread.sleep(5000); leaseQues.clickKeypadZone(); Thread.sleep(2000); driver.findElement( By.xpath("//li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li[1]")).click(); Thread.sleep(5000); leaseQues.clickConfirmCust(); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(12000); List<WebElement> allCheckbox = driver.findElements( By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']")); for (WebElement checkbox : allCheckbox) { checkbox.click(); } Thread.sleep(5000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(3000); WebElement signature = driver.findElement( By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']")); Actions actionBuilder = new Actions(driver); Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature) .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature) .build(); drawAction.perform(); Thread.sleep(4000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(6000); driver.switchTo().window(tabs.get(0)); Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver); Thread.sleep(8000); review.clickApprove_btn(); Thread.sleep(8000); review.clickSaveproceed_btn(); Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver); Thread.sleep(15000); logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page"); rentalfee.clickConfirmCust_btn(); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(8000); Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver); logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully "); Thread.sleep(2000); String screen = Generic_Class.takeScreenShotPath(); String imga = logger.addScreenCapture(screen); logger.log(LogStatus.PASS, "Payment page is dispalyed sucessfully "); logger.log(LogStatus.INFO, "Payment page is dispalyed sucessfully", imga); String MonthlyRentDueNowAmount = payment.get_MonthlyRentDueNowAmt(); logger.log(LogStatus.PASS, "Monthly Rent Due Now amount in payment page is------>:" + MonthlyRentDueNowAmount); String PromotionDueNowAmount = payment.get_PromotionDueNowAmt(); logger.log(LogStatus.PASS, "Promotion Due Now amount in payment page is------>:" + PromotionDueNowAmount); String InsuranceNowAmount = payment.get_InsuranceDueNowAmt(); logger.log(LogStatus.PASS, "Insurance Due Now amount in payment page is------>:" + InsuranceNowAmount); String AdministrativeDueNowAmount = payment.get_AdministrativeDueNowAmt(); logger.log(LogStatus.PASS, "Administrative Due Now amount in payment page is------>:" + AdministrativeDueNowAmount); String PayThroughDueNowAmount = payment.get_PaythroughDueNowAmt(); logger.log(LogStatus.PASS, "PayThrough Due Now amount in payment page is------>:" + PayThroughDueNowAmount); String MerchandiseAmount = payment.get_MerchandiseAmt(); logger.log(LogStatus.PASS, "MerchandiseAmount amount in payment page is------>:" + MerchandiseAmount); String TotalRemaingBalanceAmt = payment.get_TotalRemaingBalanceAmt(); logger.log(LogStatus.PASS, "Total Remaing Balance Amount in payment page is------>:" + TotalRemaingBalanceAmt); double MonthlyRentamt = payment.getDoubleAmount(MonthlyRentDueNowAmount); double Promotionamt = payment.getDoubleAmount(PromotionDueNowAmount); double Insuranceamt = payment.getDoubleAmount(InsuranceNowAmount); double Administrativeamt = payment.getDoubleAmount(AdministrativeDueNowAmount); double Apythroughamt = payment.getDoubleAmount(PayThroughDueNowAmount); double Merchandiseamt = payment.getDoubleAmount(MerchandiseAmount); double TotalAmount = MonthlyRentamt + Promotionamt + Insuranceamt + Administrativeamt + Apythroughamt + Merchandiseamt; double TotalRemUiVal = payment.getDoubleAmount(TotalRemaingBalanceAmt); Double db1 = new Double(TotalAmount); Double db2 = new Double(TotalRemUiVal); if (db1.intValue() == db2.intValue()) { String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, "Sumantion of all due amount and Total remaing amount are equal"); logger.log(LogStatus.INFO, "Sumantion of all due amount and Total remaing amount are equal", im); } else { String scp = Generic_Class.takeScreenShotPath(); String ima = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "Sumantion of all due is amount and Total remaing amount are not equal"); logger.log(LogStatus.INFO, "Sumantion of all due is amount and Total remaing amount are not equal", ima); } Thread.sleep(3000); payment.selectPaymentMethod("Cash", driver); logger.log(LogStatus.PASS, "selecting cash option from the dropdown"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); payment.enter_CashAmount(TotalRemaingBalanceAmt); logger.log(LogStatus.PASS, "entered total balance amount to pay"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); payment.clickApply_btn(); logger.log(LogStatus.PASS, "clicked on the apply button"); Thread.sleep(3000); payment.clk_ConfirmWthCustBtn(); logger.log(LogStatus.PASS, "clicked on the ConfirmWthCustBtn button"); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(5000); payment.clickSubmit_btn(); logger.log(LogStatus.PASS, "clicked on the submit button in payment page"); Thread.sleep(3000); TransactionCompletePopup popup = new TransactionCompletePopup(driver); String path = Generic_Class.takeScreenShotPath(); String ima = logger.addScreenCapture(path); logger.log(LogStatus.PASS, "TransactionCompletePopup dispalyed sucessfully"); logger.log(LogStatus.INFO, "TransactionCompletePopup dispalyed sucessfully", ima); popup.enterEmpNum(tabledata.get("UserName")); logger.log(LogStatus.PASS, "entered the employee id"); Thread.sleep(3000); popup.clickOk_btn(); logger.log(LogStatus.PASS, "clicked on the ok button"); Thread.sleep(3000); driver.findElement(By.xpath("//div[@class='k-widget k-window']//a[contains(text(),'No')]")).click(); Thread.sleep(8000); if (pmhomepage.isexistingCustomerModelDisplayed()) { String pa = Generic_Class.takeScreenShotPath(); String img1 = logger.addScreenCapture(pa); logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", img1); } else { String scp = Generic_Class.takeScreenShotPath(); String imag = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "PM DashBoard dispalyed is not displayed"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed is not displayed", imag); } Thread.sleep(2000); pmhomepage.clk_AdvSearchLnk(); logger.log(LogStatus.PASS, "clicked on the submit button"); Thread.sleep(6000); Advance_Search advSearch = new Advance_Search(driver); String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='" + FN + "'andlastname='" + tabledata.get("LastName") + "'))"; String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery); Thread.sleep(6000); logger.log(LogStatus.PASS, "fetched account number from databse and account number is:" + accNUm); advSearch.enterAccNum(accNUm); logger.log(LogStatus.PASS, "entered account number"); Thread.sleep(5000); advSearch.clickSearchAccbtn(); logger.log(LogStatus.PASS, "clicked on the search button in advance search page"); Cust_AccDetailsPage cust = new Cust_AccDetailsPage(driver); Thread.sleep(8000); if (cust.isCustdbTitleDisplayed()) { String sap = Generic_Class.takeScreenShotPath(); String mag = logger.addScreenCapture(sap); logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully"); logger.log(LogStatus.INFO, "customer Dashboard is displayed successfully", mag); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scan = Generic_Class.takeScreenShotPath(); String mg = logger.addScreenCapture(scan); logger.log(LogStatus.FAIL, "customer Dashboard is not displayed "); logger.log(LogStatus.INFO, "customer Dashboard is not displayed ", mg); } Thread.sleep(1000); String totalDueNowAmount = cust.getTotalDue(); logger.log(LogStatus.PASS, "Total due now amount in customer dashbaord is---> :" + totalDueNowAmount); Double db3 = new Double(payment.getDoubleAmount(totalDueNowAmount)); if (db3.intValue() == 0) { String sap = Generic_Class.takeScreenShotPath(); String mag = logger.addScreenCapture(sap); logger.log(LogStatus.PASS, "Payment done successfully and changes reflecting in customer dash board"); logger.log(LogStatus.INFO, "Payment done successfully and changes reflecting in customer dash board", mag); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scan = Generic_Class.takeScreenShotPath(); String mg = logger.addScreenCapture(scan); logger.log(LogStatus.FAIL, "Payment not done successfully "); logger.log(LogStatus.INFO, "Payment not done successfully ", mg); } Thread.sleep(1000); // Verify Total Due Now is available if (cust.getTotalDueNowTxt().contains("Total Due Now")) { Thread.sleep(2000); String scp = Generic_Class.takeScreenShotPath(); String img = logger.addScreenCapture(scp); logger.log(LogStatus.PASS, "Total Due Now is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Total Due Now is displayed successfully", img); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scp = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "Total Due Now is not displayed successfully"); logger.log(LogStatus.FAIL, "Total Due Now is not displayed successfully", im); } // Verify Next Due is available if (cust.getNextPaymentDueTxt().contains("Next Payment Due")) { Thread.sleep(2000); String scp = Generic_Class.takeScreenShotPath(); String img = logger.addScreenCapture(scp); logger.log(LogStatus.PASS, "Next Payment Due is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Next Payment Due is displayed successfully", img); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Next Payment Due is not displayed successfully"); logger.log(LogStatus.FAIL, "Next Payment Due is not displayed successfully", im); } // Verify Make Payment is available if (cust.getMakePaymentTxt().contains("Make Payment")) { Thread.sleep(4000); String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, "Make Payment is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Make Payment is displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Make Payment is not displayed successfully"); logger.log(LogStatus.FAIL, "Make Payment is not displayed successfully", im); } // Verify Manage AutoPay is available if (cust.getManageAutoPayTxt().contains("Manage AutoPay")) { Thread.sleep(2000); String st = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(st); logger.log(LogStatus.PASS, "Manage AutoPay is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Manage AutoPay is displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String st = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(st); logger.log(LogStatus.FAIL, "Manage AutoPay is not displayed successfully"); logger.log(LogStatus.FAIL, "Manage AutoPay is not displayed successfully", im); } // Verify Create Note is available if (cust.getCreateNoteTxt().contains("Create Note")) { Thread.sleep(2000); String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, "Create Note is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Create Note is displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Create Note is not displayed successfully"); logger.log(LogStatus.FAIL, "Create Note is not displayed successfully", im); } // Verify Important Information is available if (cust.getImportantInformationTxt().contains("Important Information")) { Thread.sleep(2000); String sch = Generic_Class.takeScreenShotPath(); String ie = logger.addScreenCapture(sch); logger.log(LogStatus.PASS, "Important Information is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Important Information is displayed successfully", ie); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sch = Generic_Class.takeScreenShotPath(); String imge = logger.addScreenCapture(sch); logger.log(LogStatus.FAIL, "Important Information is not displayed successfully"); logger.log(LogStatus.FAIL, "Important Information is not displayed successfully", imge); } // Verify Customer Info Tab is available if (cust.getCustomerInfoTabTxt().contains("Customer Info")) { Thread.sleep(2000); String sch = Generic_Class.takeScreenShotPath(); String ie = logger.addScreenCapture(sch); logger.log(LogStatus.PASS, "Customer Info tab displayed successfully" + cust.getCustomerInfoTabTxt()); logger.log(LogStatus.PASS, "Customer Info tab displayed successfully", ie); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scr = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(scr); logger.log(LogStatus.FAIL, "Customer Info tab not displayed successfully"); logger.log(LogStatus.FAIL, "Customer Info tab not displayed successfully", im); } // Verify Space Details tab is available if (cust.getSpaceDetailsTabTxt().contains("Space Details")) { Thread.sleep(2000); String scp = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(scp); logger.log(LogStatus.PASS, " Space Details tab displayed successfully" + cust.getSpaceDetailsTabTxt()); logger.log(LogStatus.PASS, " Space Details tab displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sr = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sr); logger.log(LogStatus.FAIL, "Space Details tab not displayed successfully"); logger.log(LogStatus.FAIL, "Space Details tab not displayed successfully", im); } // Verify Account Activities tab is available if (cust.getAccountActivitiesTabTxt().contains("Account Activities")) { Thread.sleep(2000); String scp = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(scp); logger.log(LogStatus.PASS, " Account Activitiestab displayed successfully" + cust.getAccountActivitiesTabTxt()); logger.log(LogStatus.PASS, " Account Activities tab displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Account Activities tab not displayed successfully"); logger.log(LogStatus.FAIL, "Account Activities tab not displayed successfully", im); } // Verify Documents tab is available if (cust.getDocumentsTabTxt().contains("Documents")) { Thread.sleep(2000); String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, " Documents tab displayed successfully" + cust.getDocumentsTabTxt()); logger.log(LogStatus.PASS, " Documents tab displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Documents tab not displayed successfully"); logger.log(LogStatus.FAIL, "Documents tab not displayed successfully", im); } if (cust.getCustSpaceNum().trim().contains(space)) { logger.log(LogStatus.PASS, "Application is displaying correct space number in the customer dashboard"); } else { logger.log(LogStatus.PASS, "Application is not displaying correct space number in the customer dashboard"); } if (cust.getEmailid(tabledata.get("Email"))) { logger.log(LogStatus.PASS, "Application is displaying correct email id in the customer info tab"); } else { logger.log(LogStatus.FAIL, "Application is not displaying correct email id in the customer info tab"); } } catch (Exception e) { resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "PM Dash board page is not displayed", image); e.printStackTrace(); } }
From source file:Scenarios.Payments.MakePayment_WithoutInsurance.java
@Test(dataProvider = "getLoginData") public void Leasing_LeaseWithInsurance(Hashtable<String, String> tabledata) throws Exception { if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Leasing").equals("Y"))) { resultFlag = "skip"; logger.log(LogStatus.SKIP, "Leasing_LeaseWithInsurance is Skipped"); throw new SkipException("Skipping the test Leasing_LeaseWithInsurance"); }/*from w w w . j a v a2s .c om*/ Reporter.log("Test Case Started", true); Thread.sleep(5000); try { logger = extent.startTest("Leasing_LeaseWithInsurance", "Lease with insurance"); testcaseName = tabledata.get("TestCases"); Reporter.log("Test case started: " + testcaseName, true); Thread.sleep(5000); JavascriptExecutor jse = (JavascriptExecutor) driver; LoginPage loginPage = new LoginPage(driver); logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully "); Thread.sleep(2000); loginPage.enterUserName(tabledata.get("UserName")); Thread.sleep(2000); logger.log(LogStatus.PASS, "entered username sucessfully"); Thread.sleep(2000); loginPage.enterPassword(tabledata.get("Password")); logger.log(LogStatus.PASS, "entered password sucessfully"); Thread.sleep(2000); loginPage.clickLogin(); logger.log(LogStatus.PASS, "clicked on login in button sucessfully"); logger.log(LogStatus.PASS, "Login to Application successfully"); // =================Handling customer facing device======================== Thread.sleep(5000); Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver); logger.log(LogStatus.INFO, "PopUp window object is created successfully"); String biforstNum = Bifrostpop.getBiforstNo(); Reporter.log(biforstNum + "", true); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t"); ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles()); Reporter.log(tabs.size() + "", true); driver.switchTo().window(tabs.get(1)); driver.get(Generic_Class.getPropertyValue("CustomerScreenPath")); List<WebElement> biforstSystem = driver.findElements( By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']")); for (WebElement ele : biforstSystem) { if (biforstNum.equalsIgnoreCase(ele.getText().trim())) { Reporter.log(ele.getText() + "", true); ele.click(); break; } } driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(5000); driver.switchTo().window(tabs.get(0)); Thread.sleep(5000); driver.findElement(By.xpath( "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']")) .click(); Thread.sleep(5000); // ================================================================================= Thread.sleep(3000); PM_Homepage pmhomepage = new PM_Homepage(driver); logger.log(LogStatus.PASS, "creating object for the PM home page sucessfully"); if (pmhomepage.get_WlkInCustText().trim().contains("Walk-In Customer")) { String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "Walk in customer window displayed sucessfully"); logger.log(LogStatus.INFO, "Walk in customer window displayed sucessfully", image); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "Walk in customer window is not displayed"); logger.log(LogStatus.INFO, "Walk in customer window is not displayed", image); } if (pmhomepage.isFindAndLeaseButtonDisplayed()) { logger.log(LogStatus.PASS, "Find and Lease button displayed sucessfully on Walk in customer window"); } else { logger.log(LogStatus.FAIL, "Find and Lease button is not displayed sucessfully on Walk in customer window"); } if (pmhomepage.isFindAnExtReservationTextFieldDisplayed()) { logger.log(LogStatus.PASS, "Or Find an Existing Reservation text field is dispalyed sucessfully on Walk in customer window"); } else { logger.log(LogStatus.FAIL, "Or Find an Existing Reservation text field is not dispalyed sucessfully on Walk in customer window"); } if (pmhomepage.isFindReservationDispalyed()) { logger.log(LogStatus.PASS, "Find reservation button is dispalyed sucessfully on Walk in customer window"); } else { logger.log(LogStatus.FAIL, "Find reservation button is not dispalyed sucessfully on Walk in customer window"); } pmhomepage.clk_findAndLeaseSpace(); logger.log(LogStatus.INFO, "Click on Find And Lease Space Link successfully"); Thread.sleep(4000); StandardStoragePage stdStorage = new StandardStoragePage(driver); logger.log(LogStatus.PASS, "Creating object for the Standard stroage page sucessfully"); Thread.sleep(1000); if (stdStorage.isSelected_yesradiobutton()) { logger.log(LogStatus.PASS, "New Customer Radio button selected by default when WALK-INS: FIND A SPACE page is launched sucessfully"); } else { logger.log(LogStatus.FAIL, "New Customer Radio button is not selected by default when WALK-INS: FIND A SPACE page is launched sucessfully"); } stdStorage.Clk_ChkBx_AvlSpace(); logger.log(LogStatus.PASS, "Clicked on available bold space size checkbox in StandardStorage sucessfully"); stdStorage.click_Search(); logger.log(LogStatus.INFO, "Click on search button successfully"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); // =====================Fetching space number and based on that clicking the radio button======================== Thread.sleep(10000); List<WebElement> norows = driver .findElements(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr")); String space = null; logger.log(LogStatus.INFO, "Total number of avaiable sizes count is------>:" + norows.size()); if (norows.size() > 0) { Thread.sleep(5000); space = driver.findElement(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr[1]/td[4]")) .getText(); Reporter.log("space number is:" + space, true); } else { logger.log(LogStatus.FAIL, "Application is not populating any data/space details with selected size dimension"); throw new Exception("Application is not populating any data/space details"); } Thread.sleep(2000); WebElement RdBtn_Space = driver.findElement(By.xpath( "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']")); logger.log(LogStatus.PASS, "check the radio button based on the space and click on the reservation button"); Thread.sleep(5000); jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space); jse.executeScript("arguments[0].click();", RdBtn_Space); logger.log(LogStatus.PASS, "Clicked on check box of a space in this location:-------> " + space); Reporter.log("Clicked on check box of a space in this location: " + space, true); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); SpaceDashboard_ThisLoc thisloc = new SpaceDashboard_ThisLoc(driver); logger.log(LogStatus.PASS, "creating object for the This location page sucessfully"); thisloc.click_Rent(); logger.log(LogStatus.PASS, "clicked on the rent button sucessfully"); Thread.sleep(5000); Leasing_ConfirmSpace confirmSpace = new Leasing_ConfirmSpace(driver); Thread.sleep(5000); confirmSpace.clk_ConfirmwtCust(); logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button"); Reporter.log("Clicked on Confirm with Customer button", true); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(5000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.PASS, "Switched to Customer Screen"); Reporter.log("Switched to Customer Screen", true); Thread.sleep(9000); String monthlyRent = driver .findElement(By.xpath("//table[@class='spaces']/tbody//tr//td[@class='monthly-rent']")) .getText(); driver.findElement( By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click(); logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen"); Reporter.log("Clicked on Confirm button in customer screen", true); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.PASS, "Switching back to screen"); Reporter.log("Switching back to screen", true); // Filling contact information Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver); Thread.sleep(5000); String FN = "AUT" + Generic_Class.get_RandmString(); contactinfo.txt_Fname(FN); contactinfo.txt_Lname(tabledata.get("LastName")); contactinfo.clickContact_State(); List<WebElement> allstates = driver.findElements( By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']")); // Identify the WebElement which will appear after scrolling down for (WebElement state : allstates) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } // contactinfo.select_State(tabledata.get("StateCode")); contactinfo.txt_Number(tabledata.get("DrivingLicenseNum")); contactinfo.txt_street1(tabledata.get("Street")); contactinfo.txt_city(tabledata.get("City")); contactinfo.select_State2address(); List<WebElement> allstatesadd = driver .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']")); for (WebElement state : allstatesadd) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } // contactinfo.select_State2(tabledata.get("State")); Thread.sleep(3000); contactinfo.txt_Zipcode(tabledata.get("Zipcode")); contactinfo.select_phoneType1(); Thread.sleep(3000); driver.findElement( By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(),'" + tabledata.get("PhoneType") + " ')]")) .click(); Thread.sleep(2000); contactinfo.txt_AreaCode(tabledata.get("Areacode")); Thread.sleep(2000); contactinfo.txt_Exchg(tabledata.get("Exchange")); Thread.sleep(2000); contactinfo.txt_lineNumber(tabledata.get("LineNumber")); Thread.sleep(2000); contactinfo.txt_email(tabledata.get("Email")); Thread.sleep(2000); contactinfo.click_CustLookUp(); Thread.sleep(15000); // Click on New Customer button on Choose an Account PopUp driver.findElement(By.linkText("Create New Customer")).click(); Thread.sleep(8000); contactinfo.clk_ActiveDutyMilitaryNoRadioBtn(driver); // Click on Verify button Thread.sleep(5000); driver.findElement(By.partialLinkText("Verify")).click(); logger.log(LogStatus.INFO, "cliked on the Verify button button "); Thread.sleep(9000); driver.findElement(By.id("confirmWithCustomerButton")).click(); Thread.sleep(5000); // Click on Confirm with Cust button logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully"); // Navigating to Customer screen driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); // Entering Emergency Contact details Thread.sleep(5000); Leasing_EmergencyConatctsPage emergCon = new Leasing_EmergencyConatctsPage(driver); Thread.sleep(2000); emergCon.clickAuthorizedfor_radio(); Thread.sleep(2000); emergCon.click_custDeclines_chkBox(); emergCon.clickconfirmWithCust(); Thread.sleep(4000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(8000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(2000); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Leasing_AuthorizedAccessContactsPage autContact = new Leasing_AuthorizedAccessContactsPage(driver); Thread.sleep(8000); autContact.clickSavenProceed(); Thread.sleep(8000); Leasing_EligiblePromotionsPage eligpromo = new Leasing_EligiblePromotionsPage(driver); logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page"); eligpromo.clickSavenProceed(); Thread.sleep(8000); Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver); leaseQues.clickStorageContent(); Thread.sleep(5000); List<WebElement> allstorage = driver.findElements(By.xpath( "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']")); for (WebElement storage : allstorage) { if (tabledata.get("StorageContent").equalsIgnoreCase(storage.getText())) { storage.click(); break; } } // Insurance is OFF Thread.sleep(5000); if (leaseQues.isInsuranceYesRadioBtnDisplayed()) { String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "Add insurance option available in the page"); logger.log(LogStatus.INFO, "Add insurance option available in the page", image); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "Add insurance option is not there in the page"); logger.log(LogStatus.INFO, "Add insurance option is not there in the page", image); } Thread.sleep(3000); leaseQues.clickAddInsuranceNo(); logger.log(LogStatus.PASS, "Selecting Insurance yes Radio button to add insurnace"); Thread.sleep(1000); leaseQues.clickAccessZone(); Thread.sleep(2000); driver.findElement( By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[2]")) .click(); Thread.sleep(5000); leaseQues.clickKeypadZone(); Thread.sleep(2000); driver.findElement( By.xpath("//li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li[1]")).click(); Thread.sleep(5000); leaseQues.clickConfirmCust(); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(12000); List<WebElement> allCheckbox = driver.findElements( By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']")); for (WebElement checkbox : allCheckbox) { checkbox.click(); } Thread.sleep(5000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(3000); WebElement signature = driver.findElement( By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']")); Actions actionBuilder = new Actions(driver); Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature) .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature) .build(); drawAction.perform(); Thread.sleep(4000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(6000); driver.switchTo().window(tabs.get(0)); Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver); Thread.sleep(8000); review.clickApprove_btn(); Thread.sleep(8000); review.clickSaveproceed_btn(); Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver); Thread.sleep(15000); logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page"); rentalfee.clickConfirmCust_btn(); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(8000); Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver); logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully "); Thread.sleep(2000); String screen = Generic_Class.takeScreenShotPath(); String imga = logger.addScreenCapture(screen); logger.log(LogStatus.PASS, "Payment page is dispalyed sucessfully "); logger.log(LogStatus.INFO, "Payment page is dispalyed sucessfully", imga); String MonthlyRentDueNowAmount = payment.get_MonthlyRentDueNowAmt(); logger.log(LogStatus.PASS, "Monthly Rent Due Now amount in payment page is------>:" + MonthlyRentDueNowAmount); String PromotionDueNowAmount = payment.get_PromotionDueNowAmt(); logger.log(LogStatus.PASS, "Promotion Due Now amount in payment page is------>:" + PromotionDueNowAmount); String InsuranceNowAmount = payment.get_InsuranceDueNowAmt(); logger.log(LogStatus.PASS, "Insurance Due Now amount in payment page is------>:" + InsuranceNowAmount); String AdministrativeDueNowAmount = payment.get_AdministrativeDueNowAmt(); logger.log(LogStatus.PASS, "Administrative Due Now amount in payment page is------>:" + AdministrativeDueNowAmount); String PayThroughDueNowAmount = payment.get_PaythroughDueNowAmt(); logger.log(LogStatus.PASS, "PayThrough Due Now amount in payment page is------>:" + PayThroughDueNowAmount); String MerchandiseAmount = payment.get_MerchandiseAmt(); logger.log(LogStatus.PASS, "MerchandiseAmount amount in payment page is------>:" + MerchandiseAmount); String TotalRemaingBalanceAmt = payment.get_TotalRemaingBalanceAmt(); logger.log(LogStatus.PASS, "Total Remaing Balance Amount in payment page is------>:" + TotalRemaingBalanceAmt); double MonthlyRentamt = payment.getDoubleAmount(MonthlyRentDueNowAmount); double Promotionamt = payment.getDoubleAmount(PromotionDueNowAmount); double Insuranceamt = payment.getDoubleAmount(InsuranceNowAmount); double Administrativeamt = payment.getDoubleAmount(AdministrativeDueNowAmount); double Apythroughamt = payment.getDoubleAmount(PayThroughDueNowAmount); double Merchandiseamt = payment.getDoubleAmount(MerchandiseAmount); double TotalAmount = MonthlyRentamt + Promotionamt + Insuranceamt + Administrativeamt + Apythroughamt + Merchandiseamt; double TotalRemUiVal = payment.getDoubleAmount(TotalRemaingBalanceAmt); Double db1 = new Double(TotalAmount); Double db2 = new Double(TotalRemUiVal); if (db1.intValue() == db2.intValue()) { String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, "Sumantion of all due amount and Total remaing amount are equal"); logger.log(LogStatus.INFO, "Sumantion of all due amount and Total remaing amount are equal", im); } else { String scp = Generic_Class.takeScreenShotPath(); String ima = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "Sumantion of all due is amount and Total remaing amount are not equal"); logger.log(LogStatus.INFO, "Sumantion of all due is amount and Total remaing amount are not equal", ima); } Thread.sleep(3000); payment.selectPaymentMethod("Cash", driver); logger.log(LogStatus.PASS, "selecting cash option from the dropdown"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); payment.enter_CashAmount(TotalRemaingBalanceAmt); logger.log(LogStatus.PASS, "entered total balance amount to pay"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); payment.clickApply_btn(); logger.log(LogStatus.PASS, "clicked on the apply button"); Thread.sleep(3000); payment.clk_ConfirmWthCustBtn(); logger.log(LogStatus.PASS, "clicked on the ConfirmWthCustBtn button"); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(5000); payment.clickSubmit_btn(); logger.log(LogStatus.PASS, "clicked on the submit button in payment page"); Thread.sleep(3000); TransactionCompletePopup popup = new TransactionCompletePopup(driver); String path = Generic_Class.takeScreenShotPath(); String ima = logger.addScreenCapture(path); logger.log(LogStatus.PASS, "TransactionCompletePopup dispalyed sucessfully"); logger.log(LogStatus.INFO, "TransactionCompletePopup dispalyed sucessfully", ima); popup.enterEmpNum(tabledata.get("UserName")); logger.log(LogStatus.PASS, "entered the employee id"); Thread.sleep(3000); popup.clickOk_btn(); logger.log(LogStatus.PASS, "clicked on the ok button"); Thread.sleep(3000); driver.findElement(By.xpath("//div[@class='k-widget k-window']//a[contains(text(),'No')]")).click(); Thread.sleep(8000); if (pmhomepage.isexistingCustomerModelDisplayed()) { String pa = Generic_Class.takeScreenShotPath(); String img1 = logger.addScreenCapture(pa); logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", img1); } else { String scp = Generic_Class.takeScreenShotPath(); String imag = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "PM DashBoard dispalyed is not displayed"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed is not displayed", imag); } Thread.sleep(2000); pmhomepage.clk_AdvSearchLnk(); logger.log(LogStatus.PASS, "clicked on the submit button"); Thread.sleep(6000); Advance_Search advSearch = new Advance_Search(driver); String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='" + FN + "'andlastname='" + tabledata.get("LastName") + "'))"; String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery); Thread.sleep(6000); logger.log(LogStatus.PASS, "fetched account number from databse and account number is:" + accNUm); advSearch.enterAccNum(accNUm); logger.log(LogStatus.PASS, "entered account number"); Thread.sleep(5000); advSearch.clickSearchAccbtn(); logger.log(LogStatus.PASS, "clicked on the search button in advance search page"); Cust_AccDetailsPage cust = new Cust_AccDetailsPage(driver); Thread.sleep(8000); if (cust.isCustdbTitleDisplayed()) { String sap = Generic_Class.takeScreenShotPath(); String mag = logger.addScreenCapture(sap); logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully"); logger.log(LogStatus.INFO, "customer Dashboard is displayed successfully", mag); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scan = Generic_Class.takeScreenShotPath(); String mg = logger.addScreenCapture(scan); logger.log(LogStatus.FAIL, "customer Dashboard is not displayed "); logger.log(LogStatus.INFO, "customer Dashboard is not displayed ", mg); } Thread.sleep(1000); String totalDueNowAmount = cust.getTotalDue(); logger.log(LogStatus.PASS, "Total due now amount in customer dashbaord is---> :" + totalDueNowAmount); Double db3 = new Double(payment.getDoubleAmount(totalDueNowAmount)); if (db3.intValue() == 0) { String sap = Generic_Class.takeScreenShotPath(); String mag = logger.addScreenCapture(sap); logger.log(LogStatus.PASS, "Payment done successfully and changes reflecting in customer dash board"); logger.log(LogStatus.INFO, "Payment done successfully and changes reflecting in customer dash board", mag); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scan = Generic_Class.takeScreenShotPath(); String mg = logger.addScreenCapture(scan); logger.log(LogStatus.FAIL, "Payment not done successfully "); logger.log(LogStatus.INFO, "Payment not done successfully ", mg); } Thread.sleep(1000); // Verify Total Due Now is available if (cust.getTotalDueNowTxt().contains("Total Due Now")) { Thread.sleep(2000); String scp = Generic_Class.takeScreenShotPath(); String img = logger.addScreenCapture(scp); logger.log(LogStatus.PASS, "Total Due Now is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Total Due Now is displayed successfully", img); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scp = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "Total Due Now is not displayed successfully"); logger.log(LogStatus.FAIL, "Total Due Now is not displayed successfully", im); } // Verify Next Due is available if (cust.getNextPaymentDueTxt().contains("Next Payment Due")) { Thread.sleep(2000); String scp = Generic_Class.takeScreenShotPath(); String img = logger.addScreenCapture(scp); logger.log(LogStatus.PASS, "Next Payment Due is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Next Payment Due is displayed successfully", img); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Next Payment Due is not displayed successfully"); logger.log(LogStatus.FAIL, "Next Payment Due is not displayed successfully", im); } // Verify Make Payment is available if (cust.getMakePaymentTxt().contains("Make Payment")) { Thread.sleep(4000); String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, "Make Payment is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Make Payment is displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Make Payment is not displayed successfully"); logger.log(LogStatus.FAIL, "Make Payment is not displayed successfully", im); } // Verify Manage AutoPay is available if (cust.getManageAutoPayTxt().contains("Manage AutoPay")) { Thread.sleep(2000); String st = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(st); logger.log(LogStatus.PASS, "Manage AutoPay is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Manage AutoPay is displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String st = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(st); logger.log(LogStatus.FAIL, "Manage AutoPay is not displayed successfully"); logger.log(LogStatus.FAIL, "Manage AutoPay is not displayed successfully", im); } // Verify Create Note is available if (cust.getCreateNoteTxt().contains("Create Note")) { Thread.sleep(2000); String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, "Create Note is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Create Note is displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Create Note is not displayed successfully"); logger.log(LogStatus.FAIL, "Create Note is not displayed successfully", im); } // Verify Important Information is available if (cust.getImportantInformationTxt().contains("Important Information")) { Thread.sleep(2000); String sch = Generic_Class.takeScreenShotPath(); String ie = logger.addScreenCapture(sch); logger.log(LogStatus.PASS, "Important Information is displayed successfully" + cust.getCustDashboardTitle()); logger.log(LogStatus.PASS, "Important Information is displayed successfully", ie); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sch = Generic_Class.takeScreenShotPath(); String imge = logger.addScreenCapture(sch); logger.log(LogStatus.FAIL, "Important Information is not displayed successfully"); logger.log(LogStatus.FAIL, "Important Information is not displayed successfully", imge); } // Verify Customer Info Tab is available if (cust.getCustomerInfoTabTxt().contains("Customer Info")) { Thread.sleep(2000); String sch = Generic_Class.takeScreenShotPath(); String ie = logger.addScreenCapture(sch); logger.log(LogStatus.PASS, "Customer Info tab displayed successfully" + cust.getCustomerInfoTabTxt()); logger.log(LogStatus.PASS, "Customer Info tab displayed successfully", ie); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scr = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(scr); logger.log(LogStatus.FAIL, "Customer Info tab not displayed successfully"); logger.log(LogStatus.FAIL, "Customer Info tab not displayed successfully", im); } // Verify Space Details tab is available if (cust.getSpaceDetailsTabTxt().contains("Space Details")) { Thread.sleep(2000); String scp = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(scp); logger.log(LogStatus.PASS, " Space Details tab displayed successfully" + cust.getSpaceDetailsTabTxt()); logger.log(LogStatus.PASS, " Space Details tab displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sr = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sr); logger.log(LogStatus.FAIL, "Space Details tab not displayed successfully"); logger.log(LogStatus.FAIL, "Space Details tab not displayed successfully", im); } // Verify Account Activities tab is available if (cust.getAccountActivitiesTabTxt().contains("Account Activities")) { Thread.sleep(2000); String scp = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(scp); logger.log(LogStatus.PASS, " Account Activitiestab displayed successfully" + cust.getAccountActivitiesTabTxt()); logger.log(LogStatus.PASS, " Account Activities tab displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Account Activities tab not displayed successfully"); logger.log(LogStatus.FAIL, "Account Activities tab not displayed successfully", im); } // Verify Documents tab is available if (cust.getDocumentsTabTxt().contains("Documents")) { Thread.sleep(2000); String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, " Documents tab displayed successfully" + cust.getDocumentsTabTxt()); logger.log(LogStatus.PASS, " Documents tab displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Documents tab not displayed successfully"); logger.log(LogStatus.FAIL, "Documents tab not displayed successfully", im); } if (cust.getCustSpaceNum().trim().contains(space)) { logger.log(LogStatus.PASS, "Application is displaying correct space number in the customer dashboard"); } else { logger.log(LogStatus.PASS, "Application is not displaying correct space number in the customer dashboard"); } if (cust.getEmailid(tabledata.get("Email"))) { logger.log(LogStatus.PASS, "Application is displaying correct email id in the customer info tab"); } else { logger.log(LogStatus.FAIL, "Application is not displaying correct email id in the customer info tab"); } } catch (Exception e) { resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "PM Dash board page is not displayed", image); e.printStackTrace(); } }
From source file:Scenarios.Payments.Payments_NewIndCustSingleSpace_CashAnniversary.java
@Test(dataProvider = "getLoginData") public void Payments_NewIndCustSingleSpace_CashAnniversary(Hashtable<String, String> tabledata) throws Exception { if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Payments").equals("Y"))) { resultFlag = "skip"; logger.log(LogStatus.SKIP, "Payments_NewIndCustSingleSpace_CashAnniversary is Skipped"); throw new SkipException("Skipping the test Payments_NewIndCustSingleSpace_CashAnniversary"); }// www . j a v a 2 s. c o m Reporter.log("Test Case Started", true); Thread.sleep(5000); try { logger = extent.startTest("Payments_NewIndCustSingleSpace_CashAnniversary", "New individual customer make payment using cash anniversary pay"); testcaseName = tabledata.get("TestCases"); Reporter.log("Test case started: " + testcaseName, true); Thread.sleep(5000); JavascriptExecutor jse = (JavascriptExecutor) driver; LoginPage loginPage = new LoginPage(driver); logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully "); Thread.sleep(2000); loginPage.enterUserName(tabledata.get("UserName")); Thread.sleep(2000); logger.log(LogStatus.PASS, "entered username sucessfully"); Thread.sleep(2000); loginPage.enterPassword(tabledata.get("Password")); logger.log(LogStatus.PASS, "entered password sucessfully"); Thread.sleep(2000); loginPage.clickLogin(); logger.log(LogStatus.PASS, "clicked on login in button sucessfully"); logger.log(LogStatus.PASS, "Login to Application successfully"); //=================Handling customer facing device======================== Thread.sleep(5000); Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver); logger.log(LogStatus.INFO, "PopUp window object is created successfully"); String biforstNum = Bifrostpop.getBiforstNo(); Reporter.log(biforstNum + "", true); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t"); ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles()); Reporter.log(tabs.size() + "", true); driver.switchTo().window(tabs.get(1)); driver.get(Generic_Class.getPropertyValue("CustomerScreenPath")); List<WebElement> biforstSystem = driver.findElements( By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']")); for (WebElement ele : biforstSystem) { if (biforstNum.equalsIgnoreCase(ele.getText().trim())) { Reporter.log(ele.getText() + "", true); ele.click(); break; } } driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(5000); driver.switchTo().window(tabs.get(0)); Thread.sleep(5000); driver.findElement(By.xpath( "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']")) .click(); Thread.sleep(5000); // ================================================================================= Thread.sleep(3000); PM_Homepage pmhomepage = new PM_Homepage(driver); logger.log(LogStatus.PASS, "creating object for the PM home page sucessfully"); Thread.sleep(3000); if (pmhomepage.isexistingCustomerModelDisplayed()) { String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", image); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "PM DashBoard dispalyed is not displayed"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed is not displayed", image); } pmhomepage.clk_findAndLeaseSpace(); logger.log(LogStatus.INFO, "Click on Find And Lease Space Link successfully"); Thread.sleep(4000); StandardStoragePage stdStorage = new StandardStoragePage(driver); logger.log(LogStatus.PASS, "Creating object for the Standard stroage page sucessfully"); Thread.sleep(1000); if (stdStorage.isSelected_yesradiobutton()) { logger.log(LogStatus.PASS, "New Customer Radio button selected by default when WALK-INS: FIND A SPACE page is launched sucessfully"); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; logger.log(LogStatus.FAIL, "New Customer Radio button is not selected by default when WALK-INS: FIND A SPACE page is launched sucessfully"); } stdStorage.Clk_ChkBx_AvlSpace(); logger.log(LogStatus.PASS, "Clicked on available bold space size checkbox in StandardStorage sucessfully"); stdStorage.click_Search(); logger.log(LogStatus.INFO, "Click on search button successfully"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); // =====================Fetching space number and based on that clicking the radio button======================== Thread.sleep(10000); List<WebElement> norows = driver .findElements(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr")); String space = null; logger.log(LogStatus.INFO, "Total number of avaiable sizes count is------>:" + norows.size()); if (norows.size() > 0) { Thread.sleep(5000); space = driver.findElement(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr[1]/td[4]")) .getText(); Reporter.log("space number is:" + space, true); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; logger.log(LogStatus.FAIL, "Application is not populating any data/space details with selected size dimension"); throw new Exception("Application is not populating any data/space details"); } Thread.sleep(2000); WebElement RdBtn_Space = driver.findElement(By.xpath( "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']")); logger.log(LogStatus.PASS, "check the radio button based on the space and click on the reservation button"); Thread.sleep(5000); jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space); jse.executeScript("arguments[0].click();", RdBtn_Space); logger.log(LogStatus.PASS, "Clicked on check box of a space in this location:-------> " + space); Reporter.log("Clicked on check box of a space in this location: " + space, true); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); SpaceDashboard_ThisLoc thisloc = new SpaceDashboard_ThisLoc(driver); logger.log(LogStatus.PASS, "creating object for the This location page sucessfully"); thisloc.click_Rent(); logger.log(LogStatus.PASS, "clicked on the rent button sucessfully"); Thread.sleep(5000); Leasing_ConfirmSpace confirmSpace = new Leasing_ConfirmSpace(driver); Thread.sleep(5000); confirmSpace.clk_ConfirmwtCust(); logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button"); Reporter.log("Clicked on Confirm with Customer button", true); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(5000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.PASS, "Switched to Customer Screen"); Reporter.log("Switched to Customer Screen", true); Thread.sleep(9000); driver.findElement( By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click(); logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen"); Reporter.log("Clicked on Confirm button in customer screen", true); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.PASS, "Switching back to screen"); Reporter.log("Switching back to screen", true); // Filling contact information Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver); Thread.sleep(5000); String FN = "AUT" + Generic_Class.get_RandmString(); contactinfo.txt_Fname(FN); contactinfo.txt_Lname(tabledata.get("LastName")); contactinfo.clickContact_State(); List<WebElement> allstates = driver.findElements( By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']")); // Identify the WebElement which will appear after scrolling down for (WebElement state : allstates) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } // contactinfo.select_State(tabledata.get("StateCode")); contactinfo.txt_Number(tabledata.get("DrivingLicenseNum")); contactinfo.txt_street1(tabledata.get("Street")); contactinfo.txt_city(tabledata.get("City")); contactinfo.select_State2address(); List<WebElement> allstatesadd = driver .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']")); for (WebElement state : allstatesadd) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } // contactinfo.select_State2(tabledata.get("State")); Thread.sleep(3000); contactinfo.txt_Zipcode(tabledata.get("Zipcode")); contactinfo.select_phoneType1(); Thread.sleep(3000); driver.findElement( By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(),'" + tabledata.get("PhoneType") + " ')]")) .click(); Thread.sleep(2000); contactinfo.txt_AreaCode(tabledata.get("Areacode")); Thread.sleep(2000); contactinfo.txt_Exchg(tabledata.get("Exchange")); Thread.sleep(2000); contactinfo.txt_lineNumber(tabledata.get("LineNumber")); Thread.sleep(2000); contactinfo.txt_email(tabledata.get("Email")); Thread.sleep(2000); contactinfo.click_CustLookUp(); Thread.sleep(15000); // Click on New Customer button on Choose an Account PopUp driver.findElement(By.linkText("Create New Customer")).click(); Thread.sleep(8000); contactinfo.clk_ActiveDutyMilitaryNoRadioBtn(driver); // Click on Verify button Thread.sleep(5000); driver.findElement(By.partialLinkText("Verify")).click(); logger.log(LogStatus.INFO, "cliked on the Verify button button "); Thread.sleep(9000); driver.findElement(By.id("confirmWithCustomerButton")).click(); Thread.sleep(5000); // Click on Confirm with Cust button logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully"); // Navigating to Customer screen driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); // Entering Emergency Contact details Thread.sleep(5000); Leasing_EmergencyConatctsPage emergCon = new Leasing_EmergencyConatctsPage(driver); Thread.sleep(2000); emergCon.clickAuthorizedfor_radio(); Thread.sleep(2000); emergCon.click_custDeclines_chkBox(); emergCon.clickconfirmWithCust(); Thread.sleep(4000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(8000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(2000); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Leasing_AuthorizedAccessContactsPage autContact = new Leasing_AuthorizedAccessContactsPage(driver); Thread.sleep(8000); autContact.clickSavenProceed(); Thread.sleep(8000); Leasing_EligiblePromotionsPage eligpromo = new Leasing_EligiblePromotionsPage(driver); logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page"); eligpromo.clickSavenProceed(); Thread.sleep(8000); Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver); leaseQues.clickStorageContent(); Thread.sleep(5000); List<WebElement> allstorage = driver.findElements(By.xpath( "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']")); for (WebElement storage : allstorage) { if (tabledata.get("StorageContent").equalsIgnoreCase(storage.getText())) { storage.click(); break; } } // Insurance is ON Thread.sleep(5000); leaseQues.clickAddInsuranceYes(); Thread.sleep(1000); leaseQues.clickCoverageList(); Thread.sleep(5000); driver.findElement(By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__InsuranceSelection_listbox']/li[2]")) .click(); Thread.sleep(5000); leaseQues.clickAccessZone(); Thread.sleep(2000); driver.findElement( By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[2]")) .click(); Thread.sleep(5000); leaseQues.clickKeypadZone(); Thread.sleep(2000); driver.findElement( By.xpath("//li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li[1]")).click(); Thread.sleep(5000); leaseQues.clickConfirmCust(); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(12000); List<WebElement> allCheckbox = driver.findElements( By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']")); for (WebElement checkbox : allCheckbox) { checkbox.click(); } Thread.sleep(5000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(3000); WebElement signature = driver.findElement( By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']")); Actions actionBuilder = new Actions(driver); Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature) .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature) .build(); drawAction.perform(); Thread.sleep(4000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(6000); driver.switchTo().window(tabs.get(0)); Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver); Thread.sleep(8000); review.clickApprove_btn(); Thread.sleep(8000); review.clickSaveproceed_btn(); Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver); Thread.sleep(15000); logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page"); rentalfee.clickConfirmCust_btn(); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(8000); Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver); logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully "); Thread.sleep(2000); String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "Payment page is dispalyed sucessfully "); logger.log(LogStatus.INFO, "Payment page is dispalyed sucessfully", image); payment.clk_PayThroughdropdwn(); logger.log(LogStatus.INFO, "Clicked on payment clk_PayThroughdropdwn dropdown "); Thread.sleep(2000); // Anniversary payment option in dropdown int numberOfPixelsToDragTheScrollbarDown1 = 120; Actions dragger1 = new Actions(driver); WebElement draggablePartOfScrollbar1 = driver.findElement(By.xpath( "//ul[@class='k-list k-reset ps-container ps-active-y']//div[@class='ps-scrollbar-y-rail']//div[@class='ps-scrollbar-y']")); Thread.sleep(3000); List<WebElement> dates1 = driver .findElements(By.xpath("//div[@class='k-animation-container']//ul//li")); Thread.sleep(3000); dragger1.moveToElement(draggablePartOfScrollbar1).clickAndHold() .moveByOffset(0, numberOfPixelsToDragTheScrollbarDown1).release().build().perform(); Thread.sleep(3000); driver.findElement(By.xpath("//div[@class='k-animation-container']//ul//li[13]")).click(); Thread.sleep(4000); driver.findElement(By.xpath("//span[text()='Add/Edit Cart']")).click(); logger.log(LogStatus.INFO, "Clicked on payment Add Merchandise link "); Thread.sleep(3000); driver.findElement(By.xpath( "//div[div[div[div[text()='Lock Disc']]]]//input[@class='product-quantity webchamp-textbox']")) .sendKeys("1"); logger.log(LogStatus.INFO, "entering number of quantity in the textbox "); Thread.sleep(3000); driver.findElement(By.id("MerchandiseWindow-AddToCart")).click(); logger.log(LogStatus.INFO, "Clicked on payment Add to cart link "); Thread.sleep(4000); driver.findElement(By.xpath("//a[text()='Close']")).click(); logger.log(LogStatus.INFO, "clicked on the close button in the merchadise window "); Thread.sleep(5000); String MonthlyRentDueNowAmount = payment.get_MonthlyRentDueNowAmt(); logger.log(LogStatus.PASS, "Monthly Rent Due Now amount in payment page is------>:" + MonthlyRentDueNowAmount); String PromotionDueNowAmount = payment.get_PromotionDueNowAmt(); logger.log(LogStatus.PASS, "Promotion Due Now amount in payment page is------>:" + PromotionDueNowAmount); String InsuranceNowAmount = payment.get_InsuranceDueNowAmt(); logger.log(LogStatus.PASS, "Insurance Due Now amount in payment page is------>:" + InsuranceNowAmount); String AdministrativeDueNowAmount = payment.get_AdministrativeDueNowAmt(); logger.log(LogStatus.PASS, "Administrative Due Now amount in payment page is------>:" + AdministrativeDueNowAmount); String PayThroughDueNowAmount = payment.get_PaythroughDueNowAmt(); logger.log(LogStatus.PASS, "PayThrough Due Now amount in payment page is------>:" + PayThroughDueNowAmount); String MerchandiseAmount = payment.get_MerchandiseAmt(); logger.log(LogStatus.PASS, "MerchandiseAmount amount in payment page is------>:" + MerchandiseAmount); String SalexTaxAmount = payment.get_SalesTaxAmt(); logger.log(LogStatus.PASS, "SalexTax Amount in payment page is------>:" + SalexTaxAmount); String TotalRemaingBalanceAmt = payment.get_TotalRemaingBalanceAmt(); logger.log(LogStatus.PASS, "Total Remaing Balance Amount in payment page is------>:" + TotalRemaingBalanceAmt); double MonthlyRentamt = payment.getDoubleAmount(MonthlyRentDueNowAmount); double Promotionamt = payment.getDoubleAmount(PromotionDueNowAmount); double Insuranceamt = payment.getDoubleAmount(InsuranceNowAmount); double Administrativeamt = payment.getDoubleAmount(AdministrativeDueNowAmount); double Apythroughamt = payment.getDoubleAmount(PayThroughDueNowAmount); double Merchandiseamt = payment.getDoubleAmount(MerchandiseAmount); double SalexTaxamt = payment.getDoubleAmount(SalexTaxAmount); double TotalAmount = MonthlyRentamt + Promotionamt + Insuranceamt + Administrativeamt + Apythroughamt + Merchandiseamt + SalexTaxamt; double TotalRemUiVal = payment.getDoubleAmount(TotalRemaingBalanceAmt); Double db1 = new Double(TotalAmount); Double db2 = new Double(TotalRemUiVal); if (db1.intValue() == db2.intValue()) { String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, "Sumantion of all due amount and Total remaing amount are equal"); logger.log(LogStatus.INFO, "Sumantion of all due amount and Total remaing amount are equal", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scp = Generic_Class.takeScreenShotPath(); String ima = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "Sumantion of all due is amount and Total remaing amount are not equal"); logger.log(LogStatus.INFO, "Sumantion of all due is amount and Total remaing amount are not equal", ima); } Thread.sleep(3000); payment.selectPaymentMethod("Cash", driver); logger.log(LogStatus.PASS, "selecting cash option from the dropdown"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); payment.enter_CashAmount(TotalRemaingBalanceAmt); logger.log(LogStatus.PASS, "entered total balance amount to pay"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); payment.clickApply_btn(); logger.log(LogStatus.PASS, "clicked on the apply button"); Thread.sleep(3000); payment.clk_ConfirmWthCustBtn(); logger.log(LogStatus.PASS, "clicked on the ConfirmWthCustBtn button"); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(5000); payment.clickSubmit_btn(); logger.log(LogStatus.PASS, "clicked on the submit button in payment page"); Thread.sleep(3000); TransactionCompletePopup popup = new TransactionCompletePopup(driver); String path = Generic_Class.takeScreenShotPath(); String ima = logger.addScreenCapture(path); logger.log(LogStatus.PASS, "TransactionCompletePopup dispalyed sucessfully"); logger.log(LogStatus.INFO, "TransactionCompletePopup dispalyed sucessfully", ima); popup.enterEmpNum(tabledata.get("UserName")); logger.log(LogStatus.PASS, "entered the employee id"); Thread.sleep(3000); popup.clickOk_btn(); logger.log(LogStatus.PASS, "clicked on the ok button"); Thread.sleep(3000); driver.findElement(By.xpath("//div[@class='k-widget k-window']//a[contains(text(),'No')]")).click(); Thread.sleep(8000); if (pmhomepage.isexistingCustomerModelDisplayed()) { String pa = Generic_Class.takeScreenShotPath(); String img1 = logger.addScreenCapture(pa); logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", img1); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scp = Generic_Class.takeScreenShotPath(); String imag = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "PM DashBoard dispalyed is not displayed"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed is not displayed", imag); } Thread.sleep(2000); pmhomepage.clk_AdvSearchLnk(); logger.log(LogStatus.PASS, "clicked on the submit button"); Thread.sleep(6000); Advance_Search advSearch = new Advance_Search(driver); String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='" + FN + "'andlastname='" + tabledata.get("LastName") + "'))"; String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery); Thread.sleep(6000); logger.log(LogStatus.PASS, "fetched account number from databse and account number is:" + accNUm); advSearch.enterAccNum(accNUm); logger.log(LogStatus.PASS, "entered account number"); Thread.sleep(5000); advSearch.clickSearchAccbtn(); logger.log(LogStatus.PASS, "clicked on the search button in advance search page"); Cust_AccDetailsPage cust = new Cust_AccDetailsPage(driver); Thread.sleep(8000); if (cust.isCustdbTitleDisplayed()) { String sap = Generic_Class.takeScreenShotPath(); String mag = logger.addScreenCapture(sap); logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully"); logger.log(LogStatus.INFO, "customer Dashboard is displayed successfully", mag); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scan = Generic_Class.takeScreenShotPath(); String mg = logger.addScreenCapture(scan); logger.log(LogStatus.FAIL, "customer Dashboard is not displayed "); logger.log(LogStatus.INFO, "customer Dashboard is not displayed ", mg); } Thread.sleep(1000); String totalDueNowAmount = cust.getTotalDue(); logger.log(LogStatus.PASS, "Total due now amount in customer dashbaord is---> :" + totalDueNowAmount); Double db3 = new Double(payment.getDoubleAmount(totalDueNowAmount)); if (db3.intValue() == 0) { String sap = Generic_Class.takeScreenShotPath(); String mag = logger.addScreenCapture(sap); logger.log(LogStatus.PASS, "Payment done successfully and changes reflecting in customer dash board"); logger.log(LogStatus.INFO, "Payment done successfully and changes reflecting in customer dash board", mag); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scan = Generic_Class.takeScreenShotPath(); String mg = logger.addScreenCapture(scan); logger.log(LogStatus.FAIL, "Payment not done successfully "); logger.log(LogStatus.INFO, "Payment not done successfully ", mg); } Thread.sleep(1000); cust.click_AccountActivities(); ; logger.log(LogStatus.INFO, "Clicked on Account Activities tab in customer dashboard screen"); Thread.sleep(9000); WebElement ele = driver.findElement(By.xpath("//td[contains(text(),'Cash')]/preceding-sibling::td/a")); ele.click(); logger.log(LogStatus.INFO, "Clicked on expand button in first row based on the payment type"); Thread.sleep(6000); cust.clk_ReversePaymntLnk(); logger.log(LogStatus.INFO, "Clicked on Reverse Payment link"); Thread.sleep(8000); ReversePayment ReversePayment = new ReversePayment(driver); boolean rev = driver.findElement(By.xpath("//h3[contains(text(),'Reverse Payment')]")).isDisplayed(); if (rev) { String scp = Generic_Class.takeScreenShotPath(); String img = logger.addScreenCapture(scp); logger.log(LogStatus.PASS, "Reverse Payment screen is displayed successfully"); logger.log(LogStatus.INFO, "Reverse Payment screen is displayed successfully", img); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Reverse Payment screen is not displayed "); logger.log(LogStatus.INFO, "Reverse Payment screen is not displayed ", im); } Thread.sleep(3000); ReversePayment.Clk_RdBtn_Yes(); logger.log(LogStatus.INFO, "clicked on the yes rdio button in reverse payment sucessfully"); ReversePayment.Clk_ReasonDrpDwn(); logger.log(LogStatus.INFO, "Clicked on Reason drop down"); ReversePayment.SelectValueFromReasonList("Misapplied Payment"); logger.log(LogStatus.INFO, "Select value from Reason dropdown"); ReversePayment .enterNote("PM received a Bad money from bank for a customer payment so reversing the payment"); logger.log(LogStatus.INFO, "Entered reason for reverse payment note"); ReversePayment.clk_ConfirmWithCustomerBtn(); logger.log(LogStatus.INFO, "clicked on the confirm with customer button in reverse payment page sucessfully"); Thread.sleep(6000); driver.switchTo().window(tabs.get(1)); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); boolean revheader = driver .findElement(By.xpath("//h2[contains(text(),'Transaction Reversed. Thank you!')]")) .isDisplayed(); if (revheader) { String scr = Generic_Class.takeScreenShotPath(); String ime = logger.addScreenCapture(scr); logger.log(LogStatus.PASS, "Transaction Reversed Thank you! screen is displayed successfully"); logger.log(LogStatus.INFO, "Transaction Reversed Thank you! screen is displayed successfully", ime); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String screen = Generic_Class.takeScreenShotPath(); String imag = logger.addScreenCapture(screen); logger.log(LogStatus.FAIL, "Transaction Reversed Thank you! screen is not displayed "); logger.log(LogStatus.INFO, "Transaction Reversed Thank you! screen is not displayed ", imag); } WebElement signatures = driver .findElement(By.xpath("//div[@class='signature-area']/canvas[@class='signature-pad']")); Actions actionBuilders = new Actions(driver); Action drawActions = actionBuilders.moveToElement(signatures, 660, 96).click().clickAndHold(signatures) .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signatures) .build(); drawActions.perform(); Thread.sleep(6000); driver.findElement(By.xpath("//button[text()='Accept']")).click(); logger.log(LogStatus.INFO, "Cust Signature and click on Accept button successfully"); logger.log(LogStatus.PASS, "reverse Payment made using cash"); Thread.sleep(6000); driver.switchTo().window(tabs.get(0)); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(6000); ReversePayment.clk_ApproveBtn(); logger.log(LogStatus.INFO, "clicked on the approve button in reverse payment sucessfully"); Thread.sleep(2000); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(4000); ReversePayment.Clk_RevBtn(); logger.log(LogStatus.INFO, "Clicked on Reverse button"); Thread.sleep(6000); TransactionReversedPage trnspage = new TransactionReversedPage(driver); Thread.sleep(4000); trnspage.chk_RefundCashToCustCheckBox(); logger.log(LogStatus.INFO, "clicked on the I have given refunded cash to the customer check box in Transaction Reversed sucessfully"); Thread.sleep(4000); trnspage.enter_EmployeeId(tabledata.get("UserName")); logger.log(LogStatus.INFO, "Entered EmployeeID"); Thread.sleep(3000); trnspage.click_OkBtn(); logger.log(LogStatus.INFO, "Clicked on OK button"); Thread.sleep(8000); if (cust.isCustdbTitleDisplayed()) { logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully"); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; logger.log(LogStatus.FAIL, "customer Dashboard is not displayed "); } Thread.sleep(1000); String toatlDueNowAmtAfterReversePymt = cust.getTotalDue().substring(1).replace(",", ""); logger.log(LogStatus.PASS, "Total due now amount after reverse payment in customer dashbaord is:" + toatlDueNowAmtAfterReversePymt); Double dbl_toatlDueNowAmtAfterReversePymt = Double.parseDouble(toatlDueNowAmtAfterReversePymt); Double dbl_toatlDueNowAmtBeforeReversePayment = Double.parseDouble(totalDueNowAmount); if (dbl_toatlDueNowAmtAfterReversePymt != dbl_toatlDueNowAmtBeforeReversePayment) { String sh = Generic_Class.takeScreenShotPath(); String ie = logger.addScreenCapture(sh); logger.log(LogStatus.PASS, "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly"); logger.log(LogStatus.INFO, "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly", ie); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String st = Generic_Class.takeScreenShotPath(); String ig = logger.addScreenCapture(st); logger.log(LogStatus.FAIL, "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly"); logger.log(LogStatus.INFO, "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly", ig); } } catch (Exception e) { resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "PM Dash board page is not displayed", image); e.printStackTrace(); } }
From source file:Scenarios.Payments.Payments_NewIndCustSingleSpace_Cash_AP.java
@Test(dataProvider = "getLoginData") public void Payments_NewIndCustSingleSpace_Cash_AP(Hashtable<String, String> tabledata) throws Exception { if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Payments").equals("Y"))) { resultFlag = "skip"; logger.log(LogStatus.SKIP, "Payments_NewIndCustSingleSpace_Cash_AP is Skipped"); throw new SkipException("Skipping the test Payments_NewIndCustSingleSpace_Cash_AP"); }//from www . j a v a2 s .co m Reporter.log("Test Case Started", true); Thread.sleep(5000); try { logger = extent.startTest("Payments_NewIndCustSingleSpace_Cash_AP", "New individual customer make payment using cash advance pay"); testcaseName = tabledata.get("TestCases"); Reporter.log("Test case started: " + testcaseName, true); Thread.sleep(5000); JavascriptExecutor jse = (JavascriptExecutor) driver; LoginPage loginPage = new LoginPage(driver); logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully "); Thread.sleep(2000); loginPage.enterUserName(tabledata.get("UserName")); Thread.sleep(2000); logger.log(LogStatus.PASS, "entered username sucessfully"); Thread.sleep(2000); loginPage.enterPassword(tabledata.get("Password")); logger.log(LogStatus.PASS, "entered password sucessfully"); Thread.sleep(2000); loginPage.clickLogin(); logger.log(LogStatus.PASS, "clicked on login in button sucessfully"); logger.log(LogStatus.PASS, "Login to Application successfully"); // =================Handling customer facing device======================== Thread.sleep(5000); Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver); logger.log(LogStatus.INFO, "PopUp window object is created successfully"); String biforstNum = Bifrostpop.getBiforstNo(); Reporter.log(biforstNum + "", true); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t"); ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles()); Reporter.log(tabs.size() + "", true); driver.switchTo().window(tabs.get(1)); driver.get(Generic_Class.getPropertyValue("CustomerScreenPath")); List<WebElement> biforstSystem = driver.findElements( By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']")); for (WebElement ele : biforstSystem) { if (biforstNum.equalsIgnoreCase(ele.getText().trim())) { Reporter.log(ele.getText() + "", true); ele.click(); break; } } driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(5000); driver.switchTo().window(tabs.get(0)); Thread.sleep(5000); driver.findElement(By.xpath( "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']")) .click(); Thread.sleep(5000); // ================================================================================= Thread.sleep(3000); PM_Homepage pmhomepage = new PM_Homepage(driver); logger.log(LogStatus.PASS, "creating object for the PM home page sucessfully"); Thread.sleep(3000); if (pmhomepage.isexistingCustomerModelDisplayed()) { String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", image); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "PM DashBoard dispalyed is not displayed"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed is not displayed", image); } pmhomepage.clk_findAndLeaseSpace(); logger.log(LogStatus.INFO, "Click on Find And Lease Space Link successfully"); Thread.sleep(4000); StandardStoragePage stdStorage = new StandardStoragePage(driver); logger.log(LogStatus.PASS, "Creating object for the Standard stroage page sucessfully"); Thread.sleep(1000); if (stdStorage.isSelected_yesradiobutton()) { logger.log(LogStatus.PASS, "New Customer Radio button selected by default when WALK-INS: FIND A SPACE page is launched sucessfully"); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; logger.log(LogStatus.FAIL, "New Customer Radio button is not selected by default when WALK-INS: FIND A SPACE page is launched sucessfully"); } stdStorage.Clk_ChkBx_AvlSpace(); logger.log(LogStatus.PASS, "Clicked on available bold space size checkbox in StandardStorage sucessfully"); stdStorage.click_Search(); logger.log(LogStatus.INFO, "Click on search button successfully"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); // =====================Fetching space number and based on that clicking the radio button======================== Thread.sleep(10000); List<WebElement> norows = driver .findElements(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr")); String space = null; logger.log(LogStatus.INFO, "Total number of avaiable sizes count is------>:" + norows.size()); if (norows.size() > 0) { Thread.sleep(5000); space = driver.findElement(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr[1]/td[4]")) .getText(); Reporter.log("space number is:" + space, true); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; logger.log(LogStatus.FAIL, "Application is not populating any data/space details with selected size dimension"); throw new Exception("Application is not populating any data/space details"); } Thread.sleep(2000); WebElement RdBtn_Space = driver.findElement(By.xpath( "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']")); logger.log(LogStatus.PASS, "check the radio button based on the space and click on the reservation button"); Thread.sleep(5000); jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space); jse.executeScript("arguments[0].click();", RdBtn_Space); logger.log(LogStatus.PASS, "Clicked on check box of a space in this location:-------> " + space); Reporter.log("Clicked on check box of a space in this location: " + space, true); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); SpaceDashboard_ThisLoc thisloc = new SpaceDashboard_ThisLoc(driver); logger.log(LogStatus.PASS, "creating object for the This location page sucessfully"); thisloc.click_Rent(); logger.log(LogStatus.PASS, "clicked on the rent button sucessfully"); Thread.sleep(5000); Leasing_ConfirmSpace confirmSpace = new Leasing_ConfirmSpace(driver); Thread.sleep(5000); confirmSpace.clk_ConfirmwtCust(); logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button"); Reporter.log("Clicked on Confirm with Customer button", true); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(5000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.PASS, "Switched to Customer Screen"); Reporter.log("Switched to Customer Screen", true); Thread.sleep(9000); driver.findElement( By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click(); logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen"); Reporter.log("Clicked on Confirm button in customer screen", true); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.PASS, "Switching back to screen"); Reporter.log("Switching back to screen", true); // Filling contact information Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver); Thread.sleep(5000); String FN = "AUT" + Generic_Class.get_RandmString(); contactinfo.txt_Fname(FN); contactinfo.txt_Lname(tabledata.get("LastName")); contactinfo.clickContact_State(); List<WebElement> allstates = driver.findElements( By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']")); // Identify the WebElement which will appear after scrolling down for (WebElement state : allstates) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } // contactinfo.select_State(tabledata.get("StateCode")); contactinfo.txt_Number(tabledata.get("DrivingLicenseNum")); contactinfo.txt_street1(tabledata.get("Street")); contactinfo.txt_city(tabledata.get("City")); contactinfo.select_State2address(); List<WebElement> allstatesadd = driver .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']")); for (WebElement state : allstatesadd) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } // contactinfo.select_State2(tabledata.get("State")); Thread.sleep(3000); contactinfo.txt_Zipcode(tabledata.get("Zipcode")); contactinfo.select_phoneType1(); Thread.sleep(3000); driver.findElement( By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(),'" + tabledata.get("PhoneType") + " ')]")) .click(); Thread.sleep(2000); contactinfo.txt_AreaCode(tabledata.get("Areacode")); Thread.sleep(2000); contactinfo.txt_Exchg(tabledata.get("Exchange")); Thread.sleep(2000); contactinfo.txt_lineNumber(tabledata.get("LineNumber")); Thread.sleep(2000); contactinfo.txt_email(tabledata.get("Email")); Thread.sleep(2000); contactinfo.click_CustLookUp(); Thread.sleep(15000); // Click on New Customer button on Choose an Account PopUp driver.findElement(By.linkText("Create New Customer")).click(); Thread.sleep(8000); contactinfo.clk_ActiveDutyMilitaryNoRadioBtn(driver); // Click on Verify button Thread.sleep(5000); driver.findElement(By.partialLinkText("Verify")).click(); logger.log(LogStatus.INFO, "cliked on the Verify button button "); Thread.sleep(9000); driver.findElement(By.id("confirmWithCustomerButton")).click(); Thread.sleep(5000); // Click on Confirm with Cust button logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully"); // Navigating to Customer screen driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); // Entering Emergency Contact details Thread.sleep(5000); Leasing_EmergencyConatctsPage emergCon = new Leasing_EmergencyConatctsPage(driver); Thread.sleep(2000); emergCon.clickAuthorizedfor_radio(); Thread.sleep(2000); emergCon.click_custDeclines_chkBox(); emergCon.clickconfirmWithCust(); Thread.sleep(4000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(8000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(2000); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Leasing_AuthorizedAccessContactsPage autContact = new Leasing_AuthorizedAccessContactsPage(driver); Thread.sleep(8000); autContact.clickSavenProceed(); Thread.sleep(8000); Leasing_EligiblePromotionsPage eligpromo = new Leasing_EligiblePromotionsPage(driver); logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page"); eligpromo.clickSavenProceed(); Thread.sleep(8000); Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver); leaseQues.clickStorageContent(); Thread.sleep(5000); List<WebElement> allstorage = driver.findElements(By.xpath( "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']")); for (WebElement storage : allstorage) { if (tabledata.get("StorageContent").equalsIgnoreCase(storage.getText())) { storage.click(); break; } } // Insurance is ON Thread.sleep(5000); leaseQues.clickAddInsuranceYes(); Thread.sleep(1000); leaseQues.clickCoverageList(); Thread.sleep(5000); driver.findElement(By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__InsuranceSelection_listbox']/li[2]")) .click(); Thread.sleep(5000); leaseQues.clickAccessZone(); Thread.sleep(2000); driver.findElement( By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[2]")) .click(); Thread.sleep(5000); leaseQues.clickKeypadZone(); Thread.sleep(2000); driver.findElement( By.xpath("//li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li[1]")).click(); Thread.sleep(5000); leaseQues.clickConfirmCust(); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(12000); List<WebElement> allCheckbox = driver.findElements( By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']")); for (WebElement checkbox : allCheckbox) { checkbox.click(); } Thread.sleep(5000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(3000); WebElement signature = driver.findElement( By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']")); Actions actionBuilder = new Actions(driver); Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature) .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature) .build(); drawAction.perform(); Thread.sleep(4000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(6000); driver.switchTo().window(tabs.get(0)); Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver); Thread.sleep(8000); review.clickApprove_btn(); Thread.sleep(8000); review.clickSaveproceed_btn(); Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver); Thread.sleep(15000); logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page"); rentalfee.clickConfirmCust_btn(); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(8000); Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver); logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully "); Thread.sleep(2000); String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "Payment page is dispalyed sucessfully "); logger.log(LogStatus.INFO, "Payment page is dispalyed sucessfully", image); payment.clk_PayThroughdropdwn(); logger.log(LogStatus.INFO, "Clicked on payment clk_PayThroughdropdwn dropdown "); Thread.sleep(2000); // Advance payment option in dropdown Thread.sleep(3000); driver.findElement(By.xpath("//div[@class='k-animation-container']//ul//li[3]")).click(); Thread.sleep(4000); driver.findElement(By.xpath("//span[text()='Add/Edit Cart']")).click(); logger.log(LogStatus.INFO, "Clicked on payment Add Merchandise link "); Thread.sleep(3000); driver.findElement(By.xpath( "//div[div[div[div[text()='Lock Disc']]]]//input[@class='product-quantity webchamp-textbox']")) .sendKeys("1"); logger.log(LogStatus.INFO, "entering number of quantity in the textbox "); Thread.sleep(3000); driver.findElement(By.id("MerchandiseWindow-AddToCart")).click(); logger.log(LogStatus.INFO, "Clicked on payment Add to cart link "); Thread.sleep(4000); driver.findElement(By.xpath("//a[text()='Close']")).click(); logger.log(LogStatus.INFO, "clicked on the close button in the merchadise window "); Thread.sleep(5000); String MonthlyRentDueNowAmount = payment.get_MonthlyRentDueNowAmt(); logger.log(LogStatus.PASS, "Monthly Rent Due Now amount in payment page is------>:" + MonthlyRentDueNowAmount); String PromotionDueNowAmount = payment.get_PromotionDueNowAmt(); logger.log(LogStatus.PASS, "Promotion Due Now amount in payment page is------>:" + PromotionDueNowAmount); String InsuranceNowAmount = payment.get_InsuranceDueNowAmt(); logger.log(LogStatus.PASS, "Insurance Due Now amount in payment page is------>:" + InsuranceNowAmount); String AdministrativeDueNowAmount = payment.get_AdministrativeDueNowAmt(); logger.log(LogStatus.PASS, "Administrative Due Now amount in payment page is------>:" + AdministrativeDueNowAmount); String PayThroughDueNowAmount = payment.get_PaythroughDueNowAmt(); logger.log(LogStatus.PASS, "PayThrough Due Now amount in payment page is------>:" + PayThroughDueNowAmount); String MerchandiseAmount = payment.get_MerchandiseAmt(); logger.log(LogStatus.PASS, "MerchandiseAmount amount in payment page is------>:" + MerchandiseAmount); String SalexTaxAmount = payment.get_SalesTaxAmt(); logger.log(LogStatus.PASS, "SalexTax Amount in payment page is------>:" + SalexTaxAmount); String TotalRemaingBalanceAmt = payment.get_TotalRemaingBalanceAmt(); logger.log(LogStatus.PASS, "Total Remaing Balance Amount in payment page is------>:" + TotalRemaingBalanceAmt); double MonthlyRentamt = payment.getDoubleAmount(MonthlyRentDueNowAmount); double Promotionamt = payment.getDoubleAmount(PromotionDueNowAmount); double Insuranceamt = payment.getDoubleAmount(InsuranceNowAmount); double Administrativeamt = payment.getDoubleAmount(AdministrativeDueNowAmount); double Apythroughamt = payment.getDoubleAmount(PayThroughDueNowAmount); double Merchandiseamt = payment.getDoubleAmount(MerchandiseAmount); double SalexTaxamt = payment.getDoubleAmount(SalexTaxAmount); double TotalAmount = MonthlyRentamt + Promotionamt + Insuranceamt + Administrativeamt + Apythroughamt + Merchandiseamt + SalexTaxamt; double TotalRemUiVal = payment.getDoubleAmount(TotalRemaingBalanceAmt); Double db1 = new Double(TotalAmount); Double db2 = new Double(TotalRemUiVal); if (db1.intValue() == db2.intValue()) { String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, "Sumantion of all due amount and Total remaing amount are equal"); logger.log(LogStatus.INFO, "Sumantion of all due amount and Total remaing amount are equal", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scp = Generic_Class.takeScreenShotPath(); String ima = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "Sumantion of all due is amount and Total remaing amount are not equal"); logger.log(LogStatus.INFO, "Sumantion of all due is amount and Total remaing amount are not equal", ima); } Thread.sleep(3000); payment.selectPaymentMethod("Cash", driver); logger.log(LogStatus.PASS, "selecting cash option from the dropdown"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); payment.enter_CashAmount(TotalRemaingBalanceAmt); logger.log(LogStatus.PASS, "entered total balance amount to pay"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); payment.clickApply_btn(); logger.log(LogStatus.PASS, "clicked on the apply button"); Thread.sleep(3000); payment.clk_ConfirmWthCustBtn(); logger.log(LogStatus.PASS, "clicked on the ConfirmWthCustBtn button"); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(5000); payment.clickSubmit_btn(); logger.log(LogStatus.PASS, "clicked on the submit button in payment page"); Thread.sleep(3000); TransactionCompletePopup popup = new TransactionCompletePopup(driver); String path = Generic_Class.takeScreenShotPath(); String ima = logger.addScreenCapture(path); logger.log(LogStatus.PASS, "TransactionCompletePopup dispalyed sucessfully"); logger.log(LogStatus.INFO, "TransactionCompletePopup dispalyed sucessfully", ima); popup.enterEmpNum(tabledata.get("UserName")); logger.log(LogStatus.PASS, "entered the employee id"); Thread.sleep(3000); popup.clickOk_btn(); logger.log(LogStatus.PASS, "clicked on the ok button"); Thread.sleep(3000); driver.findElement(By.xpath("//div[@class='k-widget k-window']//a[contains(text(),'No')]")).click(); Thread.sleep(8000); if (pmhomepage.isexistingCustomerModelDisplayed()) { String pa = Generic_Class.takeScreenShotPath(); String img1 = logger.addScreenCapture(pa); logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", img1); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scp = Generic_Class.takeScreenShotPath(); String imag = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "PM DashBoard dispalyed is not displayed"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed is not displayed", imag); } Thread.sleep(2000); pmhomepage.clk_AdvSearchLnk(); logger.log(LogStatus.PASS, "clicked on the submit button"); Thread.sleep(6000); Advance_Search advSearch = new Advance_Search(driver); String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='" + FN + "'andlastname='" + tabledata.get("LastName") + "'))"; String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery); Thread.sleep(6000); logger.log(LogStatus.PASS, "fetched account number from databse and account number is:" + accNUm); advSearch.enterAccNum(accNUm); logger.log(LogStatus.PASS, "entered account number"); Thread.sleep(5000); advSearch.clickSearchAccbtn(); logger.log(LogStatus.PASS, "clicked on the search button in advance search page"); Cust_AccDetailsPage cust = new Cust_AccDetailsPage(driver); Thread.sleep(8000); if (cust.isCustdbTitleDisplayed()) { String sap = Generic_Class.takeScreenShotPath(); String mag = logger.addScreenCapture(sap); logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully"); logger.log(LogStatus.INFO, "customer Dashboard is displayed successfully", mag); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scan = Generic_Class.takeScreenShotPath(); String mg = logger.addScreenCapture(scan); logger.log(LogStatus.FAIL, "customer Dashboard is not displayed "); logger.log(LogStatus.INFO, "customer Dashboard is not displayed ", mg); } Thread.sleep(1000); String totalDueNowAmount = cust.getTotalDue(); logger.log(LogStatus.PASS, "Total due now amount in customer dashbaord is---> :" + totalDueNowAmount); Double db3 = new Double(payment.getDoubleAmount(totalDueNowAmount)); if (db3.intValue() == 0) { String sap = Generic_Class.takeScreenShotPath(); String mag = logger.addScreenCapture(sap); logger.log(LogStatus.PASS, "Payment done successfully and changes reflecting in customer dash board"); logger.log(LogStatus.INFO, "Payment done successfully and changes reflecting in customer dash board", mag); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scan = Generic_Class.takeScreenShotPath(); String mg = logger.addScreenCapture(scan); logger.log(LogStatus.FAIL, "Payment not done successfully "); logger.log(LogStatus.INFO, "Payment not done successfully ", mg); } Thread.sleep(1000); cust.click_AccountActivities(); ; logger.log(LogStatus.INFO, "Clicked on Account Activities tab in customer dashboard screen"); Thread.sleep(9000); WebElement ele = driver.findElement(By.xpath("//td[contains(text(),'Cash')]/preceding-sibling::td/a")); ele.click(); logger.log(LogStatus.INFO, "Clicked on expand button in first row based on the payment type"); Thread.sleep(6000); cust.clk_ReversePaymntLnk(); logger.log(LogStatus.INFO, "Clicked on Reverse Payment link"); Thread.sleep(8000); ReversePayment ReversePayment = new ReversePayment(driver); boolean rev = driver.findElement(By.xpath("//h3[contains(text(),'Reverse Payment')]")).isDisplayed(); if (rev) { String scp = Generic_Class.takeScreenShotPath(); String img = logger.addScreenCapture(scp); logger.log(LogStatus.PASS, "Reverse Payment screen is displayed successfully"); logger.log(LogStatus.INFO, "Reverse Payment screen is displayed successfully", img); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.FAIL, "Reverse Payment screen is not displayed "); logger.log(LogStatus.INFO, "Reverse Payment screen is not displayed ", im); } Thread.sleep(3000); ReversePayment.Clk_RdBtn_Yes(); logger.log(LogStatus.INFO, "clicked on the yes rdio button in reverse payment sucessfully"); ReversePayment.Clk_ReasonDrpDwn(); logger.log(LogStatus.INFO, "Clicked on Reason drop down"); ReversePayment.SelectValueFromReasonList("Misapplied Payment"); logger.log(LogStatus.INFO, "Select value from Reason dropdown"); ReversePayment .enterNote("PM received a Bad money from bank for a customer payment so reversing the payment"); logger.log(LogStatus.INFO, "Entered reason for reverse payment note"); ReversePayment.clk_ConfirmWithCustomerBtn(); logger.log(LogStatus.INFO, "clicked on the confirm with customer button in reverse payment page sucessfully"); Thread.sleep(6000); driver.switchTo().window(tabs.get(1)); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); boolean revheader = driver .findElement(By.xpath("//h2[contains(text(),'Transaction Reversed. Thank you!')]")) .isDisplayed(); if (revheader) { String scr = Generic_Class.takeScreenShotPath(); String ime = logger.addScreenCapture(scr); logger.log(LogStatus.PASS, "Transaction Reversed Thank you! screen is displayed successfully"); logger.log(LogStatus.INFO, "Transaction Reversed Thank you! screen is displayed successfully", ime); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String screen = Generic_Class.takeScreenShotPath(); String imag = logger.addScreenCapture(screen); logger.log(LogStatus.FAIL, "Transaction Reversed Thank you! screen is not displayed "); logger.log(LogStatus.INFO, "Transaction Reversed Thank you! screen is not displayed ", imag); } WebElement signatures = driver .findElement(By.xpath("//div[@class='signature-area']/canvas[@class='signature-pad']")); Actions actionBuilders = new Actions(driver); Action drawActions = actionBuilders.moveToElement(signatures, 660, 96).click().clickAndHold(signatures) .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signatures) .build(); drawActions.perform(); Thread.sleep(6000); driver.findElement(By.xpath("//button[text()='Accept']")).click(); logger.log(LogStatus.INFO, "Cust Signature and click on Accept button successfully"); logger.log(LogStatus.PASS, "reverse Payment made using cash"); Thread.sleep(6000); driver.switchTo().window(tabs.get(0)); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(6000); ReversePayment.clk_ApproveBtn(); logger.log(LogStatus.INFO, "clicked on the approve button in reverse payment sucessfully"); Thread.sleep(2000); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(4000); ReversePayment.Clk_RevBtn(); logger.log(LogStatus.INFO, "Clicked on Reverse button"); Thread.sleep(6000); TransactionReversedPage trnspage = new TransactionReversedPage(driver); Thread.sleep(4000); trnspage.chk_RefundCashToCustCheckBox(); logger.log(LogStatus.INFO, "clicked on the I have given refunded cash to the customer check box in Transaction Reversed sucessfully"); Thread.sleep(4000); trnspage.enter_EmployeeId(tabledata.get("UserName")); logger.log(LogStatus.INFO, "Entered EmployeeID"); Thread.sleep(3000); trnspage.click_OkBtn(); logger.log(LogStatus.INFO, "Clicked on OK button"); Thread.sleep(8000); if (cust.isCustdbTitleDisplayed()) { logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully"); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; logger.log(LogStatus.FAIL, "customer Dashboard is not displayed "); } Thread.sleep(1000); String toatlDueNowAmtAfterReversePymt = cust.getTotalDue().substring(1).replace(",", ""); logger.log(LogStatus.PASS, "Total due now amount after reverse payment in customer dashbaord is:" + toatlDueNowAmtAfterReversePymt); Double dbl_toatlDueNowAmtAfterReversePymt = Double.parseDouble(toatlDueNowAmtAfterReversePymt); Double dbl_toatlDueNowAmtBeforeReversePayment = Double.parseDouble(totalDueNowAmount); if (dbl_toatlDueNowAmtAfterReversePymt != dbl_toatlDueNowAmtBeforeReversePayment) { String sh = Generic_Class.takeScreenShotPath(); String ie = logger.addScreenCapture(sh); logger.log(LogStatus.PASS, "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly"); logger.log(LogStatus.INFO, "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly", ie); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String st = Generic_Class.takeScreenShotPath(); String ig = logger.addScreenCapture(st); logger.log(LogStatus.FAIL, "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly"); logger.log(LogStatus.INFO, "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly", ig); } } catch (Exception e) { resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "PM Dash board page is not displayed", image); e.printStackTrace(); } }
From source file:Scenarios.Payments.Payments_NewIndCustSingleSpace_CheckAnniversary.java
@Test(dataProvider = "getLoginData") public void Payments_NewIndCustSingleSpace_CheckAnniversary(Hashtable<String, String> tabledata) throws Exception { if (!(tabledata.get("Runmode").equals("Y") && tabledata.get("Payments").equals("Y"))) { resultFlag = "skip"; logger.log(LogStatus.SKIP, "Payments_NewIndCustSingleSpace_CheckAnniversary is Skipped"); throw new SkipException("Skipping the test Payments_NewIndCustSingleSpace_CheckAnniversary"); }// w ww . j a v a 2 s .c o m Reporter.log("Test Case Started", true); Thread.sleep(5000); try { logger = extent.startTest("Payments_NewIndCustSingleSpace_CheckAnniversary", "New individual customer make payment using Check anniversary pay"); testcaseName = tabledata.get("TestCases"); Reporter.log("Test case started: " + testcaseName, true); Thread.sleep(5000); JavascriptExecutor jse = (JavascriptExecutor) driver; LoginPage loginPage = new LoginPage(driver); logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully "); Thread.sleep(2000); loginPage.enterUserName(tabledata.get("UserName")); Thread.sleep(2000); logger.log(LogStatus.PASS, "entered username sucessfully"); Thread.sleep(2000); loginPage.enterPassword(tabledata.get("Password")); logger.log(LogStatus.PASS, "entered password sucessfully"); Thread.sleep(2000); loginPage.clickLogin(); logger.log(LogStatus.PASS, "clicked on login in button sucessfully"); logger.log(LogStatus.PASS, "Login to Application successfully"); // =================Handling customer facing device======================== Thread.sleep(5000); Dashboard_BifrostHostPopUp Bifrostpop = new Dashboard_BifrostHostPopUp(driver); logger.log(LogStatus.INFO, "PopUp window object is created successfully"); String biforstNum = Bifrostpop.getBiforstNo(); Reporter.log(biforstNum + "", true); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, "t"); ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles()); Reporter.log(tabs.size() + "", true); driver.switchTo().window(tabs.get(1)); driver.get(Generic_Class.getPropertyValue("CustomerScreenPath")); List<WebElement> biforstSystem = driver.findElements( By.xpath("//div[@class='scrollable-area']//span[@class='bifrost-label vertical-center']")); for (WebElement ele : biforstSystem) { if (biforstNum.equalsIgnoreCase(ele.getText().trim())) { Reporter.log(ele.getText() + "", true); ele.click(); break; } } driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(5000); driver.switchTo().window(tabs.get(0)); Thread.sleep(5000); driver.findElement(By.xpath( "//div[@id='cfsConnectionDialog']//div[@class='after-connected padding-top']//p/input[@class='psbutton-low-priority']")) .click(); Thread.sleep(5000); // ================================================================================= Thread.sleep(3000); PM_Homepage pmhomepage = new PM_Homepage(driver); logger.log(LogStatus.PASS, "creating object for the PM home page sucessfully"); Thread.sleep(3000); if (pmhomepage.isexistingCustomerModelDisplayed()) { String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", image); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "PM DashBoard dispalyed is not displayed"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed is not displayed", image); } pmhomepage.clk_findAndLeaseSpace(); logger.log(LogStatus.INFO, "Click on Find And Lease Space Link successfully"); Thread.sleep(4000); StandardStoragePage stdStorage = new StandardStoragePage(driver); logger.log(LogStatus.PASS, "Creating object for the Standard stroage page sucessfully"); Thread.sleep(1000); if (stdStorage.isSelected_yesradiobutton()) { logger.log(LogStatus.PASS, "New Customer Radio button selected by default when WALK-INS: FIND A SPACE page is launched sucessfully"); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; logger.log(LogStatus.FAIL, "New Customer Radio button is not selected by default when WALK-INS: FIND A SPACE page is launched sucessfully"); } stdStorage.Clk_ChkBx_AvlSpace(); logger.log(LogStatus.PASS, "Clicked on available bold space size checkbox in StandardStorage sucessfully"); stdStorage.click_Search(); logger.log(LogStatus.INFO, "Click on search button successfully"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); // =====================Fetching space number and based on that clicking the radio button======================== Thread.sleep(10000); List<WebElement> norows = driver .findElements(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr")); String space = null; logger.log(LogStatus.INFO, "Total number of avaiable sizes count is------>:" + norows.size()); if (norows.size() > 0) { Thread.sleep(5000); space = driver.findElement(By.xpath("//form[@id='frmReserveUnits']//div//table/tbody/tr[1]/td[4]")) .getText(); Reporter.log("space number is:" + space, true); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; logger.log(LogStatus.FAIL, "Application is not populating any data/space details with selected size dimension"); throw new Exception("Application is not populating any data/space details"); } Thread.sleep(2000); WebElement RdBtn_Space = driver.findElement(By.xpath( "//td[@class='grid-cell-space'][text()='" + space + "']/../td/input[@name='selectedIds']")); logger.log(LogStatus.PASS, "check the radio button based on the space and click on the reservation button"); Thread.sleep(5000); jse.executeScript("arguments[0].scrollIntoView()", RdBtn_Space); jse.executeScript("arguments[0].click();", RdBtn_Space); logger.log(LogStatus.PASS, "Clicked on check box of a space in this location:-------> " + space); Reporter.log("Clicked on check box of a space in this location: " + space, true); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(3000); SpaceDashboard_ThisLoc thisloc = new SpaceDashboard_ThisLoc(driver); logger.log(LogStatus.PASS, "creating object for the This location page sucessfully"); thisloc.click_Rent(); logger.log(LogStatus.PASS, "clicked on the rent button sucessfully"); Thread.sleep(5000); Leasing_ConfirmSpace confirmSpace = new Leasing_ConfirmSpace(driver); Thread.sleep(5000); confirmSpace.clk_ConfirmwtCust(); logger.log(LogStatus.PASS, "Clicked on Confirm with Customer button"); Reporter.log("Clicked on Confirm with Customer button", true); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(5000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.PASS, "Switched to Customer Screen"); Reporter.log("Switched to Customer Screen", true); Thread.sleep(9000); driver.findElement( By.xpath("//div[@class='footer-row clearfix-container']/button[@id='confirmButton']")).click(); logger.log(LogStatus.PASS, "Clicked on Confirm button in customer screen"); Reporter.log("Clicked on Confirm button in customer screen", true); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.PASS, "Switching back to screen"); Reporter.log("Switching back to screen", true); // Filling contact information Leasing_ContactInfoPage contactinfo = new Leasing_ContactInfoPage(driver); Thread.sleep(5000); String FN = "AUT" + Generic_Class.get_RandmString(); contactinfo.txt_Fname(FN); contactinfo.txt_Lname(tabledata.get("LastName")); contactinfo.clickContact_State(); List<WebElement> allstates = driver.findElements( By.xpath("//ul[@id='ContactForm_Identification_StateTypeID_listbox']/li[@class='k-item']")); // Identify the WebElement which will appear after scrolling down for (WebElement state : allstates) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } // contactinfo.select_State(tabledata.get("StateCode")); contactinfo.txt_Number(tabledata.get("DrivingLicenseNum")); contactinfo.txt_street1(tabledata.get("Street")); contactinfo.txt_city(tabledata.get("City")); contactinfo.select_State2address(); List<WebElement> allstatesadd = driver .findElements(By.xpath("//ul[@id='lesseeinfo-address-statecode_listbox']/li[@class='k-item']")); for (WebElement state : allstatesadd) { Thread.sleep(2000); if (tabledata.get("StateCode").equalsIgnoreCase(state.getText())) { state.click(); break; } } // contactinfo.select_State2(tabledata.get("State")); Thread.sleep(3000); contactinfo.txt_Zipcode(tabledata.get("Zipcode")); contactinfo.select_phoneType1(); Thread.sleep(3000); driver.findElement( By.xpath("//ul[@class='k-list k-reset ps-container ps-active-y']/li[contains(text(),'" + tabledata.get("PhoneType") + " ')]")) .click(); Thread.sleep(2000); contactinfo.txt_AreaCode(tabledata.get("Areacode")); Thread.sleep(2000); contactinfo.txt_Exchg(tabledata.get("Exchange")); Thread.sleep(2000); contactinfo.txt_lineNumber(tabledata.get("LineNumber")); Thread.sleep(2000); contactinfo.txt_email(tabledata.get("Email")); Thread.sleep(2000); contactinfo.click_CustLookUp(); Thread.sleep(15000); // Click on New Customer button on Choose an Account PopUp driver.findElement(By.linkText("Create New Customer")).click(); Thread.sleep(8000); contactinfo.clk_ActiveDutyMilitaryNoRadioBtn(driver); // Click on Verify button Thread.sleep(5000); driver.findElement(By.partialLinkText("Verify")).click(); logger.log(LogStatus.INFO, "cliked on the Verify button button "); Thread.sleep(9000); driver.findElement(By.id("confirmWithCustomerButton")).click(); Thread.sleep(5000); // Click on Confirm with Cust button logger.log(LogStatus.INFO, "clicking on Confirm with cust button successfully"); // Navigating to Customer screen driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.PASS, "Switching back to screen"); Reporter.log("Switching back to screen", true); // Entering Emergency Contact details Thread.sleep(5000); Leasing_EmergencyConatctsPage emergCon = new Leasing_EmergencyConatctsPage(driver); Thread.sleep(2000); emergCon.clickAuthorizedfor_radio(); Thread.sleep(2000); emergCon.click_custDeclines_chkBox(); emergCon.clickconfirmWithCust(); Thread.sleep(4000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(5000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(2000); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Leasing_AuthorizedAccessContactsPage autContact = new Leasing_AuthorizedAccessContactsPage(driver); Thread.sleep(8000); autContact.clickSavenProceed(); Thread.sleep(8000); Leasing_EligiblePromotionsPage eligpromo = new Leasing_EligiblePromotionsPage(driver); logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page"); eligpromo.clickSavenProceed(); Thread.sleep(8000); Leasing_LeaseQuestionairePage leaseQues = new Leasing_LeaseQuestionairePage(driver); leaseQues.clickStorageContent(); Thread.sleep(5000); List<WebElement> allstorage = driver.findElements(By.xpath( "//ul[@id='LeaseQuestionnaireUnits_0__RentalUnitContentsTypeID_listbox']//li[@class='k-item']")); for (WebElement storage : allstorage) { if (tabledata.get("StorageContent").equalsIgnoreCase(storage.getText())) { storage.click(); break; } } // Insurance is ON Thread.sleep(5000); leaseQues.clickAddInsuranceYes(); Thread.sleep(1000); leaseQues.clickCoverageList(); Thread.sleep(5000); driver.findElement(By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__InsuranceSelection_listbox']/li[2]")) .click(); Thread.sleep(5000); leaseQues.clickAccessZone(); Thread.sleep(2000); driver.findElement( By.xpath("//ul[@id='LeaseQuestionnaireUnits_0__GateControllerTimeZoneID_listbox']//li[2]")) .click(); Thread.sleep(5000); leaseQues.clickKeypadZone(); Thread.sleep(2000); driver.findElement( By.xpath("//li[contains(@id,'KeypadZone_option_selected')]/following-sibling::li[1]")).click(); Thread.sleep(5000); leaseQues.clickConfirmCust(); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(8000); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(12000); List<WebElement> allCheckbox = driver.findElements( By.xpath("//section[@class='term-group term-group--active']//input[@type='checkbox']")); for (WebElement checkbox : allCheckbox) { checkbox.click(); } Thread.sleep(5000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(3000); WebElement signature = driver.findElement( By.xpath("//div[@class='sig sigWrapper']/canvas[@class='pad js-signature-canvas']")); Actions actionBuilder = new Actions(driver); Action drawAction = actionBuilder.moveToElement(signature, 660, 96).click().clickAndHold(signature) .moveByOffset(120, 120).moveByOffset(60, 70).moveByOffset(-140, -140).release(signature) .build(); drawAction.perform(); Thread.sleep(4000); driver.findElement(By.id("confirmButton")).click(); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); Thread.sleep(6000); driver.switchTo().window(tabs.get(0)); Leasing_ReviewNApprovePage review = new Leasing_ReviewNApprovePage(driver); Thread.sleep(8000); review.clickApprove_btn(); Thread.sleep(8000); review.clickSaveproceed_btn(); Leasing_RentalFeePage rentalfee = new Leasing_RentalFeePage(driver); Thread.sleep(15000); logger.log(LogStatus.PASS, "Validating Monthly rent and Promotions in Eligible Promotion Page"); rentalfee.clickConfirmCust_btn(); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(8000); Leasing_PaymentMethodsPage payment = new Leasing_PaymentMethodsPage(driver); logger.log(LogStatus.PASS, "creating object for the Login Page sucessfully "); Thread.sleep(2000); String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.PASS, "Payment page is dispalyed sucessfully "); logger.log(LogStatus.INFO, "Payment page is dispalyed sucessfully", image); payment.clk_PayThroughdropdwn(); logger.log(LogStatus.INFO, "Clicked on payment clk_PayThroughdropdwn dropdown "); Thread.sleep(2000); // Anniversary payment option in dropdown int numberOfPixelsToDragTheScrollbarDown1 = 120; Actions dragger1 = new Actions(driver); WebElement draggablePartOfScrollbar1 = driver.findElement(By.xpath( "//ul[@class='k-list k-reset ps-container ps-active-y']//div[@class='ps-scrollbar-y-rail']//div[@class='ps-scrollbar-y']")); Thread.sleep(3000); List<WebElement> dates1 = driver .findElements(By.xpath("//div[@class='k-animation-container']//ul//li")); Thread.sleep(3000); dragger1.moveToElement(draggablePartOfScrollbar1).clickAndHold() .moveByOffset(0, numberOfPixelsToDragTheScrollbarDown1).release().build().perform(); Thread.sleep(3000); driver.findElement(By.xpath("//div[@class='k-animation-container']//ul//li[13]")).click(); Thread.sleep(4000); driver.findElement(By.xpath("//span[text()='Add/Edit Cart']")).click(); logger.log(LogStatus.INFO, "Clicked on payment Add Merchandise link "); Thread.sleep(3000); driver.findElement(By.xpath( "//div[div[div[div[text()='Lock Disc']]]]//input[@class='product-quantity webchamp-textbox']")) .sendKeys("1"); logger.log(LogStatus.INFO, "entering number of quantity in the textbox "); Thread.sleep(3000); driver.findElement(By.id("MerchandiseWindow-AddToCart")).click(); logger.log(LogStatus.INFO, "Clicked on payment Add to cart link "); Thread.sleep(4000); driver.findElement(By.xpath("//a[text()='Close']")).click(); logger.log(LogStatus.INFO, "clicked on the close button in the merchadise window "); Thread.sleep(5000); String MonthlyRentDueNowAmount = payment.get_MonthlyRentDueNowAmt(); logger.log(LogStatus.PASS, "Monthly Rent Due Now amount in payment page is------>:" + MonthlyRentDueNowAmount); String PromotionDueNowAmount = payment.get_PromotionDueNowAmt(); logger.log(LogStatus.PASS, "Promotion Due Now amount in payment page is------>:" + PromotionDueNowAmount); String InsuranceNowAmount = payment.get_InsuranceDueNowAmt(); logger.log(LogStatus.PASS, "Insurance Due Now amount in payment page is------>:" + InsuranceNowAmount); String AdministrativeDueNowAmount = payment.get_AdministrativeDueNowAmt(); logger.log(LogStatus.PASS, "Administrative Due Now amount in payment page is------>:" + AdministrativeDueNowAmount); String PayThroughDueNowAmount = payment.get_PaythroughDueNowAmt(); logger.log(LogStatus.PASS, "PayThrough Due Now amount in payment page is------>:" + PayThroughDueNowAmount); String MerchandiseAmount = payment.get_MerchandiseAmt(); logger.log(LogStatus.PASS, "MerchandiseAmount amount in payment page is------>:" + MerchandiseAmount); String SalexTaxAmount = payment.get_SalesTaxAmt(); logger.log(LogStatus.PASS, "SalexTax Amount in payment page is------>:" + SalexTaxAmount); String TotalRemaingBalanceAmt = payment.get_TotalRemaingBalanceAmt(); logger.log(LogStatus.PASS, "Total Remaing Balance Amount in payment page is------>:" + TotalRemaingBalanceAmt); double MonthlyRentamt = payment.getDoubleAmount(MonthlyRentDueNowAmount); double Promotionamt = payment.getDoubleAmount(PromotionDueNowAmount); double Insuranceamt = payment.getDoubleAmount(InsuranceNowAmount); double Administrativeamt = payment.getDoubleAmount(AdministrativeDueNowAmount); double Apythroughamt = payment.getDoubleAmount(PayThroughDueNowAmount); double Merchandiseamt = payment.getDoubleAmount(MerchandiseAmount); double SalexTaxamt = payment.getDoubleAmount(SalexTaxAmount); double TotalAmount = MonthlyRentamt + Promotionamt + Insuranceamt + Administrativeamt + Apythroughamt + Merchandiseamt + SalexTaxamt; double TotalRemUiVal = payment.getDoubleAmount(TotalRemaingBalanceAmt); Double db1 = new Double(TotalAmount); Double db2 = new Double(TotalRemUiVal); if (db1.intValue() == db2.intValue()) { String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, "Sumantion of all due amount and Total remaing amount are equal"); logger.log(LogStatus.INFO, "Sumantion of all due amount and Total remaing amount are equal", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scp = Generic_Class.takeScreenShotPath(); String ima = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "Sumantion of all due is amount and Total remaing amount are not equal"); logger.log(LogStatus.INFO, "Sumantion of all due is amount and Total remaing amount are not equal", ima); } Thread.sleep(4000); payment.selectPaymentMethod("Check", driver); logger.log(LogStatus.INFO, "Select the Check option from Payment dropdown successfully"); Thread.sleep(3000); payment.clickmanualentry(); logger.log(LogStatus.INFO, "Clicking on Manual entry button successfully"); payment.Enter_routingNumber(tabledata.get("BankRoutingNum")); logger.log(LogStatus.INFO, "Entering routing Number successfully"); payment.Enter_accountNumber(tabledata.get("CheckingAccNum")); logger.log(LogStatus.INFO, "Entering Account Number successfully"); payment.Enter_checkNumber(tabledata.get("CheckNumber")); logger.log(LogStatus.INFO, "Entering Check Number successfully"); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.sleep(2000); payment.Enter_checkAmount(TotalRemaingBalanceAmt); logger.log(LogStatus.INFO, "Entering Check amount successfully"); Thread.sleep(3000); ((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)"); payment.clickApply_btn(); logger.log(LogStatus.PASS, "clicked on the apply button"); Thread.sleep(3000); payment.clk_ConfirmWthCustBtn(); logger.log(LogStatus.PASS, "clicked on the ConfirmWthCustBtn button"); Thread.sleep(8000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(1)); logger.log(LogStatus.INFO, "Switch to Customer interaction screen successfully"); Thread.sleep(6000); driver.findElement(By.id("confirmButton")).click(); logger.log(LogStatus.INFO, "clicking on Confirm button successfully"); Thread.sleep(5000); driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.PAGE_DOWN); driver.switchTo().window(tabs.get(0)); logger.log(LogStatus.INFO, "Switch to Main page successfully"); Thread.sleep(5000); payment.clickSubmit_btn(); logger.log(LogStatus.PASS, "clicked on the submit button in payment page"); Thread.sleep(3000); TransactionCompletePopup popup = new TransactionCompletePopup(driver); String path = Generic_Class.takeScreenShotPath(); String ima = logger.addScreenCapture(path); logger.log(LogStatus.PASS, "TransactionCompletePopup dispalyed sucessfully"); logger.log(LogStatus.INFO, "TransactionCompletePopup dispalyed sucessfully", ima); popup.enterEmpNum(tabledata.get("UserName")); logger.log(LogStatus.PASS, "entered the employee id"); Thread.sleep(3000); popup.clickOk_btn(); logger.log(LogStatus.PASS, "clicked on the ok button"); Thread.sleep(3000); driver.findElement(By.xpath("//div[@class='k-widget k-window']//a[contains(text(),'No')]")).click(); Thread.sleep(8000); if (pmhomepage.isexistingCustomerModelDisplayed()) { String pa = Generic_Class.takeScreenShotPath(); String img1 = logger.addScreenCapture(pa); logger.log(LogStatus.PASS, "PM DashBoard dispalyed sucessfully"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed sucessfully", img1); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scp = Generic_Class.takeScreenShotPath(); String imag = logger.addScreenCapture(scp); logger.log(LogStatus.FAIL, "PM DashBoard dispalyed is not displayed"); logger.log(LogStatus.INFO, "PM DashBoard dispalyed is not displayed", imag); } Thread.sleep(2000); pmhomepage.clk_AdvSearchLnk(); logger.log(LogStatus.PASS, "clicked on the submit button"); Thread.sleep(6000); Advance_Search advSearch = new Advance_Search(driver); String sqlQuery = "selectaccountidfromaccountwherecustomerid=(selectcustomeridfromcustomerwherecontactid=(selectcontactidfromcontactwherefirstname='" + FN + "'andlastname='" + tabledata.get("LastName") + "'))"; String accNUm = DataBase_JDBC.executeSQLQuery(sqlQuery); Thread.sleep(6000); logger.log(LogStatus.PASS, "fetched account number from databse and account number is:" + accNUm); advSearch.enterAccNum(accNUm); logger.log(LogStatus.PASS, "entered account number"); Thread.sleep(5000); advSearch.clickSearchAccbtn(); logger.log(LogStatus.PASS, "clicked on the search button in advance search page"); Cust_AccDetailsPage cust = new Cust_AccDetailsPage(driver); Thread.sleep(8000); if (cust.isCustdbTitleDisplayed()) { String sap = Generic_Class.takeScreenShotPath(); String mag = logger.addScreenCapture(sap); logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully"); logger.log(LogStatus.INFO, "customer Dashboard is displayed successfully", mag); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scan = Generic_Class.takeScreenShotPath(); String mg = logger.addScreenCapture(scan); logger.log(LogStatus.FAIL, "customer Dashboard is not displayed "); logger.log(LogStatus.INFO, "customer Dashboard is not displayed ", mg); } Thread.sleep(1000); String totalDueNowAmount = cust.getTotalDue(); logger.log(LogStatus.PASS, "Total due now amount in customer dashbaord is---> :" + totalDueNowAmount); Double db3 = new Double(payment.getDoubleAmount(totalDueNowAmount)); if (db3.intValue() == 0) { String sap = Generic_Class.takeScreenShotPath(); String mag = logger.addScreenCapture(sap); logger.log(LogStatus.PASS, "Payment done successfully and changes reflecting in customer dash board"); logger.log(LogStatus.INFO, "Payment done successfully and changes reflecting in customer dash board", mag); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String scan = Generic_Class.takeScreenShotPath(); String mg = logger.addScreenCapture(scan); logger.log(LogStatus.FAIL, "Payment not done successfully "); logger.log(LogStatus.INFO, "Payment not done successfully ", mg); } Thread.sleep(1000); cust.click_AccountActivities(); ; logger.log(LogStatus.INFO, "Clicked on Account Activities tab in customer dashboard screen"); Thread.sleep(9000); cust.clk_CheckExpandLink(); logger.log(LogStatus.INFO, "Clicked on expand button in first row"); Thread.sleep(6000); cust.clk_ReversePaymntLnk(); logger.log(LogStatus.INFO, "Clicked on Reverse Payment link"); Thread.sleep(8000); ReversePayment ReversePayment = new ReversePayment(driver); boolean rev = driver.findElement(By.xpath("//h3[contains(text(),'Reverse Payment')]")).isDisplayed(); if (rev) { String sc = Generic_Class.takeScreenShotPath(); String im = logger.addScreenCapture(sc); logger.log(LogStatus.PASS, "Reverse Payment screen is displayed successfully"); logger.log(LogStatus.INFO, "Reverse Payment screen is displayed successfully", im); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String sap = Generic_Class.takeScreenShotPath(); String it = logger.addScreenCapture(sap); logger.log(LogStatus.FAIL, "Reverse Payment screen is not displayed "); logger.log(LogStatus.INFO, "Reverse Payment screen is not displayed ", it); } ReversePayment.Clk_ReasonDrpDwn(); logger.log(LogStatus.INFO, "Clicked on Reason drop down"); ReversePayment.SelectValueFromReasonList("Check Incorrect"); logger.log(LogStatus.INFO, "Select value from Reason dropdown"); ReversePayment .enterNote("PM received a Bad check from bank for a customer payment so reversing the payment"); logger.log(LogStatus.INFO, "Entered note"); ReversePayment.Clk_RevBtn(); logger.log(LogStatus.INFO, "Clicked on Reverse button"); Thread.sleep(6000); TransactionReversedPage trnspage = new TransactionReversedPage(driver); trnspage.enter_EmployeeId(tabledata.get("UserName")); logger.log(LogStatus.INFO, "Entered EmployeeID"); Thread.sleep(3000); trnspage.click_OkBtn(); logger.log(LogStatus.INFO, "Clicked on OK button"); Thread.sleep(6000); if (cust.isCustdbTitleDisplayed()) { logger.log(LogStatus.PASS, "customer Dashboard is displayed successfully"); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; logger.log(LogStatus.FAIL, "customer Dashboard is not displayed "); } Thread.sleep(1000); String toatlDueNowAmtAfterReversePymt = cust.getTotalDue().substring(1).replace(",", ""); logger.log(LogStatus.PASS, "Total due now amount after reverse payment in customer dashbaord is:" + toatlDueNowAmtAfterReversePymt); Double dbl_toatlDueNowAmtAfterReversePymt = Double.parseDouble(toatlDueNowAmtAfterReversePymt); Double dbl_toatlDueNowAmtBeforeReversePayment = Double.parseDouble(totalDueNowAmount); if (dbl_toatlDueNowAmtAfterReversePymt != dbl_toatlDueNowAmtBeforeReversePayment) { String sh = Generic_Class.takeScreenShotPath(); String ie = logger.addScreenCapture(sh); logger.log(LogStatus.PASS, "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly"); logger.log(LogStatus.INFO, "Reverse payment is done sucessful total due amount and changes are reflecting in UI properly", ie); } else { if (resultFlag.equals("pass")) resultFlag = "fail"; String st = Generic_Class.takeScreenShotPath(); String ig = logger.addScreenCapture(st); logger.log(LogStatus.FAIL, "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly"); logger.log(LogStatus.INFO, "Reverse payment is not done sucessful total due amount and changes are not reflecting in UI properly", ig); } } catch (Exception e) { resultFlag = "fail"; String scpath = Generic_Class.takeScreenShotPath(); String image = logger.addScreenCapture(scpath); logger.log(LogStatus.FAIL, "Page is not displayed", image); e.printStackTrace(); } }