@And("^I do a credit check pass the (.*) Account$") public static void doCreditCheckOnAccount(String AccName) { if (AccName.equalsIgnoreCase("Parent")) { accToBeChecked = parent_Account; } else { accToBeChecked = child_Account; } WebNavPage.enterAnyTextInAField(HomePage.search, accToBeChecked); WebNavPage.clickALink(HomePage.searchBTN); WebNavPage.waitForElementToLoad(); String accLocator = "//a[contains(text(),'" + accToBeChecked + "')]"; try { WebNavPage.elementWithXPathExists(accLocator); } catch (Exception e) { e.printStackTrace(); System.out.println("The Account" + accToBeChecked + "is not displayed in the search results"); } finally { WebNavPage.clickALink(accLocator); WebNavPage.waitForElementToLoad(); WebNavPage.clickALink(AccountsPage.edit); WebNavPage.waitForElementToLoad(); WebNavPage.checkACheckBox(AccountsPage.CreCheck); WebNavPage.enterAnyNumberInAField(AccountsPage.CreRefNum, 1111); WebNavPage.clickALink(HomePage.saveBTN); WebNavPage.waitForElementToLoad(); } }
@When("^I link the Parent Account to the Child Account$") public void linkChildToParent() { WebNavPage.clickALink(AccountsPage.edit); WebNavPage.waitForElementToLoad(); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.parentAccount, parent_Account); WebNavPage.clickALink(HomePage.saveBTN); WebNavPage.waitForElementToLoad(); }
public static void createAnAccount(String AccountName) throws InterruptedException { if (!WebNavPage.elementWithXPathExists("//div[@id = 'createNewButton']")) { WebNavPage.clickALink(HomePage.activateSideMenu); } WebNavPage.clickALinkWithCssLocator(HomePage.createNewDropdown); WebNavPage.clickALinkWithCssLocator(HomePage.accountOptionFromDropdown); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.accountName, AccountName); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.phone, "0208456789"); WebNavPage.enterAnyTextInAField(AccountsPage.email, "*****@*****.**"); WebNavPage.checkACheckBox(AccountsPage.dynamicTeleTracking); WebNavPage.enterAnyTextInAField(AccountsPage.telephoneTrackingNum, "25823"); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.website, "http://www.test.com"); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.billingStreet, "1, Some Street"); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.billingCity, "Some City"); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.billingPostcode, "E98 1XY"); WebNavPage.enterAnyTextInAField(AccountsPage.SAPId, "9777777"); WebNavPage.selectingAnOptionFromList("Car Dealer", AccountsPage.accType); WebNavPage.selectAnOptionFromAList("Key Account", AccountsPage.accSubType); WebNavPage.enterAnyTextInAField(AccountsPage.billCountry, "UK"); WebNavPage.selectingAnOptionFromList("South-East", AccountsPage.region); WebNavPage.clickALink(AccountsPage.copyBillingAddress); WebNavPage.clickALink(HomePage.saveBTN); if (WebNavPage.getText("//div[@id='00N3000000AeABd_ileinner']").contains("SF") != false) { WebNavPage.waitForElementToLoad(); } else { System.out.println( "The Dealer ID for the Account is :" + WebNavPage.getText("//div[@id='00N3000000AeABd_ileinner']")); } }
public static void clickOnATab(String TabName) { String tabToClick = "//span[contains(text(), '" + TabName + "')]"; WebNavPage.clickALink(tabToClick); WebNavPage.waitForElementToLoad(); }