List of usage examples for org.openqa.selenium Keys CONTROL
Keys CONTROL
To view the source code for org.openqa.selenium Keys CONTROL.
Click Source Link
From source file:org.xwiki.test.wysiwyg.TabsTest.java
License:Open Source License
/** * Tests if the switch to WYSIWYG tab action can be canceled. *///ww w .j av a 2 s . c o m @Test public void testCancelSwitchToWysiwyg() { // Switch to source tab and insert some content that takes time to render. A code macro is perfect for this. switchToSource(); StringBuilder sourceText = new StringBuilder(); sourceText.append("{{code language=\"java\"}}\n"); sourceText.append("public final class Apple extends Fruit {\n"); sourceText.append(" public String getColor() {\n"); sourceText.append(" return \"red\";\n"); sourceText.append(" }\n"); sourceText.append("}\n"); sourceText.append("{{/code}}"); setSourceText(sourceText.toString()); // Place the caret before "Apple". getSourceTextArea().sendKeys(Keys.HOME, Keys.PAGE_UP, Keys.ARROW_DOWN, Keys.chord(Keys.CONTROL, Keys.ARROW_RIGHT, Keys.ARROW_RIGHT, Keys.ARROW_RIGHT), Keys.ARROW_RIGHT); // Switch to rich text but don't wait till the rich text area finishes loading. switchToWysiwyg(false); // Switch back to source before the rich text area is reloaded. switchToSource(); // Change the content. getSourceTextArea().sendKeys("X"); // Switch to WYSIWYG tab again, this time with a different source text. Wait for the rich text area to load. switchToWysiwyg(); // Check the result. switchToSource(); getSourceTextArea().sendKeys("Y"); assertSourceText(sourceText.substring(0, 44) + "XY" + sourceText.substring(44)); }
From source file:org.xwiki.wysiwyg.test.ui.EditWYSIWYGTest.java
License:Open Source License
/** * Test if an undo step reverts only one paste operation from a sequence, and not all of them. */// w ww . j a va 2 s . c om @Test @IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See http://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177") }) public void testUndoRepeatedPaste() { EditorElement editor = this.editPage.getContentEditor(); RichTextAreaElement textArea = editor.getRichTextArea(); // Type text, select it (Shift+LeftArrow) and copy it (Control+C). // NOTE: We don't use Control+A to select the text because it selects also the BR element. textArea.sendKeys("q", Keys.chord(Keys.SHIFT, Keys.ARROW_LEFT), Keys.chord(Keys.CONTROL, "c")); // Then paste it 4 times (Control+V). for (int i = 0; i < 4; i++) { // Release the key after each paste so that the history records an entry for each paste. In case the paste // content is cleaned automatically, the editor cleans consecutive paste events (that happen one after // another) together and so a single history entry is recorded for such a group of paste events. textArea.sendKeys(Keys.chord(Keys.CONTROL, "v")); } // Undo the last paste. editor.getToolBar().clickUndoButton(); Assert.assertEquals("qqq", textArea.getText()); }
From source file:org.zanata.page.AbstractPage.java
License:Open Source License
/** * Enter text into an element./* w w w .jav a 2 s . c o m*/ * * Waits for notifications to be dismissed and element to be ready and visible before entering * the text. * If no checking is performed, the resulting screenshot may not be accurate. * @param element element to pass text to * @param text text to be entered * @param clear clear the element's text before entering new text * @param inject use sendKeys rather than the Actions chain (direct injection) * @param check check the 'value' attribute for success, and accurate screenshot delay */ public void enterText(final WebElement element, final String text, boolean clear, boolean inject, final boolean check) { removeNotifications(); waitForNotificationsGone(); scrollIntoView(element); triggerScreenshot("_pretext"); waitForAMoment().withMessage("editable: " + element.toString()) .until(ExpectedConditions.elementToBeClickable(element)); if (inject) { if (clear) { element.clear(); } element.sendKeys(text); } else { Actions enterTextAction = new Actions(getDriver()).moveToElement(element); enterTextAction = enterTextAction.click(); // Fields can 'blur' on click waitForPageSilence(); if (clear) { enterTextAction = enterTextAction.sendKeys(Keys.chord(Keys.CONTROL, "a")).sendKeys(Keys.DELETE); // Fields can 'blur' on clear waitForPageSilence(); } enterTextAction.sendKeys(text).perform(); } if (check) { waitForAMoment().withMessage("Text equal to entered").until((Predicate<WebDriver>) webDriver -> { String foundText = element.getAttribute("value"); if (!text.equals(foundText)) { log.info("Found: {}", foundText); triggerScreenshot("_textWaiting"); return false; } return true; }); } else { log.info("Not checking text entered"); } triggerScreenshot("_text"); }
From source file:page.Crawl.java
License:Open Source License
public static boolean run(Node father, String url, WebDriver driver) { System.out.println(" > crawling url: " + url); try {//from w w w. jav a 2 s . c o m driver.get(url); try { Thread.sleep(Globals.SLEEP_WAITING_FOR_PAGE_LOAD); } catch (Exception ex) { System.out.println("InterruptedException in crawl.run()"); ex.printStackTrace(); System.exit(-1); } List<WebElement> list = null; int old_size = 0; int new_size = 0; int loop = 1; do { //SCROLL TILL THE END OF THE PAGE old_size = new_size; int THRESHOLD = loop * Globals.BASE_SCROLL_STEP; for (int i = 0; i < THRESHOLD; i++) { JavascriptExecutor jse = (JavascriptExecutor) driver; jse.executeScript("window.scrollTo(0,document.body.scrollHeight)", ""); try { Thread.sleep(Globals.SLEEP_BEFORE_SCROLL_MS); } catch (Exception ex) { System.out.println("InterruptedException in crawl.run()"); ex.printStackTrace(); System.exit(-1); } } list = driver .findElements(By.xpath("//div[starts-with(@class, '" + Globals.MAIN_CLASS_NAME + "')]")); new_size = list.size(); //System.out.println("old: "+old_size+", new: "+new_size+", loop: "+loop); loop++; } while (old_size != new_size); if (new_size == 0) { return false; } for (WebElement element : list) { String date = ""; String id = ""; List<WebElement> ids = element .findElements(By.xpath(".//a[contains(@class, '" + Globals.ID_CLASS_NAME + "')]")); for (WebElement id_element : ids) { String hovercard = id_element.getAttribute("data-hovercard"); id = hovercard.replace(Globals.HOVERCARD_ID, ""); //String href = id_element.getAttribute("href"); //System.out.println("user: "+hovercard); //System.out.println("page: "+href); } List<WebElement> dates = element .findElements(By.xpath(".//abbr[contains(@class, '" + Globals.DATE_CLASS + "')]")); for (WebElement id_date : dates) { date = id_date.getAttribute("title"); //System.out.println("date: "+date); } if (id.equalsIgnoreCase("")) { System.out.println("ERRORE: id nullo per url " + url); return false; } Node current = new Node(id, date, father); List<WebElement> shared = element .findElements(By.xpath(".//a[contains(@class, '" + Globals.SHARE_CLASS + "')]")); for (WebElement id_shared : shared) { String href = id_shared.getAttribute("href"); //System.out.println("shares: "+href); //String text = id_shared.getText(); //System.out.println(text //DFS //OPEN NEW TAB WebElement body = driver.findElement(By.tagName("body")); body.sendKeys(Keys.CONTROL + "t"); try { Thread.sleep(Globals.SLEEP_WAITING_FOR_PAGE_LOAD); } catch (Exception ex) { System.out.println("InterruptedException in crawl.run()"); ex.printStackTrace(); System.exit(-1); } //driver.switchTo().window(tabs.get(1)); if (!run(current, href, driver)) { body.sendKeys(Keys.CONTROL + "w"); return false; } ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles()); driver.switchTo().window(tabs.get(tabs.size() - 1)); } father.addChildren(current); } } catch (Exception e) { System.out.println("WARNING: unable to crawl url: " + url); e.printStackTrace(); } //CLOSE CURRENT TAB WebElement body = driver.findElement(By.tagName("body")); body.sendKeys(Keys.CONTROL + "w"); return true; }
From source file:PageComponents.TaskTable.java
public void addNewTaskUsing(Task task, CharSequence... keys) { pressFunctionalKey(keys);//from ww w . j av a 2 s .c o m new TaskRow(driver).fillTask(task); pressFunctionalKey(Keys.CONTROL, "s"); }
From source file:ru.stqa.selenium.decorated.events.WebDriverListenerTest.java
License:Apache License
@Test void canFireEventForKeyboardPressKey() { Fixture fixture = new Fixture(); final Keyboard keyboard = mock(Keyboard.class); when(fixture.mockedDriver.getKeyboard()).thenReturn(keyboard); fixture.driver.getKeyboard().pressKey(Keys.CONTROL); verify(fixture.mockedDriver, times(1)).getKeyboard(); verifyNoMoreInteractions(fixture.mockedDriver); verify(keyboard, times(1)).pressKey(Keys.CONTROL); verifyNoMoreInteractions(keyboard);//www. j a va2s .c om verify(fixture.listener, times(1)).beforePressKey(keyboard, Keys.CONTROL); verify(fixture.listener, times(1)).afterPressKey(keyboard, Keys.CONTROL); verifyNoMoreInteractions(fixture.listener); }
From source file:ru.stqa.selenium.decorated.events.WebDriverListenerTest.java
License:Apache License
@Test void canFireEventForKeyboardReleaseKey() { Fixture fixture = new Fixture(); final Keyboard keyboard = mock(Keyboard.class); when(fixture.mockedDriver.getKeyboard()).thenReturn(keyboard); fixture.driver.getKeyboard().releaseKey(Keys.CONTROL); verify(fixture.mockedDriver, times(1)).getKeyboard(); verifyNoMoreInteractions(fixture.mockedDriver); verify(keyboard, times(1)).releaseKey(Keys.CONTROL); verifyNoMoreInteractions(keyboard);/* www . j av a2s . c o m*/ verify(fixture.listener, times(1)).beforeReleaseKey(keyboard, Keys.CONTROL); verify(fixture.listener, times(1)).afterReleaseKey(keyboard, Keys.CONTROL); verifyNoMoreInteractions(fixture.listener); }
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 {// w w w. j a v a2s. 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 ww w. j a va 2 s . 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 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 ww w.j ava 2s. com 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(); } }